GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
multichannel_file_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file multichannel_file_signal_source.h
3  * \brief Implementation of a class that reads signals samples from files at
4  * different frequency band and adapts it to a SignalSourceInterface
5  * \author Javier Arribas, 2019 jarribas(at)cttc.es
6  *
7  * This class represents a file signal source. Internally it uses a GNU Radio's
8  * gr_file_source as a connector to the data.
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_MULTICHANNEL_FILE_SIGNAL_SOURCE_H
25 #define GNSS_SDR_MULTICHANNEL_FILE_SIGNAL_SOURCE_H
26 
27 #include "concurrent_queue.h"
28 #include "gnss_block_interface.h"
29 #include <gnuradio/blocks/file_sink.h>
30 #include <gnuradio/blocks/file_source.h>
31 #include <gnuradio/blocks/throttle.h>
32 #include <gnuradio/hier_block2.h>
33 #include <pmt/pmt.h>
34 #include <cstdint>
35 #include <memory>
36 #include <string>
37 #include <vector>
38 #if GNURADIO_USES_STD_POINTERS
39 #else
40 #include <boost/shared_ptr.hpp>
41 #endif
42 
44 
45 /*!
46  * \brief Class that reads signals samples from files at different frequency bands
47  * and adapts it to a SignalSourceInterface
48  */
50 {
51 public:
52  MultichannelFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
53  unsigned int in_streams, unsigned int out_streams,
55 
56  ~MultichannelFileSignalSource() = default;
57 
58  inline std::string role() override
59  {
60  return role_;
61  }
62 
63  /*!
64  * \brief Returns "Multichannel_File_Signal_Source".
65  */
66  inline std::string implementation() override
67  {
68  return "Multichannel_File_Signal_Source";
69  }
70 
71  inline size_t item_size() override
72  {
73  return item_size_;
74  }
75 
76  void connect(gr::top_block_sptr top_block) override;
77  void disconnect(gr::top_block_sptr top_block) override;
78  gr::basic_block_sptr get_left_block() override;
79  gr::basic_block_sptr get_right_block() override;
80 
81  inline std::string filename() const
82  {
83  return filename_vec_.at(0);
84  }
85 
86  inline std::string item_type() const
87  {
88  return item_type_;
89  }
90 
91  inline bool repeat() const
92  {
93  return repeat_;
94  }
95 
96  inline int64_t sampling_frequency() const
97  {
98  return sampling_frequency_;
99  }
100 
101  inline uint64_t samples() const
102  {
103  return samples_;
104  }
105 
106 private:
107  std::vector<gr::blocks::file_source::sptr> file_source_vec_;
108 #if GNURADIO_USES_STD_POINTERS
109  std::shared_ptr<gr::block> valve_;
110 #else
111  boost::shared_ptr<gr::block> valve_;
112 #endif
113  gr::blocks::file_sink::sptr sink_;
114  std::vector<gr::blocks::throttle::sptr> throttle_vec_;
115  std::vector<std::string> filename_vec_;
116  std::string item_type_;
117  std::string role_;
118  uint64_t samples_;
119  int64_t sampling_frequency_;
120  size_t item_size_;
121  int32_t n_channels_;
122  uint32_t in_streams_;
123  uint32_t out_streams_;
124  bool repeat_;
125  // Throttle control
126  bool enable_throttle_control_;
127 };
128 
129 #endif // GNSS_SDR_MULTICHANNEL_FILE_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
std::string implementation() override
Returns "Multichannel_File_Signal_Source".
This abstract class represents an interface to GNSS blocks.
Class that reads signals samples from files at different frequency bands and adapts it to a SignalSou...