GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
9  *
10  * GNSS-SDR is a software defined Global Navigation
11  * Satellite Systems receiver
12  *
13  * This file is part of GNSS-SDR.
14  *
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 
21 #ifndef GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
22 #define GNSS_SDR_CUSTOM_UDP_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/null_sink.h>
29 #include <pmt/pmt.h>
30 #include <memory>
31 #include <stdexcept>
32 #include <string>
33 #include <vector>
34 #if GNURADIO_USES_STD_POINTERS
35 #else
36 #include <boost/shared_ptr.hpp>
37 #endif
38 
39 
41 
42 /*!
43  * \brief This class reads from UDP packets, which streams interleaved
44  * I/Q samples over a network.
45  */
47 {
48 public:
49  CustomUDPSignalSource(const ConfigurationInterface* configuration,
50  const std::string& role, unsigned int in_stream,
51  unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
52 
53  ~CustomUDPSignalSource() = default;
54 
55  inline std::string role() override
56  {
57  return role_;
58  }
59 
60  /*!
61  * \brief Returns "Custom_UDP_Signal_Source"
62  */
63  inline std::string implementation() override
64  {
65  return "Custom_UDP_Signal_Source";
66  }
67 
68  inline size_t item_size() override
69  {
70  return item_size_;
71  }
72 
73  void connect(gr::top_block_sptr top_block) override;
74  void disconnect(gr::top_block_sptr top_block) override;
75  gr::basic_block_sptr get_left_block() override;
76  gr::basic_block_sptr get_right_block() override;
77  gr::basic_block_sptr get_right_block(int RF_channel) override;
78 
79 private:
80  Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
81 #if GNURADIO_USES_STD_POINTERS
82  std::vector<std::shared_ptr<gr::block>> null_sinks_;
83  std::vector<std::shared_ptr<gr::block>> file_sink_;
84 #else
85  std::vector<boost::shared_ptr<gr::block>> null_sinks_;
86  std::vector<boost::shared_ptr<gr::block>> file_sink_;
87 #endif
88 
89  std::string role_;
90  std::string item_type_;
91  std::string dump_filename_;
92 
93  size_t item_size_;
94 
95  int RF_channels_;
96  int channels_in_udp_;
97  unsigned int in_stream_;
98  unsigned int out_stream_;
99 
100  bool dump_;
101  bool IQ_swap_;
102 };
103 
104 #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.