GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
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"
23#include "signal_source_base.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 */
43class CustomUDPSignalSource : public SignalSourceBase
44{
45public:
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 size_t item_size() override
53 {
54 return item_size_;
55 }
56
57 void connect(gr::top_block_sptr top_block) override;
58 void disconnect(gr::top_block_sptr top_block) override;
59 gr::basic_block_sptr get_left_block() override;
60 gr::basic_block_sptr get_right_block() override;
61 gr::basic_block_sptr get_right_block(int RF_channel) override;
62
63private:
64 Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
65 std::vector<gnss_shared_ptr<gr::block>> null_sinks_;
66 std::vector<gnss_shared_ptr<gr::block>> file_sink_;
67
68 std::string item_type_;
69 std::string dump_filename_;
70
71 size_t item_size_;
72
73 int RF_channels_;
74 int channels_in_udp_;
75 unsigned int in_stream_;
76 unsigned int out_stream_;
77 bool IQ_swap_;
78 bool dump_;
79};
80
81
82/** \} */
83/** \} */
84#endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
This class implements a thread-safe std::queue.
This abstract class represents an interface to configuration parameters.
SignalSourceBase(ConfigurationInterface const *configuration, std::string role, std::string impl)
Constructor.
Interface of a thread-safe std::queue.
Receives ip frames containing samples in UDP frame encapsulation using a high performance packet capt...
Header file of the base class to signal_source GNSS blocks.