GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
custom_udp_signal_source.h
Go to the documentation of this file.
1 /*!
2  * \file custom_udp_signal_source.h
3  * \brief Receives ip frames containing samples in UDP frame encapsulation
4  * using a high performance packet capture library (libpcap)
5  * \author Javier Arribas jarribas (at) cttc.es
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 
18 #ifndef GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
19 #define GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
20 
21 #include "concurrent_queue.h"
22 #include "gnss_block_interface.h"
24 #include <gnuradio/blocks/file_sink.h>
25 #include <gnuradio/blocks/null_sink.h>
26 #include <pmt/pmt.h>
27 #include <stdexcept>
28 #include <string>
29 #include <vector>
30 
31 /** \addtogroup Signal_Source
32  * \{ */
33 /** \addtogroup Signal_Source_adapters
34  * \{ */
35 
36 
38 
39 /*!
40  * \brief This class reads from UDP packets, which streams interleaved
41  * I/Q samples over a network.
42  */
44 {
45 public:
46  CustomUDPSignalSource(const ConfigurationInterface* configuration,
47  const std::string& role, unsigned int in_stream,
48  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
49 
50  ~CustomUDPSignalSource() = default;
51 
52  inline std::string role() override
53  {
54  return role_;
55  }
56 
57  /*!
58  * \brief Returns "Custom_UDP_Signal_Source"
59  */
60  inline std::string implementation() override
61  {
62  return "Custom_UDP_Signal_Source";
63  }
64 
65  inline size_t item_size() override
66  {
67  return item_size_;
68  }
69 
70  void connect(gr::top_block_sptr top_block) override;
71  void disconnect(gr::top_block_sptr top_block) override;
72  gr::basic_block_sptr get_left_block() override;
73  gr::basic_block_sptr get_right_block() override;
74  gr::basic_block_sptr get_right_block(int RF_channel) override;
75 
76 private:
77  Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
78  std::vector<gnss_shared_ptr<gr::block>> null_sinks_;
79  std::vector<gnss_shared_ptr<gr::block>> file_sink_;
80 
81  std::string role_;
82  std::string item_type_;
83  std::string dump_filename_;
84 
85  size_t item_size_;
86 
87  int RF_channels_;
88  int channels_in_udp_;
89  unsigned int in_stream_;
90  unsigned int out_stream_;
91 
92  bool dump_;
93  bool IQ_swap_;
94 };
95 
96 
97 /** \} */
98 /** \} */
99 #endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
Interface of a thread-safe std::queue.
std::string implementation() override
Returns "Custom_UDP_Signal_Source".
This class reads from UDP packets, which streams interleaved I/Q samples over a network.
Receives ip frames containing samples in UDP frame encapsulation using a high performance packet capt...
This interface represents a GNSS block.
This abstract class represents an interface to configuration parameters.
This abstract class represents an interface to GNSS blocks.