GNSS-SDR  0.0.14
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  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
13  * This file is part of GNSS-SDR.
14  *
15  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
22 #define GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
23 
24 #include "concurrent_queue.h"
25 #include "gnss_block_interface.h"
26 #include "unpack_2bit_samples.h"
27 #include <gnuradio/blocks/file_sink.h>
28 #include <gnuradio/blocks/file_source.h>
29 #include <gnuradio/blocks/interleaved_char_to_complex.h>
30 #include <gnuradio/blocks/throttle.h>
31 #include <gnuradio/hier_block2.h>
32 #include <pmt/pmt.h>
33 #include <cstdint>
34 #include <string>
35 
36 
37 /** \addtogroup Signal_Source
38  * \{ */
39 /** \addtogroup Signal_Source_adapters
40  * \{ */
41 
42 
44 
45 /*!
46  * \brief Class that reads signals samples from a file
47  * and adapts it to a SignalSourceInterface
48  */
50 {
51 public:
52  TwoBitPackedFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
53  unsigned int in_streams, unsigned int out_streams,
55 
56  ~TwoBitPackedFileSignalSource() = default;
57  inline std::string role() override
58  {
59  return role_;
60  }
61 
62  /*!
63  * \brief Returns "Two_Bit_Packed_File_Signal_Source".
64  */
65  inline std::string implementation() override
66  {
67  return "Two_Bit_Packed_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  inline bool big_endian_items() const
106  {
107  return big_endian_items_;
108  }
109 
110  inline bool big_endian_bytes() const
111  {
112  return big_endian_bytes_;
113  }
114 
115  inline bool is_complex() const
116  {
117  return is_complex_;
118  }
119 
120  inline bool reverse_interleaving() const
121  {
122  return reverse_interleaving_;
123  }
124 
125 private:
126  gr::blocks::file_source::sptr file_source_;
127  unpack_2bit_samples_sptr unpack_samples_;
128  gr::basic_block_sptr char_to_float_;
129  gnss_shared_ptr<gr::block> valve_;
130  gr::blocks::file_sink::sptr sink_;
131  gr::blocks::throttle::sptr throttle_;
132  std::string filename_;
133  std::string item_type_;
134  std::string dump_filename_;
135  std::string role_;
136  std::string sample_type_;
137  uint64_t samples_;
138  int64_t sampling_frequency_;
139  size_t item_size_;
140  unsigned int in_streams_;
141  unsigned int out_streams_;
142  bool big_endian_items_;
143  bool big_endian_bytes_;
144  bool is_complex_;
145  bool reverse_interleaving_;
146  bool repeat_;
147  bool dump_;
148  // Throttle control
149  bool enable_throttle_control_;
150 };
151 
152 
153 /** \} */
154 /** \} */
155 #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...