GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
two_bit_packed_file_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file two_bit_packed_file_signal_source.h
3  * \brief Interface of a class that reads signals samples from a file. Each
4  * sample is two bits, which are packed into bytes or shorts.
5  *
6  * \author Cillian O'Driscoll, 2015 cillian.odriscoll (at) gmail.com
7  *
8  * This class represents a file signal source.
9  *
10  * -----------------------------------------------------------------------------
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  *
14  * GNSS-SDR is a software defined Global Navigation
15  * Satellite Systems receiver
16  *
17  * This file is part of GNSS-SDR.
18  *
19  * SPDX-License-Identifier: GPL-3.0-or-later
20  *
21  * -----------------------------------------------------------------------------
22  */
23 
24 #ifndef GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
25 #define GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
26 
27 #include "concurrent_queue.h"
28 #include "gnss_block_interface.h"
29 #include "unpack_2bit_samples.h"
30 #include <gnuradio/blocks/file_sink.h>
31 #include <gnuradio/blocks/file_source.h>
32 #include <gnuradio/blocks/interleaved_char_to_complex.h>
33 #include <gnuradio/blocks/throttle.h>
34 #include <gnuradio/hier_block2.h>
35 #include <pmt/pmt.h>
36 #include <cstdint>
37 #include <memory>
38 #include <string>
39 #if GNURADIO_USES_STD_POINTERS
40 #else
41 #include <boost/shared_ptr.hpp>
42 #endif
43 
44 
46 
47 /*!
48  * \brief Class that reads signals samples from a file
49  * and adapts it to a SignalSourceInterface
50  */
52 {
53 public:
54  TwoBitPackedFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
55  unsigned int in_streams, unsigned int out_streams,
57 
58  ~TwoBitPackedFileSignalSource() = default;
59  inline std::string role() override
60  {
61  return role_;
62  }
63 
64  /*!
65  * \brief Returns "Two_Bit_Packed_File_Signal_Source".
66  */
67  inline std::string implementation() override
68  {
69  return "Two_Bit_Packed_File_Signal_Source";
70  }
71 
72  inline size_t item_size() override
73  {
74  return item_size_;
75  }
76 
77  void connect(gr::top_block_sptr top_block) override;
78  void disconnect(gr::top_block_sptr top_block) override;
79  gr::basic_block_sptr get_left_block() override;
80  gr::basic_block_sptr get_right_block() override;
81 
82  inline std::string filename() const
83  {
84  return filename_;
85  }
86 
87  inline std::string item_type() const
88  {
89  return item_type_;
90  }
91 
92  inline bool repeat() const
93  {
94  return repeat_;
95  }
96 
97  inline int64_t sampling_frequency() const
98  {
99  return sampling_frequency_;
100  }
101 
102  inline uint64_t samples() const
103  {
104  return samples_;
105  }
106 
107  inline bool big_endian_items() const
108  {
109  return big_endian_items_;
110  }
111 
112  inline bool big_endian_bytes() const
113  {
114  return big_endian_bytes_;
115  }
116 
117  inline bool is_complex() const
118  {
119  return is_complex_;
120  }
121 
122  inline bool reverse_interleaving() const
123  {
124  return reverse_interleaving_;
125  }
126 
127 private:
128  gr::blocks::file_source::sptr file_source_;
129  unpack_2bit_samples_sptr unpack_samples_;
130  gr::basic_block_sptr char_to_float_;
131 #if GNURADIO_USES_STD_POINTERS
132  std::shared_ptr<gr::block> valve_;
133 #else
134  boost::shared_ptr<gr::block> valve_;
135 #endif
136  gr::blocks::file_sink::sptr sink_;
137  gr::blocks::throttle::sptr throttle_;
138  std::string filename_;
139  std::string item_type_;
140  std::string dump_filename_;
141  std::string role_;
142  std::string sample_type_;
143  uint64_t samples_;
144  int64_t sampling_frequency_;
145  size_t item_size_;
146  unsigned int in_streams_;
147  unsigned int out_streams_;
148  bool big_endian_items_;
149  bool big_endian_bytes_;
150  bool is_complex_;
151  bool reverse_interleaving_;
152  bool repeat_;
153  bool dump_;
154  // Throttle control
155  bool enable_throttle_control_;
156 };
157 
158 #endif // GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
Class that reads signals samples from a file and adapts it to a SignalSourceInterface.
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
std::string implementation() override
Returns "Two_Bit_Packed_File_Signal_Source".
This abstract class represents an interface to GNSS blocks.
Unpacks 2 bit samples samples may be packed in any of the following ways: 1) Into bytes [ item == byt...