GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
two_bit_cpx_file_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file two_bit_cpx_file_signal_source.h
3  * \brief Interface of a class that reads signals samples from a 2 bit complex sampler front-end file
4  * and adapts it to a SignalSourceInterface.
5  * \author Javier Arribas, 2015 jarribas(at)cttc.es
6  *
7  * This class represents a file signal source.
8  *
9  * -----------------------------------------------------------------------------
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  *
13  * GNSS-SDR is a software defined Global Navigation
14  * Satellite Systems receiver
15  *
16  * This file is part of GNSS-SDR.
17  *
18  * SPDX-License-Identifier: GPL-3.0-or-later
19  *
20  * -----------------------------------------------------------------------------
21  */
22 
23 #ifndef GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
24 #define GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
25 
26 #include "concurrent_queue.h"
27 #include "gnss_block_interface.h"
29 #include <gnuradio/blocks/file_sink.h>
30 #include <gnuradio/blocks/file_source.h>
31 #include <gnuradio/blocks/interleaved_short_to_complex.h>
32 #include <gnuradio/blocks/throttle.h>
33 #include <gnuradio/hier_block2.h>
34 #include <pmt/pmt.h>
35 #include <cstdint>
36 #include <memory>
37 #include <string>
38 #if GNURADIO_USES_STD_POINTERS
39 #else
40 #include <boost/shared_ptr.hpp>
41 #endif
42 
43 
45 
46 /*!
47  * \brief Class that reads signals samples from a file
48  * and adapts it to a SignalSourceInterface
49  */
51 {
52 public:
54  const std::string& role,
55  unsigned int in_streams,
56  unsigned int out_streams,
58 
59  ~TwoBitCpxFileSignalSource() = default;
60  inline std::string role() override
61  {
62  return role_;
63  }
64 
65  /*!
66  * \brief Returns "Two_Bit_Cpx_File_Signal_Source".
67  */
68  inline std::string implementation() override
69  {
70  return "Two_Bit_Cpx_File_Signal_Source";
71  }
72 
73  inline size_t item_size() override
74  {
75  return item_size_;
76  }
77 
78  void connect(gr::top_block_sptr top_block) override;
79  void disconnect(gr::top_block_sptr top_block) override;
80  gr::basic_block_sptr get_left_block() override;
81  gr::basic_block_sptr get_right_block() override;
82 
83  inline std::string filename() const
84  {
85  return filename_;
86  }
87 
88  inline std::string item_type() const
89  {
90  return item_type_;
91  }
92 
93  inline bool repeat() const
94  {
95  return repeat_;
96  }
97 
98  inline int64_t sampling_frequency() const
99  {
100  return sampling_frequency_;
101  }
102 
103  inline uint64_t samples() const
104  {
105  return samples_;
106  }
107 
108 private:
109  gr::blocks::file_source::sptr file_source_;
110  gr::blocks::interleaved_short_to_complex::sptr inter_shorts_to_cpx_;
111  unpack_byte_2bit_cpx_samples_sptr unpack_byte_;
112 #if GNURADIO_USES_STD_POINTERS
113  std::shared_ptr<gr::block> valve_;
114 #else
115  boost::shared_ptr<gr::block> valve_;
116 #endif
117  gr::blocks::file_sink::sptr sink_;
118  gr::blocks::throttle::sptr throttle_;
119  std::string filename_;
120  std::string item_type_;
121  std::string dump_filename_;
122  std::string role_;
123  size_t item_size_;
124  uint64_t samples_;
125  int64_t sampling_frequency_;
126  unsigned int in_streams_;
127  unsigned int out_streams_;
128  bool repeat_;
129  bool dump_;
130  // Throttle control
131  bool enable_throttle_control_;
132 };
133 
134 #endif // GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
Unpacks byte samples to 2 bits complex samples. Packing Order Most Significant Nibble - Sample n Leas...
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
This abstract class represents an interface to GNSS blocks.
Class that reads signals samples from a file and adapts it to a SignalSourceInterface.
std::string implementation() override
Returns "Two_Bit_Cpx_File_Signal_Source".