GNSS-SDR  0.0.14
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  * 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_MULTICHANNEL_FILE_SIGNAL_SOURCE_H
22 #define GNSS_SDR_MULTICHANNEL_FILE_SIGNAL_SOURCE_H
23 
24 #include "concurrent_queue.h"
25 #include "gnss_block_interface.h"
26 #include <gnuradio/blocks/file_sink.h>
27 #include <gnuradio/blocks/file_source.h>
28 #include <gnuradio/blocks/throttle.h>
29 #include <gnuradio/hier_block2.h>
30 #include <pmt/pmt.h>
31 #include <cstdint>
32 #include <string>
33 #include <vector>
34 
35 
36 /** \addtogroup Signal_Source
37  * \{ */
38 /** \addtogroup Signal_Source_adapters
39  * \{ */
40 
41 
43 
44 /*!
45  * \brief Class that reads signals samples from files at different frequency bands
46  * and adapts it to a SignalSourceInterface
47  */
49 {
50 public:
51  MultichannelFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
52  unsigned int in_streams, unsigned int out_streams,
54 
55  ~MultichannelFileSignalSource() = default;
56 
57  inline std::string role() override
58  {
59  return role_;
60  }
61 
62  /*!
63  * \brief Returns "Multichannel_File_Signal_Source".
64  */
65  inline std::string implementation() override
66  {
67  return "Multichannel_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_vec_.at(0);
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  std::vector<gr::blocks::file_source::sptr> file_source_vec_;
107  gnss_shared_ptr<gr::block> valve_;
108  gr::blocks::file_sink::sptr sink_;
109  std::vector<gr::blocks::throttle::sptr> throttle_vec_;
110  std::vector<std::string> filename_vec_;
111  std::string item_type_;
112  std::string role_;
113  uint64_t samples_;
114  int64_t sampling_frequency_;
115  size_t item_size_;
116  int32_t n_channels_;
117  uint32_t in_streams_;
118  uint32_t out_streams_;
119  bool repeat_;
120  // Throttle control
121  bool enable_throttle_control_;
122 };
123 
124 
125 /** \} */
126 /** \} */
127 #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...