GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
base_pcps_acquisition_custom.h
1 /*!
2  * \file base_ca_pcps_acquisition_custom.h
3  * \brief Adapts a PCPS acquisition block to an AcquisitionInterface
4  * \authors <ul>
5  * <li> Mathieu Favreau, 2025. favreau.mathieu(at)hotmail.com
6  * </ul>
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 #ifndef GNSS_SDR_BASE_PCPS_ACQUISITION_CUSTOM_H
20 #define GNSS_SDR_BASE_PCPS_ACQUISITION_CUSTOM_H
21 
23 #include "channel_fsm.h"
24 #include "gnss_synchro.h"
25 #include "pcps_acquisition.h"
26 #include <gnuradio/blocks/stream_to_vector.h>
27 #include <volk_gnsssdr/volk_gnsssdr_alloc.h>
28 #include <limits>
29 
30 /** \addtogroup Acquisition
31  * Classes for GNSS signal acquisition
32  * \{ */
33 /** \addtogroup Acq_adapters acquisition_adapters
34  * Wrap GNU Radio acquisition blocks with an AcquisitionInterface
35  * \{ */
36 
37 
39 
41 {
42 public:
43  virtual float calculate_threshold(const Acq_Conf& acq_parameters) const = 0;
44 };
45 
47 {
48 public:
49  float calculate_threshold(const Acq_Conf& acq_parameters) const override;
50 };
51 
53 {
54 public:
55  float calculate_threshold(const Acq_Conf& acq_parameters) const override;
56 };
57 
59 {
60 public:
61  explicit ThresholdComputeQuickSync(uint32_t folding_factor);
62 
63  float calculate_threshold(const Acq_Conf& acq_parameters) const override;
64 
65 private:
66  const uint32_t folding_factor_;
67 };
68 
69 /*!
70  * \brief This class adapts a PCPS acquisition block to an AcquisitionInterface
71  */
73 {
74 public:
76  const std::string& role,
77  unsigned int in_streams,
78  unsigned int out_streams,
79  double chip_rate,
80  double code_length_chips,
81  unsigned int ms_per_code,
82  bool use_stream_to_vector,
83  const ThresholdComputeInterface& threshold_compute,
84  uint32_t max_sampled_ms = std::numeric_limits<uint32_t>::max());
85 
86  ~BasePcpsAcquisitionCustom() = default;
87 
88  inline std::string role() override { return role_; }
89 
90  inline size_t item_size() override { return item_size_; }
91 
92  void connect(gr::top_block_sptr top_block) override;
93  void disconnect(gr::top_block_sptr top_block) override;
94  gr::basic_block_sptr get_left_block() override;
95  gr::basic_block_sptr get_right_block() override;
96 
97  /*!
98  * \brief Set acquisition/tracking common Gnss_Synchro object pointer
99  * to efficiently exchange synchronization data between acquisition and
100  * tracking blocks
101  */
102  void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
103 
104  /*!
105  * \brief Set acquisition channel unique ID
106  */
107  void set_channel(unsigned int channel) override;
108 
109  /*!
110  * \brief Set channel fsm associated to this acquisition instance
111  */
112  void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override;
113 
114  /*!
115  * \brief Returns the maximum peak of grid search
116  */
117  signed int mag() override;
118 
119  /*!
120  * \brief Restart acquisition algorithm
121  */
122  void reset() override;
123 
124  /*!
125  * \brief Stop running acquisition
126  */
127  void stop_acquisition() override;
128 
129  void set_resampler_latency(uint32_t /*latency_samples*/) override {};
130 
131  /*!
132  * \brief Sets local code
133  */
134  void set_local_code() override;
135 
136 
137 protected:
138  bool is_type_gr_complex() const { return is_type_gr_complex_; }
139 
140  const Acq_Conf acq_parameters_;
141  acquisition_impl_interface_sptr acquisition_cc_;
142  Gnss_Synchro* gnss_synchro_;
143  unsigned int channel_;
144  volk_gnsssdr::vector<std::complex<float>> code_;
145 
146 private:
147  /*!
148  * \brief Generate code
149  */
150  virtual void code_gen_complex_sampled(own::span<std::complex<float>> dest, uint32_t prn, int32_t sampling_freq) = 0;
151 
152  gr::blocks::stream_to_vector::sptr stream_to_vector_;
153  const std::string role_;
154  const bool is_type_gr_complex_;
155  const size_t item_size_;
156  const bool use_stream_to_vector_;
157 };
158 
159 
160 /** \} */
161 /** \} */
162 #endif // GNSS_SDR_BASE_PCPS_ACQUISITION_H
This class adapts a PCPS acquisition block to an AcquisitionInterface.
void set_channel(unsigned int channel) override
Set acquisition channel unique ID.
Header file of the interface to an acquisition implementation GNSS block.
Interface of the State Machine for channel.
void stop_acquisition() override
Stop running acquisition.
This class implements a Parallel Code Phase Search Acquisition.
This abstract class represents an interface to an acquisition GNSS block.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This abstract class represents an interface to configuration parameters.
void reset() override
Restart acquisition algorithm.
signed int mag() override
Returns the maximum peak of grid search.
void set_channel_fsm(std::weak_ptr< ChannelFsm > channel_fsm) override
Set channel fsm associated to this acquisition instance.
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) override
Set acquisition/tracking common Gnss_Synchro object pointer to efficiently exchange synchronization d...
void set_local_code() override
Sets local code.
Interface of the Gnss_Synchro class.