mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-01 07:43:04 +00:00
Adding optional compilation of the custom UDP packet source. Disabled by default
This commit is contained in:
@@ -21,6 +21,38 @@ list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS)
|
||||
|
||||
# Optional drivers
|
||||
|
||||
if(ENABLE_RAW_UDP)
|
||||
# - Try to find libpcap include dirs and libraries
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(PCAP)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# PCAP_ROOT_DIR Set this variable to the root installation of
|
||||
# libpcap if the module has problems finding the
|
||||
# proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# PCAP_FOUND System has libpcap, include and library dirs found
|
||||
# PCAP_INCLUDE_DIR The libpcap include directories.
|
||||
# PCAP_LIBRARY The libpcap library (possibly includes a thread
|
||||
# library e.g. required by pf_ring's libpcap)
|
||||
# HAVE_PF_RING If a found version of libpcap supports PF_RING
|
||||
find_package(PCAP)
|
||||
if(NOT PCAP_FOUND)
|
||||
message(FATAL_ERROR "PCAP required to compile custom UDP packet sample source (ENABLE_RAW_UDP)")
|
||||
endif()
|
||||
get_filename_component(PCAP_LIBRARY_DIRS ${PCAP_LIBRARY} DIRECTORY CACHE)
|
||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${PCAP_LIBRARIES})
|
||||
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${PCAP_INCLUDE_DIRS})
|
||||
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} custom_udp_signal_source.cc)
|
||||
|
||||
endif(ENABLE_RAW_UDP)
|
||||
|
||||
if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
|
||||
find_package(iio REQUIRED)
|
||||
if(NOT IIO_FOUND)
|
||||
@@ -166,7 +198,6 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc
|
||||
spir_gss6450_file_signal_source.cc
|
||||
rtl_tcp_signal_source.cc
|
||||
labsat_signal_source.cc
|
||||
udp_signal_source.cc
|
||||
${OPT_DRIVER_SOURCES}
|
||||
)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "udp_signal_source.h"
|
||||
#include "custom_udp_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include <boost/format.hpp>
|
||||
@@ -41,7 +41,7 @@
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
UDPSignalSource::UDPSignalSource(ConfigurationInterface* configuration,
|
||||
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
{
|
||||
@@ -107,12 +107,12 @@ UDPSignalSource::UDPSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
|
||||
|
||||
UDPSignalSource::~UDPSignalSource()
|
||||
CustomUDPSignalSource::~CustomUDPSignalSource()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void UDPSignalSource::connect(gr::top_block_sptr top_block)
|
||||
void CustomUDPSignalSource::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
//connect null sinks to unused streams
|
||||
for (int n = 0; n < channels_in_udp_; n++)
|
||||
@@ -132,7 +132,7 @@ void UDPSignalSource::connect(gr::top_block_sptr top_block)
|
||||
}
|
||||
|
||||
|
||||
void UDPSignalSource::disconnect(gr::top_block_sptr top_block)
|
||||
void CustomUDPSignalSource::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
//disconnect null sinks to unused streams
|
||||
for (int n = 0; n < channels_in_udp_; n++)
|
||||
@@ -151,19 +151,19 @@ void UDPSignalSource::disconnect(gr::top_block_sptr top_block)
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr UDPSignalSource::get_left_block()
|
||||
gr::basic_block_sptr CustomUDPSignalSource::get_left_block()
|
||||
{
|
||||
LOG(WARNING) << "Left block of a signal source should not be retrieved";
|
||||
return gr::block_sptr();
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr UDPSignalSource::get_right_block()
|
||||
gr::basic_block_sptr CustomUDPSignalSource::get_right_block()
|
||||
{
|
||||
return udp_gnss_rx_source_;
|
||||
}
|
||||
|
||||
gr::basic_block_sptr UDPSignalSource::get_right_block(int RF_channel)
|
||||
gr::basic_block_sptr CustomUDPSignalSource::get_right_block(__attribute__((unused)) int RF_channel)
|
||||
{
|
||||
return udp_gnss_rx_source_;
|
||||
}
|
||||
@@ -30,8 +30,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GNSS_SDR_UDP_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_UDP_SIGNAL_SOURCE_H
|
||||
#ifndef GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include "gr_complex_ip_packet_source.h"
|
||||
@@ -50,14 +50,14 @@ class ConfigurationInterface;
|
||||
* \brief This class reads from UDP packets, which streams interleaved
|
||||
* I/Q samples over a network.
|
||||
*/
|
||||
class UDPSignalSource : public GNSSBlockInterface
|
||||
class CustomUDPSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
UDPSignalSource(ConfigurationInterface* configuration,
|
||||
CustomUDPSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~UDPSignalSource();
|
||||
virtual ~CustomUDPSignalSource();
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "UDP_Signal_Source";
|
||||
return "Custom_UDP_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
@@ -102,4 +102,4 @@ private:
|
||||
boost::shared_ptr<gr::msg_queue> queue_;
|
||||
};
|
||||
|
||||
#endif /*GNSS_SDR_UDP_SIGNAL_SOURCE_H */
|
||||
#endif /*GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H */
|
||||
Reference in New Issue
Block a user