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

85 lines
2.3 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
2020-07-28 14:57:15 +00:00
* -----------------------------------------------------------------------------
2018-05-01 19:25:15 +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.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* 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
*/
#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"
#include "gr_complex_ip_packet_source.h"
#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>
#include <pmt/pmt.h>
2018-05-01 19:25:15 +00:00
#include <stdexcept>
#include <string>
#include <vector>
/** \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.
*/
class CustomUDPSignalSource : public SignalSourceBase
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 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_;
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
};
/** \} */
/** \} */
#endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H