GNSS-SDR  0.0.13
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  * 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_NSR_FILE_SIGNAL_SOURCE_H
25 #define GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H
26 
27 #include "concurrent_queue.h"
28 #include "gnss_block_interface.h"
30 #include <gnuradio/blocks/file_sink.h>
31 #include <gnuradio/blocks/file_source.h>
32 #include <gnuradio/blocks/throttle.h>
33 #include <gnuradio/hier_block2.h>
34 #include <pmt/pmt.h>
35 #include <memory>
36 #include <string>
37 #if GNURADIO_USES_STD_POINTERS
38 #else
39 #include <boost/shared_ptr.hpp>
40 #endif
41 
43 
44 /*!
45  * \brief Class that reads signals samples from a file
46  * and adapts it to a SignalSourceInterface
47  */
49 {
50 public:
51  NsrFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
52  unsigned int in_streams, unsigned int out_streams,
54 
55  ~NsrFileSignalSource() = default;
56  inline std::string role() override
57  {
58  return role_;
59  }
60 
61  /*!
62  * \brief Returns "Nsr_File_Signal_Source".
63  */
64  inline std::string implementation() override
65  {
66  return "Nsr_File_Signal_Source";
67  }
68 
69  inline size_t item_size() override
70  {
71  return item_size_;
72  }
73 
74  void connect(gr::top_block_sptr top_block) override;
75  void disconnect(gr::top_block_sptr top_block) override;
76  gr::basic_block_sptr get_left_block() override;
77  gr::basic_block_sptr get_right_block() override;
78 
79  inline std::string filename() const
80  {
81  return filename_;
82  }
83 
84  inline std::string item_type() const
85  {
86  return item_type_;
87  }
88 
89  inline bool repeat() const
90  {
91  return repeat_;
92  }
93 
94  inline int64_t sampling_frequency() const
95  {
96  return sampling_frequency_;
97  }
98 
99  inline uint64_t samples() const
100  {
101  return samples_;
102  }
103 
104 private:
105  gr::blocks::file_source::sptr file_source_;
106  unpack_byte_2bit_samples_sptr unpack_byte_;
107 #if GNURADIO_USES_STD_POINTERS
108  std::shared_ptr<gr::block> valve_;
109 #else
110  boost::shared_ptr<gr::block> valve_;
111 #endif
112  gr::blocks::file_sink::sptr sink_;
113  gr::blocks::throttle::sptr throttle_;
114  uint64_t samples_;
115  int64_t sampling_frequency_;
116  size_t item_size_;
117  std::string filename_;
118  std::string item_type_;
119  std::string dump_filename_;
120  std::string role_;
121  uint32_t in_streams_;
122  uint32_t out_streams_;
123  bool repeat_;
124  bool dump_;
125  // Throttle control
126  bool enable_throttle_control_;
127 };
128 
129 #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.