GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
9  *
10  * GNSS-SDR is a software defined Global Navigation
11  * Satellite Systems receiver
12  *
13  * This file is part of GNSS-SDR.
14  *
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_UHD_SIGNAL_SOURCE_H
21 #define GNSS_SDR_UHD_SIGNAL_SOURCE_H
22 
23 #include "concurrent_queue.h"
24 #include "gnss_block_interface.h"
25 #include <gnuradio/blocks/file_sink.h>
26 #include <gnuradio/hier_block2.h>
27 #include <gnuradio/uhd/usrp_source.h>
28 #include <pmt/pmt.h>
29 #include <cstdint>
30 #include <memory>
31 #include <string>
32 #include <vector>
33 #if GNURADIO_USES_STD_POINTERS
34 #else
35 #include <boost/shared_ptr.hpp>
36 #endif
37 
38 
40 
41 /*!
42  * \brief This class reads samples from a UHD device (see http://code.ettus.com/redmine/ettus/projects/uhd/wiki)
43  */
45 {
46 public:
47  UhdSignalSource(const ConfigurationInterface* configuration,
48  const std::string& role, unsigned int in_stream,
49  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
50 
51  ~UhdSignalSource() = default;
52 
53  inline std::string role() override
54  {
55  return role_;
56  }
57 
58  /*!
59  * \brief Returns "UHD_Signal_Source"
60  */
61  inline std::string implementation() override
62  {
63  return "UHD_Signal_Source";
64  }
65 
66  inline size_t item_size() override
67  {
68  return item_size_;
69  }
70 
71  void connect(gr::top_block_sptr top_block) override;
72  void disconnect(gr::top_block_sptr top_block) override;
73  gr::basic_block_sptr get_left_block() override;
74  gr::basic_block_sptr get_right_block() override;
75  gr::basic_block_sptr get_right_block(int RF_channel) override;
76 
77 private:
78  gr::uhd::usrp_source::sptr uhd_source_;
79 #if GNURADIO_USES_STD_POINTERS
80  std::vector<std::shared_ptr<gr::block>> valve_;
81 #else
82  std::vector<boost::shared_ptr<gr::block>> valve_;
83 #endif
84  std::vector<gr::blocks::file_sink::sptr> file_sink_;
85  std::vector<double> freq_;
86  std::vector<double> gain_;
87  std::vector<double> IF_bandwidth_hz_;
88  std::vector<uint64_t> samples_;
89  std::vector<std::string> dump_filename_;
90  std::vector<bool> dump_;
91 
92  uhd::stream_args_t uhd_stream_args_; // UHD SETTINGS
93 
94  std::string device_address_;
95  std::string item_type_;
96  std::string subdevice_;
97  std::string clock_source_;
98  std::string role_;
99 
100  double sample_rate_;
101  size_t item_size_;
102  int RF_channels_;
103  unsigned int in_stream_;
104  unsigned int out_stream_;
105 };
106 
107 #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.