GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
rtl_tcp_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file rtl_tcp_signal_source.h
3  * \brief Signal source which reads from rtl_tcp.
4  * (see https://osmocom.org/projects/rtl-sdr/wiki for more information)
5  * \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
10  *
11  * GNSS-SDR is a software defined Global Navigation
12  * Satellite Systems receiver
13  *
14  * This file is part of GNSS-SDR.
15  *
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
22 #define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
23 
24 #include "concurrent_queue.h"
25 #include "gnss_block_interface.h"
27 #include <gnuradio/blocks/deinterleave.h>
28 #include <gnuradio/blocks/file_sink.h>
29 #include <gnuradio/blocks/float_to_complex.h>
30 #include <pmt/pmt.h>
31 #include <memory>
32 #include <stdexcept>
33 #include <string>
34 #if GNURADIO_USES_STD_POINTERS
35 #else
36 #include <boost/shared_ptr.hpp>
37 #endif
38 
39 
41 
42 /*!
43  * \brief This class reads from rtl_tcp, which streams interleaved
44  * I/Q samples over TCP.
45  * (see https://osmocom.org/projects/rtl-sdr/wiki)
46  */
48 {
49 public:
50  RtlTcpSignalSource(const ConfigurationInterface* configuration,
51  const std::string& role,
52  unsigned int in_stream,
53  unsigned int out_stream,
55 
56  ~RtlTcpSignalSource() = default;
57 
58  inline std::string role() override
59  {
60  return role_;
61  }
62 
63  /*!
64  * \brief Returns "RtlTcp_Signal_Source"
65  */
66  inline std::string implementation() override
67  {
68  return "RtlTcp_Signal_Source";
69  }
70 
71  inline size_t item_size() override
72  {
73  return item_size_;
74  }
75 
76  void connect(gr::top_block_sptr top_block) override;
77  void disconnect(gr::top_block_sptr top_block) override;
78  gr::basic_block_sptr get_left_block() override;
79  gr::basic_block_sptr get_right_block() override;
80 
81 private:
82  void MakeBlock();
83 
84  rtl_tcp_signal_source_c_sptr signal_source_;
85 
86 #if GNURADIO_USES_STD_POINTERS
87  std::shared_ptr<gr::block> valve_;
88 #else
89  boost::shared_ptr<gr::block> valve_;
90 #endif
91  gr::blocks::file_sink::sptr file_sink_;
92 
93  std::string role_;
94  std::string item_type_;
95  std::string dump_filename_;
96 
97  // rtl_tcp settings
98  std::string address_;
99  size_t item_size_;
100  uint64_t samples_;
101  int sample_rate_;
102  int freq_;
103  int gain_;
104  int if_gain_;
105  double rf_gain_;
106  unsigned int in_stream_;
107  unsigned int out_stream_;
108  int16_t port_;
109  bool AGC_enabled_;
110  bool flip_iq_;
111  bool dump_;
112 };
113 
114 #endif // GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
Interface of an rtl_tcp signal source reader.
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
std::string implementation() override
Returns "RtlTcp_Signal_Source".
This class reads from rtl_tcp, which streams interleaved I/Q samples over TCP. (see https://osmocom...
This abstract class represents an interface to GNSS blocks.