GNSS-SDR  0.0.14
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  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12  * This file is part of GNSS-SDR.
13  *
14  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
21 #define GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
22 
23 #include "concurrent_queue.h"
24 #include "gnss_block_interface.h"
26 #include <gnuradio/blocks/file_sink.h>
27 #include <gnuradio/blocks/file_source.h>
28 #include <gnuradio/blocks/interleaved_short_to_complex.h>
29 #include <gnuradio/blocks/throttle.h>
30 #include <gnuradio/hier_block2.h>
31 #include <pmt/pmt.h>
32 #include <cstdint>
33 #include <string>
34 
35 /** \addtogroup Signal_Source
36  * \{ */
37 /** \addtogroup Signal_Source_adapters
38  * \{ */
39 
40 
42 
43 /*!
44  * \brief Class that reads signals samples from a file
45  * and adapts it to a SignalSourceInterface
46  */
48 {
49 public:
51  const std::string& role,
52  unsigned int in_streams,
53  unsigned int out_streams,
55 
56  ~TwoBitCpxFileSignalSource() = default;
57  inline std::string role() override
58  {
59  return role_;
60  }
61 
62  /*!
63  * \brief Returns "Two_Bit_Cpx_File_Signal_Source".
64  */
65  inline std::string implementation() override
66  {
67  return "Two_Bit_Cpx_File_Signal_Source";
68  }
69 
70  inline size_t item_size() override
71  {
72  return item_size_;
73  }
74 
75  void connect(gr::top_block_sptr top_block) override;
76  void disconnect(gr::top_block_sptr top_block) override;
77  gr::basic_block_sptr get_left_block() override;
78  gr::basic_block_sptr get_right_block() override;
79 
80  inline std::string filename() const
81  {
82  return filename_;
83  }
84 
85  inline std::string item_type() const
86  {
87  return item_type_;
88  }
89 
90  inline bool repeat() const
91  {
92  return repeat_;
93  }
94 
95  inline int64_t sampling_frequency() const
96  {
97  return sampling_frequency_;
98  }
99 
100  inline uint64_t samples() const
101  {
102  return samples_;
103  }
104 
105 private:
106  gr::blocks::file_source::sptr file_source_;
107  gr::blocks::interleaved_short_to_complex::sptr inter_shorts_to_cpx_;
108  unpack_byte_2bit_cpx_samples_sptr unpack_byte_;
109  gnss_shared_ptr<gr::block> valve_;
110  gr::blocks::file_sink::sptr sink_;
111  gr::blocks::throttle::sptr throttle_;
112  std::string filename_;
113  std::string item_type_;
114  std::string dump_filename_;
115  std::string role_;
116  size_t item_size_;
117  uint64_t samples_;
118  int64_t sampling_frequency_;
119  unsigned int in_streams_;
120  unsigned int out_streams_;
121  bool repeat_;
122  bool dump_;
123  // Throttle control
124  bool enable_throttle_control_;
125 };
126 
127 
128 /** \} */
129 /** \} */
130 #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".