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
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-05-01 19:25:15 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2018-05-01 19:25:15 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-05-01 19:25:15 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
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-16 08:49:27 +00:00
|
|
|
#include "gr_complex_ip_packet_source.h"
|
2021-02-15 22:34:48 +00:00
|
|
|
#include "signal_source_base.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>
|
2018-05-01 19:25:15 +00:00
|
|
|
#include <stdexcept>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Signal_Source
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Signal_Source_adapters
|
|
|
|
* \{ */
|
|
|
|
|
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.
|
|
|
|
*/
|
2021-02-09 22:47:34 +00:00
|
|
|
class CustomUDPSignalSource : public SignalSourceBase
|
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 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-11-03 19:51:57 +00:00
|
|
|
std::vector<gnss_shared_ptr<gr::block>> null_sinks_;
|
|
|
|
std::vector<gnss_shared_ptr<gr::block>> file_sink_;
|
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_;
|
2020-06-26 20:07:41 +00:00
|
|
|
bool IQ_swap_;
|
2022-12-05 21:50:01 +00:00
|
|
|
bool dump_;
|
2018-05-01 19:25:15 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
|