GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
osmosdr_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file osmosdr_signal_source.h
3  * \brief Signal source wrapper for OsmoSDR-compatible front-ends, such as
4  * HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
5  * (see https://osmocom.org/projects/rtl-sdr/wiki for more information)
6  * \author Javier Arribas, 2012. jarribas(at)cttc.es
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
11  *
12  * GNSS-SDR is a software defined Global Navigation
13  * Satellite Systems receiver
14  *
15  * This file is part of GNSS-SDR.
16  *
17  * SPDX-License-Identifier: GPL-3.0-or-later
18  *
19  * -----------------------------------------------------------------------------
20  */
21 
22 #ifndef GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
23 #define GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
24 
25 #include "concurrent_queue.h"
26 #include "gnss_block_interface.h"
27 #include <gnuradio/blocks/file_sink.h>
28 #include <pmt/pmt.h>
29 #include <cstdint>
30 #include <memory>
31 #include <osmosdr/source.h>
32 #include <stdexcept>
33 #include <string>
34 #if GNURADIO_USES_STD_POINTERS
35 #else
36 #include <boost/shared_ptr.hpp>
37 #endif
38 
40 
41 /*!
42  * \brief This class reads samples OsmoSDR-compatible front-ends, such as
43  * HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
44  * (see https://osmocom.org/projects/rtl-sdr/wiki)
45  */
47 {
48 public:
49  OsmosdrSignalSource(const ConfigurationInterface* configuration,
50  const std::string& role, unsigned int in_stream,
51  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
52 
53  ~OsmosdrSignalSource() = default;
54 
55  inline std::string role() override
56  {
57  return role_;
58  }
59 
60  /*!
61  * \brief Returns "Osmosdr_Signal_Source"
62  */
63  inline std::string implementation() override
64  {
65  return "Osmosdr_Signal_Source";
66  }
67 
68  inline size_t item_size() override
69  {
70  return item_size_;
71  }
72 
73  void connect(gr::top_block_sptr top_block) override;
74  void disconnect(gr::top_block_sptr top_block) override;
75  gr::basic_block_sptr get_left_block() override;
76  gr::basic_block_sptr get_right_block() override;
77 
78 private:
79  void driver_instance();
80 
81  osmosdr::source::sptr osmosdr_source_;
82 #if GNURADIO_USES_STD_POINTERS
83  std::shared_ptr<gr::block> valve_;
84 #else
85  boost::shared_ptr<gr::block> valve_;
86 #endif
87  gr::blocks::file_sink::sptr file_sink_;
88 
89  std::string role_;
90  std::string item_type_;
91  std::string dump_filename_;
92  std::string osmosdr_args_;
93  std::string antenna_;
94 
95  // Front-end settings
96  double sample_rate_;
97  double freq_;
98  double gain_;
99  double if_gain_;
100  double rf_gain_;
101 
102  size_t item_size_;
103  int64_t samples_;
104 
105  unsigned int in_stream_;
106  unsigned int out_stream_;
107 
108  bool AGC_enabled_;
109  bool dump_;
110 };
111 
112 #endif // GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
This class reads samples OsmoSDR-compatible front-ends, such as HackRF or Realtek&#39;s RTL2832U-based US...
std::string implementation() override
Returns "Osmosdr_Signal_Source".
This abstract class represents an interface to GNSS blocks.