/*! * \file signal_generator_c.h * \brief GNU Radio source block that generates synthesized GNSS signal. * \author Marc Molina, 2013. marc.molina.pena@gmail.com * * ------------------------------------------------------------------------- * * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver * * This file is part of GNSS-SDR. * * GNSS-SDR is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNSS-SDR is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNSS-SDR. If not, see . * * ------------------------------------------------------------------------- */ #ifndef GNSS_SDR_SIGNAL_GENERATOR_C_H_ #define GNSS_SDR_SIGNAL_GENERATOR_C_H_ #include "gnss_signal.h" #include #include #include #include class signal_generator_c; /* * We use boost::shared_ptr's instead of raw pointers for all access * to gr_blocks (and many other data structures). The shared_ptr gets * us transparent reference counting, which greatly simplifies storage * management issues. * * See https://www.boost.org/doc/libs/release/libs/smart_ptr/doc/html/smart_ptr.html * * As a convention, the _sptr suffix indicates a boost::shared_ptr */ using signal_generator_c_sptr = boost::shared_ptr; /*! * \brief Return a shared_ptr to a new instance of gen_source. * * To avoid accidental use of raw pointers, gen_source's * constructor is private. signal_make_generator_c is the public * interface for creating new instances. */ signal_generator_c_sptr signal_make_generator_c( const std::vector &signal1, const std::vector &system, const std::vector &PRN, const std::vector &CN0_dB, const std::vector &doppler_Hz, const std::vector &delay_chips, const std::vector &delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB); /*! * \brief This class generates synthesized GNSS signal. * \ingroup block * * \sa gen_source for a version that subclasses gr_block. */ class signal_generator_c : public gr::block { public: ~signal_generator_c() = default; // public destructor // Where all the action really happens int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: friend signal_generator_c_sptr signal_make_generator_c( const std::vector &signal1, const std::vector &system, const std::vector &PRN, const std::vector &CN0_dB, const std::vector &doppler_Hz, const std::vector &delay_chips, const std::vector &delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB); signal_generator_c( std::vector signal1, std::vector system, const std::vector &PRN, std::vector CN0_dB, std::vector doppler_Hz, std::vector delay_chips, std::vector delay_sec, bool data_flag, bool noise_flag, unsigned int fs_in, unsigned int vector_length, float BW_BB); void init(); void generate_codes(); std::vector signal_; std::vector system_; std::vector PRN_; std::vector CN0_dB_; std::vector doppler_Hz_; std::vector delay_chips_; std::vector delay_sec_; bool data_flag_; bool noise_flag_; unsigned int fs_in_; unsigned int num_sats_; unsigned int vector_length_; float BW_BB_; std::vector samples_per_code_; std::vector num_of_codes_per_vector_; std::vector data_bit_duration_ms_; std::vector ms_counter_; std::vector start_phase_rad_; std::vector current_data_bits_; std::vector current_data_bit_int_; std::vector data_modulation_; std::vector pilot_modulation_; std::vector> sampled_code_data_; std::vector> sampled_code_pilot_; std::vector complex_phase_; unsigned int work_counter_{}; std::random_device r; std::uniform_int_distribution uniform_dist; std::normal_distribution normal_dist; }; #endif // GNSS_SDR_SIGNAL_GENERATOR_C_H_