GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
spir_file_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file spir_file_signal_source.h
3  * \brief Implementation of a class that reads signals samples from a SPIR file
4  * and adapts it to a SignalSourceInterface.
5  * \author Fran Fabra, 2014 fabra(at)ice.csic.es
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 not part of GNSS-SDR.
15  *
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_SPIR_FILE_SIGNAL_SOURCE_H
22 #define GNSS_SDR_SPIR_FILE_SIGNAL_SOURCE_H
23 
24 #include "concurrent_queue.h"
25 #include "gnss_block_interface.h"
27 #include <gnuradio/blocks/file_sink.h>
28 #include <gnuradio/blocks/file_source.h>
29 #include <gnuradio/blocks/throttle.h>
30 #include <gnuradio/hier_block2.h>
31 #include <pmt/pmt.h>
32 #include <cstdint>
33 #include <memory>
34 #include <string>
35 #if GNURADIO_USES_STD_POINTERS
36 #else
37 #include <boost/shared_ptr.hpp>
38 #endif
39 
41 
42 /*!
43  * \brief Class that reads signals samples from a file
44  * and adapts it to a SignalSourceInterface
45  */
47 {
48 public:
49  SpirFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
50  unsigned int in_streams, unsigned int out_streams,
52 
53  ~SpirFileSignalSource() = default;
54 
55  inline std::string role() override
56  {
57  return role_;
58  }
59 
60  /*!
61  * \brief Returns "Spir_File_Signal_Source".
62  */
63  inline std::string implementation() override
64  {
65  return "Spir_File_Signal_Source";
66  }
67 
68  inline size_t item_size() override
69  {
70  return item_size_;
71  }
72 
73  void connect(gr::top_block_sptr top_block) override;
74  void disconnect(gr::top_block_sptr top_block) override;
75  gr::basic_block_sptr get_left_block() override;
76  gr::basic_block_sptr get_right_block() override;
77 
78  inline std::string filename() const
79  {
80  return filename_;
81  }
82 
83  inline std::string item_type() const
84  {
85  return item_type_;
86  }
87 
88  inline bool repeat() const
89  {
90  return repeat_;
91  }
92 
93  inline int64_t sampling_frequency() const
94  {
95  return sampling_frequency_;
96  }
97 
98  inline uint64_t samples() const
99  {
100  return samples_;
101  }
102 
103 private:
104  gr::blocks::file_source::sptr file_source_;
105  unpack_intspir_1bit_samples_sptr unpack_intspir_;
106 #if GNURADIO_USES_STD_POINTERS
107  std::shared_ptr<gr::block> valve_;
108 #else
109  boost::shared_ptr<gr::block> valve_;
110 #endif
111  gr::blocks::file_sink::sptr sink_;
112  gr::blocks::throttle::sptr throttle_;
113  std::string filename_;
114  std::string item_type_;
115  std::string dump_filename_;
116  std::string role_;
117 
118  uint64_t samples_;
119  int64_t sampling_frequency_;
120  size_t item_size_;
121 
122  unsigned int in_streams_;
123  unsigned int out_streams_;
124 
125  bool repeat_;
126  bool dump_;
127 
128  // Throttle control
129  bool enable_throttle_control_;
130 };
131 
132 #endif // GNSS_SDR_SPIR_FILE_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
std::string implementation() override
Returns "Spir_File_Signal_Source".
Unpacks SPIR int samples to NSR 1 bit samples.
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
Class that reads signals samples from a file and adapts it to a SignalSourceInterface.
This abstract class represents an interface to GNSS blocks.