GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
uhd_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file uhd_signal_source.h
3  * \brief Interface for the Universal Hardware Driver signal source
4  * \author Javier Arribas, 2012. jarribas(at)cttc.es
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 #ifndef GNSS_SDR_UHD_SIGNAL_SOURCE_H
18 #define GNSS_SDR_UHD_SIGNAL_SOURCE_H
19 
20 #include "concurrent_queue.h"
21 #include "gnss_block_interface.h"
22 #include <gnuradio/blocks/file_sink.h>
23 #include <gnuradio/hier_block2.h>
24 #include <gnuradio/uhd/usrp_source.h>
25 #include <pmt/pmt.h>
26 #include <cstdint>
27 #include <string>
28 #include <vector>
29 
30 
31 /** \addtogroup Signal_Source
32  * \{ */
33 /** \addtogroup Signal_Source_adapters
34  * \{ */
35 
37 
38 /*!
39  * \brief This class reads samples from a UHD device (see http://code.ettus.com/redmine/ettus/projects/uhd/wiki)
40  */
42 {
43 public:
44  UhdSignalSource(const ConfigurationInterface* configuration,
45  const std::string& role, unsigned int in_stream,
46  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
47 
48  ~UhdSignalSource() = default;
49 
50  inline std::string role() override
51  {
52  return role_;
53  }
54 
55  /*!
56  * \brief Returns "UHD_Signal_Source"
57  */
58  inline std::string implementation() override
59  {
60  return "UHD_Signal_Source";
61  }
62 
63  inline size_t item_size() override
64  {
65  return item_size_;
66  }
67 
68  void connect(gr::top_block_sptr top_block) override;
69  void disconnect(gr::top_block_sptr top_block) override;
70  gr::basic_block_sptr get_left_block() override;
71  gr::basic_block_sptr get_right_block() override;
72  gr::basic_block_sptr get_right_block(int RF_channel) override;
73 
74 private:
75  gr::uhd::usrp_source::sptr uhd_source_;
76 
77  std::vector<gnss_shared_ptr<gr::block>> valve_;
78  std::vector<gr::blocks::file_sink::sptr> file_sink_;
79  std::vector<double> freq_;
80  std::vector<double> gain_;
81  std::vector<double> IF_bandwidth_hz_;
82  std::vector<uint64_t> samples_;
83  std::vector<std::string> dump_filename_;
84  std::vector<bool> dump_;
85 
86  uhd::stream_args_t uhd_stream_args_; // UHD SETTINGS
87 
88  std::string device_address_;
89  std::string item_type_;
90  std::string subdevice_;
91  std::string clock_source_;
92  std::string role_;
93 
94  double sample_rate_;
95  size_t item_size_;
96  int RF_channels_;
97  unsigned int in_stream_;
98  unsigned int out_stream_;
99 };
100 
101 
102 /** \} */
103 /** \} */
104 #endif // GNSS_SDR_UHD_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
This class reads samples from a UHD device (see http://code.ettus.com/redmine/ettus/projects/uhd/wiki...
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
std::string implementation() override
Returns "UHD_Signal_Source".
This abstract class represents an interface to GNSS blocks.