gnss-sdr/src/algorithms/signal_source/adapters/custom_udp_signal_source.h

105 lines
2.7 KiB
C
Raw Normal View History

2018-05-01 19:25:15 +00:00
/*!
2019-03-06 20:54:39 +00:00
* \file custom_udp_signal_source.h
* \brief Receives ip frames containing samples in UDP frame encapsulation
* using a high performance packet capture library (libpcap)
* \author Javier Arribas jarribas (at) cttc.es
2018-05-01 19:25:15 +00:00
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
2018-05-01 19:25:15 +00:00
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* SPDX-License-Identifier: GPL-3.0-or-later
2018-05-01 19:25:15 +00:00
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
#define GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
2018-05-01 19:25:15 +00:00
#include "concurrent_queue.h"
2018-05-01 19:25:15 +00:00
#include "gnss_block_interface.h"
#include "gr_complex_ip_packet_source.h"
2018-05-01 19:25:15 +00:00
#include <gnuradio/blocks/file_sink.h>
2018-05-02 17:48:15 +00:00
#include <gnuradio/blocks/null_sink.h>
#include <pmt/pmt.h>
#include <memory>
2018-05-01 19:25:15 +00:00
#include <stdexcept>
#include <string>
#include <vector>
#if GNURADIO_USES_STD_POINTERS
#else
#include <boost/shared_ptr.hpp>
#endif
2018-05-01 19:25:15 +00:00
class ConfigurationInterface;
/*!
* \brief This class reads from UDP packets, which streams interleaved
* I/Q samples over a network.
*/
class CustomUDPSignalSource : public GNSSBlockInterface
2018-05-01 19:25:15 +00:00
{
public:
CustomUDPSignalSource(const ConfigurationInterface* configuration,
2018-12-10 21:59:10 +00:00
const std::string& role, unsigned int in_stream,
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
2018-05-01 19:25:15 +00:00
~CustomUDPSignalSource() = default;
2018-05-01 19:25:15 +00:00
inline std::string role() override
{
return role_;
}
/*!
2019-03-08 22:20:08 +00:00
* \brief Returns "Custom_UDP_Signal_Source"
2018-05-01 19:25:15 +00:00
*/
inline std::string implementation() override
{
return "Custom_UDP_Signal_Source";
2018-05-01 19:25:15 +00:00
}
inline size_t item_size() override
{
return item_size_;
}
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block() override;
gr::basic_block_sptr get_right_block(int RF_channel) override;
private:
2020-06-26 20:07:41 +00:00
Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
2020-06-27 08:56:51 +00:00
#if GNURADIO_USES_STD_POINTERS
std::vector<std::shared_ptr<gr::block>> null_sinks_;
std::vector<std::shared_ptr<gr::block>> file_sink_;
#else
std::vector<boost::shared_ptr<gr::block>> null_sinks_;
std::vector<boost::shared_ptr<gr::block>> file_sink_;
#endif
2020-06-26 20:07:41 +00:00
2018-05-01 19:25:15 +00:00
std::string role_;
2020-06-26 20:07:41 +00:00
std::string item_type_;
std::string dump_filename_;
size_t item_size_;
2018-05-01 19:25:15 +00:00
int RF_channels_;
2018-05-02 17:48:15 +00:00
int channels_in_udp_;
2018-05-01 19:25:15 +00:00
unsigned int in_stream_;
unsigned int out_stream_;
bool dump_;
2020-06-26 20:07:41 +00:00
bool IQ_swap_;
2018-05-01 19:25:15 +00:00
};
#endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H