2018-05-01 19:25:15 +00:00
|
|
|
/*!
|
2019-03-06 20:54:39 +00:00
|
|
|
* \file custom_udp_signal_source.h
|
2018-05-16 08:49:27 +00:00
|
|
|
* \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
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +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.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-05-01 19:25:15 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2018-05-16 08:49:27 +00:00
|
|
|
|
2020-02-08 09:10:46 +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
|
|
|
|
2019-07-16 15:41:12 +00:00
|
|
|
#include "concurrent_queue.h"
|
2018-05-01 19:25:15 +00:00
|
|
|
#include "gnss_block_interface.h"
|
2018-05-16 08:49:27 +00:00
|
|
|
#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>
|
2019-07-16 15:41:12 +00:00
|
|
|
#include <pmt/pmt.h>
|
2019-08-17 11:56:54 +00:00
|
|
|
#include <memory>
|
2018-05-01 19:25:15 +00:00
|
|
|
#include <stdexcept>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2020-04-02 21:59:35 +00:00
|
|
|
#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.
|
|
|
|
*/
|
2018-05-16 09:36:37 +00:00
|
|
|
class CustomUDPSignalSource : public GNSSBlockInterface
|
2018-05-01 19:25:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-06-29 07:07:41 +00:00
|
|
|
CustomUDPSignalSource(const ConfigurationInterface* configuration,
|
2018-12-10 21:59:10 +00:00
|
|
|
const std::string& role, unsigned int in_stream,
|
2020-06-18 09:49:28 +00:00
|
|
|
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
|
2018-05-01 19:25:15 +00:00
|
|
|
|
2019-07-21 17:32:52 +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
|
|
|
|
{
|
2018-05-16 09:36:37 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
|