GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
nsr_file_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file nsr_file_signal_source.h
3  * \brief Implementation of a class that reads signals samples from a NSR 2 bits sampler front-end file
4  * and adapts it to a SignalSourceInterface. More information about the front-end here
5  * http://www.ifen.com/products/sx-scientific-gnss-solutions/nsr-software-receiver.html
6  * \author Javier Arribas, 2013 jarribas(at)cttc.es
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_NSR_FILE_SIGNAL_SOURCE_H
22 #define GNSS_SDR_NSR_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 <string>
33 
34 /** \addtogroup Signal_Source
35  * \{ */
36 /** \addtogroup Signal_Source_adapters
37  * \{ */
38 
40 
41 /*!
42  * \brief Class that reads signals samples from a file
43  * and adapts it to a SignalSourceInterface
44  */
46 {
47 public:
48  NsrFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
49  unsigned int in_streams, unsigned int out_streams,
51 
52  ~NsrFileSignalSource() = default;
53  inline std::string role() override
54  {
55  return role_;
56  }
57 
58  /*!
59  * \brief Returns "Nsr_File_Signal_Source".
60  */
61  inline std::string implementation() override
62  {
63  return "Nsr_File_Signal_Source";
64  }
65 
66  inline size_t item_size() override
67  {
68  return item_size_;
69  }
70 
71  void connect(gr::top_block_sptr top_block) override;
72  void disconnect(gr::top_block_sptr top_block) override;
73  gr::basic_block_sptr get_left_block() override;
74  gr::basic_block_sptr get_right_block() override;
75 
76  inline std::string filename() const
77  {
78  return filename_;
79  }
80 
81  inline std::string item_type() const
82  {
83  return item_type_;
84  }
85 
86  inline bool repeat() const
87  {
88  return repeat_;
89  }
90 
91  inline int64_t sampling_frequency() const
92  {
93  return sampling_frequency_;
94  }
95 
96  inline uint64_t samples() const
97  {
98  return samples_;
99  }
100 
101 private:
102  gr::blocks::file_source::sptr file_source_;
103  unpack_byte_2bit_samples_sptr unpack_byte_;
104  gnss_shared_ptr<gr::block> valve_;
105  gr::blocks::file_sink::sptr sink_;
106  gr::blocks::throttle::sptr throttle_;
107  uint64_t samples_;
108  int64_t sampling_frequency_;
109  size_t item_size_;
110  std::string filename_;
111  std::string item_type_;
112  std::string dump_filename_;
113  std::string role_;
114  uint32_t in_streams_;
115  uint32_t out_streams_;
116  bool repeat_;
117  bool dump_;
118  // Throttle control
119  bool enable_throttle_control_;
120 };
121 
122 
123 /** \} */
124 /** \} */
125 #endif // GNSS_SDR_NSR_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 "Nsr_File_Signal_Source".
Class that reads signals samples from a file and adapts it to a SignalSourceInterface.
Unpacks byte samples to NSR 2 bits samples.
This abstract class represents an interface to GNSS blocks.