GNSS-SDR  0.0.14
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  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (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_OSMOSDR_SIGNAL_SOURCE_H
20 #define GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
21 
22 #include "concurrent_queue.h"
23 #include "gnss_block_interface.h"
24 #include <gnuradio/blocks/file_sink.h>
25 #include <pmt/pmt.h>
26 #include <cstdint>
27 #include <memory>
28 #include <osmosdr/source.h>
29 #include <stdexcept>
30 #include <string>
31 
32 /** \addtogroup Signal_Source
33  * \{ */
34 /** \addtogroup Signal_Source_adapters
35  * \{ */
36 
37 
39 
40 /*!
41  * \brief This class reads samples OsmoSDR-compatible front-ends, such as
42  * HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
43  * (see https://osmocom.org/projects/rtl-sdr/wiki)
44  */
46 {
47 public:
48  OsmosdrSignalSource(const ConfigurationInterface* configuration,
49  const std::string& role, unsigned int in_stream,
50  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
51 
52  ~OsmosdrSignalSource() = default;
53 
54  inline std::string role() override
55  {
56  return role_;
57  }
58 
59  /*!
60  * \brief Returns "Osmosdr_Signal_Source"
61  */
62  inline std::string implementation() override
63  {
64  return "Osmosdr_Signal_Source";
65  }
66 
67  inline size_t item_size() override
68  {
69  return item_size_;
70  }
71 
72  void connect(gr::top_block_sptr top_block) override;
73  void disconnect(gr::top_block_sptr top_block) override;
74  gr::basic_block_sptr get_left_block() override;
75  gr::basic_block_sptr get_right_block() override;
76 
77 private:
78  void driver_instance();
79 
80  osmosdr::source::sptr osmosdr_source_;
81  gnss_shared_ptr<gr::block> valve_;
82  gr::blocks::file_sink::sptr file_sink_;
83 
84  std::string role_;
85  std::string item_type_;
86  std::string dump_filename_;
87  std::string osmosdr_args_;
88  std::string antenna_;
89 
90  // Front-end settings
91  double sample_rate_;
92  double freq_;
93  double gain_;
94  double if_gain_;
95  double rf_gain_;
96 
97  size_t item_size_;
98  int64_t samples_;
99 
100  unsigned int in_stream_;
101  unsigned int out_stream_;
102 
103  bool AGC_enabled_;
104  bool dump_;
105 };
106 
107 
108 /** \} */
109 /** \} */
110 #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.