GNSS-SDR  0.0.19
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 "signal_source_base.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 size_t item_size() override
55  {
56  return item_size_;
57  }
58 
59  void connect(gr::top_block_sptr top_block) override;
60  void disconnect(gr::top_block_sptr top_block) override;
61  gr::basic_block_sptr get_left_block() override;
62  gr::basic_block_sptr get_right_block() override;
63 
64 private:
65  void driver_instance();
66 
67  osmosdr::source::sptr osmosdr_source_;
68  gnss_shared_ptr<gr::block> valve_;
69  gr::blocks::file_sink::sptr file_sink_;
70 
71  std::string item_type_;
72  std::string dump_filename_;
73  std::string osmosdr_args_;
74  std::string antenna_;
75 
76  // Front-end settings
77  double sample_rate_;
78  double freq_;
79  double gain_;
80  double if_gain_;
81  double rf_gain_;
82  double if_bw_;
83 
84  size_t item_size_;
85  int64_t samples_;
86 
87  unsigned int in_stream_;
88  unsigned int out_stream_;
89 
90  bool AGC_enabled_;
91  bool dump_;
92 };
93 
94 
95 /** \} */
96 /** \} */
97 #endif // GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
Header file of the base class to signal_source GNSS blocks.
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...