1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

First attempt to design a smart ptr only factory. Compiles and passes

the thest but does not connect the flowgraph
This commit is contained in:
Carles Fernandez 2014-04-11 20:18:59 +02:00
parent 496f2139c3
commit bb6da5f7b0
6 changed files with 517 additions and 321 deletions

View File

@ -60,7 +60,7 @@ public:
FileConfiguration(std::string filename);
FileConfiguration();
//! Virtual destructor
virtual ~FileConfiguration();
~FileConfiguration();
std::string property(std::string property_name, std::string default_value);
bool property(std::string property_name, bool default_value);
long property(std::string property_name, long default_value);

View File

@ -33,6 +33,7 @@
* -------------------------------------------------------------------------
*/
#include "gnss_block_factory.h"
#include <string>
#include <sstream>
@ -83,15 +84,15 @@
#endif
#if GN3S_DRIVER
#include "gn3s_signal_source.h"
#include "gn3s_signal_source.h"
#endif
#if RAW_ARRAY_DRIVER
#include "raw_array_signal_source.h"
#include "raw_array_signal_source.h"
#endif
#if RTLSDR_DRIVER
#include "rtlsdr_signal_source.h"
#include "rtlsdr_signal_source.h"
#endif
using google::LogMessage;
@ -105,7 +106,7 @@ GNSSBlockFactory::~GNSSBlockFactory()
{}
GNSSBlockInterface* GNSSBlockFactory::GetSignalSource(
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalSource(
std::shared_ptr<ConfigurationInterface> configuration, boost::shared_ptr<gr::msg_queue> queue)
{
std::string default_implementation = "File_Signal_Source";
@ -118,7 +119,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetSignalSource(
GNSSBlockInterface* GNSSBlockFactory::GetSignalConditioner(
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalConditioner(
std::shared_ptr<ConfigurationInterface> configuration, boost::shared_ptr<gr::msg_queue> queue)
{
std::string default_implementation = "Pass_Through";
@ -147,30 +148,33 @@ GNSSBlockInterface* GNSSBlockFactory::GetSignalConditioner(
<< data_type_adapter << ", InputFilter implementation: "
<< input_filter << ", and Resampler implementation: "
<< resampler;
//std::unique_ptr<GNSSBlockInterface> conditioner_;
if(signal_conditioner.compare("Array_Signal_Conditioner") == 0)
{
//instantiate the array version
return new ArraySignalConditioner(configuration.get(), GetBlock(configuration,
"DataTypeAdapter", data_type_adapter, 1, 1, queue), GetBlock(
configuration,"InputFilter", input_filter, 1, 1, queue),
GetBlock(configuration,"Resampler", resampler, 1, 1, queue),
"SignalConditioner", "Signal_Conditioner", queue);
std::unique_ptr<GNSSBlockInterface> conditioner_(new ArraySignalConditioner(configuration.get(), GetBlock(configuration,
"DataTypeAdapter", data_type_adapter, 1, 1, queue).release(), GetBlock(
configuration,"InputFilter", input_filter, 1, 1, queue).release(),
GetBlock(configuration,"Resampler", resampler, 1, 1, queue).release(),
"SignalConditioner", "Signal_Conditioner", queue));
return conditioner_;
}
else
{
//normal version
return new SignalConditioner(configuration.get(), GetBlock(configuration,
"DataTypeAdapter", data_type_adapter, 1, 1, queue), GetBlock(
configuration,"InputFilter", input_filter, 1, 1, queue),
GetBlock(configuration,"Resampler", resampler, 1, 1, queue),
"SignalConditioner", "Signal_Conditioner", queue);
//single-antenna version
std::unique_ptr<GNSSBlockInterface> conditioner_(new SignalConditioner(configuration.get(), GetBlock(configuration,
"DataTypeAdapter", data_type_adapter, 1, 1, queue).release(), GetBlock(
configuration,"InputFilter", input_filter, 1, 1, queue).release(),
GetBlock(configuration,"Resampler", resampler, 1, 1, queue).release(),
"SignalConditioner", "Signal_Conditioner", queue));
return conditioner_;
}
}
GNSSBlockInterface* GNSSBlockFactory::GetObservables(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetObservables(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue)
{
std::string default_implementation = "GPS_L1_CA_Observables";
@ -182,7 +186,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetObservables(std::shared_ptr<Configurati
GNSSBlockInterface* GNSSBlockFactory::GetPVT(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetPVT(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue)
{
std::string default_implementation = "Pass_Through";
@ -194,7 +198,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetPVT(std::shared_ptr<ConfigurationInterf
GNSSBlockInterface* GNSSBlockFactory::GetOutputFilter(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetOutputFilter(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue)
{
std::string default_implementation = "Null_Sink_Output_Filter";
@ -204,7 +208,7 @@ GNSSBlockInterface* GNSSBlockFactory::GetOutputFilter(std::shared_ptr<Configurat
}
GNSSBlockInterface* GNSSBlockFactory::GetChannel(
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel(
std::shared_ptr<ConfigurationInterface> configuration,
std::string acq, std::string trk, std::string tlm, int channel,
boost::shared_ptr<gr::msg_queue> queue)
@ -215,23 +219,31 @@ GNSSBlockInterface* GNSSBlockFactory::GetChannel(
LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm;
return new Channel(configuration.get(), channel, GetBlock(configuration,
"Channel", "Pass_Through", 1, 1, queue),
(AcquisitionInterface*)GetBlock(configuration, "Acquisition", acq, 1, 1, queue),
(TrackingInterface*)GetBlock(configuration, "Tracking", trk, 1, 1, queue),
(TelemetryDecoderInterface*)GetBlock(configuration, "TelemetryDecoder", tlm, 1, 1, queue),
"Channel", "Channel", queue);
std::unique_ptr<GNSSBlockInterface> pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue);
std::unique_ptr<AcquisitionInterface> acq_ = GetAcqBlock(configuration, "Acquisition", acq, 1, 1, queue);
std::unique_ptr<TrackingInterface> trk_ = GetTrkBlock(configuration, "Tracking", trk, 1, 1, queue);
std::unique_ptr<TelemetryDecoderInterface> tlm_ = GetTlmBlock(configuration, "TelemetryDecoder", tlm, 1, 1, queue);
std::unique_ptr<GNSSBlockInterface> channel_(new Channel(configuration.get(), channel, pass_through_.release(),
acq_.release(),
trk_.release(),
tlm_.release(),
"Channel", "Channel", queue));
return channel_;
}
std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFactory::GetChannels(
std::shared_ptr<ConfigurationInterface> configuration, boost::shared_ptr<gr::msg_queue> queue)
{
std::string default_implementation = "Pass_Through";
unsigned int channel_count = configuration->property("Channels.count", 12);
LOG(INFO) << "Getting " << channel_count << " channels";
std::vector<GNSSBlockInterface*>* channels = new std::vector<GNSSBlockInterface*>();
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels(new std::vector<std::unique_ptr<GNSSBlockInterface>>());
std::string tracking = configuration->property("Tracking.implementation", default_implementation);
std::string telemetry_decoder = configuration->property("TelemetryDecoder.implementation", default_implementation);
std::string acquisition_implementation = configuration->property("Acquisition.implementation", default_implementation);
@ -239,15 +251,15 @@ std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
for (unsigned int i = 0; i < channel_count; i++)
{
std::string acquisition_implementation_specific = configuration->property(
"Acquisition"+ boost::lexical_cast<std::string>(i) + ".implementation",
default_implementation);
"Acquisition" + boost::lexical_cast<std::string>(i) + ".implementation",
default_implementation);
if(acquisition_implementation_specific.compare(default_implementation) != 0)
{
acquisition_implementation = acquisition_implementation_specific;
acquisition_implementation = acquisition_implementation_specific;
}
channels->push_back(GetChannel(configuration,
acquisition_implementation, tracking, telemetry_decoder, i,
queue));
channels->push_back(std::move(GetChannel(configuration,
acquisition_implementation, tracking, telemetry_decoder, i, queue)));
}
return channels;
}
@ -258,18 +270,19 @@ std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
*
* PLEASE ADD YOUR NEW BLOCK HERE!!
*/
GNSSBlockInterface* GNSSBlockFactory::GetBlock(
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue)
{
GNSSBlockInterface* block = NULL; //Change to nullptr when available in compilers (C++11)
std::unique_ptr<GNSSBlockInterface> block;
//PASS THROUGH ----------------------------------------------------------------
if (implementation.compare("Pass_Through") == 0)
{
block = new Pass_Through(configuration.get(), role, in_streams, out_streams);
std::unique_ptr<GNSSBlockInterface> block_(new Pass_Through(configuration.get(), role, in_streams, out_streams));
block = std::move(block_);
}
// SIGNAL SOURCES -------------------------------------------------------------
@ -277,9 +290,11 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
{
try
{
block = new FileSignalSource(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new FileSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
catch (const std::exception &e)
{
std::cout << "GNSS-SDR program ended." << std::endl;
@ -291,8 +306,10 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
{
try
{
block = new NsrFileSignalSource(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new NsrFileSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
catch (const std::exception &e)
{
@ -303,208 +320,412 @@ GNSSBlockInterface* GNSSBlockFactory::GetBlock(
}
else if (implementation.compare("UHD_Signal_Source") == 0)
{
block = new UhdSignalSource(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new UhdSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#if GN3S_DRIVER
else if (implementation.compare("GN3S_Signal_Source") == 0)
{
block = new Gn3sSignalSource(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new Gn3sSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#endif
#if RAW_ARRAY_DRIVER
else if (implementation.compare("Raw_Array_Signal_Source") == 0)
{
block = new RawArraySignalSource(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new RawArraySignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#endif
#if RTLSDR_DRIVER
else if (implementation.compare("Rtlsdr_Signal_Source") == 0)
{
block = new RtlsdrSignalSource(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new RtlsdrSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#endif
// DATA TYPE ADAPTER -----------------------------------------------------------
else if (implementation.compare("Ishort_To_Complex") == 0)
{
block = new IshortToComplex(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface>block_(new IshortToComplex(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
// INPUT FILTER ----------------------------------------------------------------
else if (implementation.compare("Fir_Filter") == 0)
{
block = new FirFilter(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new FirFilter(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Freq_Xlating_Fir_Filter") == 0)
{
block = new FreqXlatingFirFilter(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new FreqXlatingFirFilter(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Beamformer_Filter") == 0)
{
block = new BeamformerFilter(configuration.get(), role, in_streams,
out_streams);
std::unique_ptr<GNSSBlockInterface> block_(new BeamformerFilter(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
// RESAMPLER -------------------------------------------------------------------
else if (implementation.compare("Direct_Resampler") == 0)
{
block = new DirectResamplerConditioner(configuration.get(), role,
in_streams, out_streams);
std::unique_ptr<GNSSBlockInterface> block_(new DirectResamplerConditioner(configuration.get(), role,
in_streams, out_streams));
block = std::move(block_);
}
// ACQUISITION BLOCKS ---------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
{
block = new GpsL1CaPcpsAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaPcpsAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_PCPS_Assisted_Acquisition") == 0)
{
block = new GpsL1CaPcpsAssistedAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaPcpsAssistedAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_PCPS_Tong_Acquisition") == 0)
{
block = new GpsL1CaPcpsTongAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaPcpsTongAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_PCPS_Multithread_Acquisition") == 0)
{
block = new GpsL1CaPcpsMultithreadAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaPcpsMultithreadAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#if OPENCL_BLOCKS
else if (implementation.compare("GPS_L1_CA_PCPS_OpenCl_Acquisition") == 0)
{
block = new GpsL1CaPcpsOpenClAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaPcpsOpenClAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#endif
else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") == 0)
{
block = new GpsL1CaPcpsAcquisitionFineDoppler(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaPcpsAcquisitionFineDoppler(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_Ambiguous_Acquisition") == 0)
{
block = new GalileoE1PcpsAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1PcpsAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_8ms_Ambiguous_Acquisition") == 0)
{
block = new GalileoE1Pcps8msAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1Pcps8msAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_Tong_Ambiguous_Acquisition") == 0)
{
block = new GalileoE1PcpsTongAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1PcpsTongAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition") == 0)
{
block = new GalileoE1PcpsCccwsrAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1PcpsCccwsrAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
// TRACKING BLOCKS -------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking") == 0)
{
block = new GpsL1CaDllPllTracking(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaDllPllTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_DLL_PLL_Optim_Tracking") == 0)
{
block = new GpsL1CaDllPllOptimTracking(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaDllPllOptimTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_DLL_FLL_PLL_Tracking") == 0)
{
block = new GpsL1CaDllFllPllTracking(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaDllFllPllTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_TCP_CONNECTOR_Tracking") == 0)
{
block = new GpsL1CaTcpConnectorTracking(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaTcpConnectorTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking") == 0)
{
block = new GalileoE1DllPllVemlTracking(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1DllPllVemlTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_TCP_CONNECTOR_Tracking") == 0)
{
block = new GalileoE1TcpConnectorTracking(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1TcpConnectorTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
// TELEMETRY DECODERS ----------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_Telemetry_Decoder") == 0)
{
block = new GpsL1CaTelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaTelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1B_Telemetry_Decoder") == 0)
{
block = new GalileoE1BTelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1BTelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("SBAS_L1_Telemetry_Decoder") == 0)
{
block = new SbasL1TelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new SbasL1TelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
// OBSERVABLES -----------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_Observables") == 0)
{
block = new GpsL1CaObservables(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaObservables(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1B_Observables") == 0)
{
block = new GalileoE1Observables(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1Observables(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
// PVT -------------------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_PVT") == 0)
{
block = new GpsL1CaPvt(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GpsL1CaPvt(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GALILEO_E1_PVT") == 0)
{
block = new GalileoE1Pvt(configuration.get(), role, in_streams,
out_streams, queue);
std::unique_ptr<GNSSBlockInterface> block_(new GalileoE1Pvt(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
// OUTPUT FILTERS --------------------------------------------------------------
else if (implementation.compare("Null_Sink_Output_Filter") == 0)
{
block = new NullSinkOutputFilter(configuration.get(), role, in_streams,
out_streams);
std::unique_ptr<GNSSBlockInterface> block_(new NullSinkOutputFilter(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
else if (implementation.compare("File_Output_Filter") == 0)
{
block = new FileOutputFilter(configuration.get(), role, in_streams,
out_streams);
std::unique_ptr<GNSSBlockInterface> block_(new FileOutputFilter(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
else
{
// Log fatal. This causes execution to stop.
LOG(ERROR) << implementation << ": Undefined implementation for block";
}
return block;
return std::move(block);
}
std::unique_ptr<AcquisitionInterface> GNSSBlockFactory::GetAcqBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue)
{
std::unique_ptr<AcquisitionInterface> block;
// ACQUISITION BLOCKS ---------------------------------------------------------
if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GpsL1CaPcpsAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_PCPS_Assisted_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GpsL1CaPcpsAssistedAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_PCPS_Tong_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GpsL1CaPcpsTongAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_PCPS_Multithread_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GpsL1CaPcpsMultithreadAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#if OPENCL_BLOCKS
else if (implementation.compare("GPS_L1_CA_PCPS_OpenCl_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GpsL1CaPcpsOpenClAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
#endif
else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GpsL1CaPcpsAcquisitionFineDoppler(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_Ambiguous_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GalileoE1PcpsAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_8ms_Ambiguous_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GalileoE1Pcps8msAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_Tong_Ambiguous_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GalileoE1PcpsTongAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition") == 0)
{
std::unique_ptr<AcquisitionInterface> block_(new GalileoE1PcpsCccwsrAmbiguousAcquisition(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else
{
// Log fatal. This causes execution to stop.
LOG(ERROR) << implementation << ": Undefined implementation for block";
}
return std::move(block);
}
std::unique_ptr<TrackingInterface> GNSSBlockFactory::GetTrkBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue)
{
std::unique_ptr<TrackingInterface> block;
// TRACKING BLOCKS -------------------------------------------------------------
if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking") == 0)
{
std::unique_ptr<TrackingInterface> block_(new GpsL1CaDllPllTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_DLL_PLL_Optim_Tracking") == 0)
{
std::unique_ptr<TrackingInterface> block_(new GpsL1CaDllPllOptimTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_DLL_FLL_PLL_Tracking") == 0)
{
std::unique_ptr<TrackingInterface> block_(new GpsL1CaDllFllPllTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("GPS_L1_CA_TCP_CONNECTOR_Tracking") == 0)
{
std::unique_ptr<TrackingInterface> block_(new GpsL1CaTcpConnectorTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_DLL_PLL_VEML_Tracking") == 0)
{
std::unique_ptr<TrackingInterface> block_(new GalileoE1DllPllVemlTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1_TCP_CONNECTOR_Tracking") == 0)
{
std::unique_ptr<TrackingInterface> block_(new GalileoE1TcpConnectorTracking(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else
{
// Log fatal. This causes execution to stop.
LOG(ERROR) << implementation << ": Undefined implementation for block";
}
return std::move(block);
}
std::unique_ptr<TelemetryDecoderInterface> GNSSBlockFactory::GetTlmBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue)
{
std::unique_ptr<TelemetryDecoderInterface> block;
// TELEMETRY DECODERS ----------------------------------------------------------
if (implementation.compare("GPS_L1_CA_Telemetry_Decoder") == 0)
{
std::unique_ptr<TelemetryDecoderInterface> block_(new GpsL1CaTelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("Galileo_E1B_Telemetry_Decoder") == 0)
{
std::unique_ptr<TelemetryDecoderInterface> block_(new GalileoE1BTelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else if (implementation.compare("SBAS_L1_Telemetry_Decoder") == 0)
{
std::unique_ptr<TelemetryDecoderInterface> block_(new SbasL1TelemetryDecoder(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
else
{
// Log fatal. This causes execution to stop.
LOG(ERROR) << implementation << ": Undefined implementation for block";
}
return std::move(block);
}

View File

@ -38,10 +38,14 @@
#include <vector>
#include <string>
#include <memory>
#include <gnuradio/msg_queue.h>
class ConfigurationInterface;
class GNSSBlockInterface;
class AcquisitionInterface;
class TrackingInterface;
class TelemetryDecoderInterface;
/*!
* \brief Class that produces all kinds of GNSS blocks
@ -51,28 +55,47 @@ class GNSSBlockFactory
public:
GNSSBlockFactory();
virtual ~GNSSBlockFactory();
GNSSBlockInterface* GetSignalSource(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GetSignalSource(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);
GNSSBlockInterface* GetSignalConditioner(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);
GNSSBlockInterface* GetPVT(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GetPVT(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);
GNSSBlockInterface* GetObservables(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GetObservables(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);
GNSSBlockInterface* GetOutputFilter(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GetOutputFilter(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);
GNSSBlockInterface* GetChannel(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GetChannel(std::shared_ptr<ConfigurationInterface> configuration,
std::string acq, std::string trk, std::string tlm, int channel,
boost::shared_ptr<gr::msg_queue> queue);
std::vector<GNSSBlockInterface*>* GetChannels(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);
//std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(std::shared_ptr<ConfigurationInterface> configuration,
//std::vector<std::unique_ptr<GNSSBlockInterface>> GetChannels(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(std::shared_ptr<ConfigurationInterface> configuration,
boost::shared_ptr<gr::msg_queue> queue);
/*
* \brief Returns the block with the required configuration and implementation
*/
GNSSBlockInterface* GetBlock(std::shared_ptr<ConfigurationInterface> configuration,
std::unique_ptr<GNSSBlockInterface> GetBlock(std::shared_ptr<ConfigurationInterface> configuration,
std::string role, std::string implementation,
unsigned int in_streams, unsigned int out_streams,
boost::shared_ptr<gr::msg_queue> queue);
private:
std::unique_ptr<AcquisitionInterface> GetAcqBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue);
std::unique_ptr<TrackingInterface> GetTrkBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue);
std::unique_ptr<TelemetryDecoderInterface> GetTlmBlock(
std::shared_ptr<ConfigurationInterface> configuration,
std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, boost::shared_ptr<gr::msg_queue> queue);
};
#endif /*GNSS_SDR_BLOCK_FACTORY_H_*/

View File

@ -54,7 +54,8 @@ GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configurati
connected_ = false;
running_ = false;
configuration_ = configuration;
blocks_ = new std::vector<GNSSBlockInterface*>();
//blocks_ = new std::vector<GNSSBlockInterface*>();
std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
queue_ = queue;
init();
}
@ -64,10 +65,10 @@ GNSSFlowgraph::~GNSSFlowgraph()
{
for (unsigned int i = 0; i < blocks_->size(); i++)
{
delete blocks_->at(i);
//delete blocks_->at(i);
}
blocks_->clear();
delete blocks_;
//delete blocks_;
}
@ -129,7 +130,10 @@ void GNSSFlowgraph::connect()
try
{
signal_source()->connect(top_block_);
std::cout << "helllllo" << std::endl;
//signal_source()->connect(top_block_);
blocks_->at(0)->connect(top_block_);
std::cout << "helllllo" << std::endl;
}
catch (std::exception& e)
{
@ -440,42 +444,55 @@ void GNSSFlowgraph::set_configuration(std::shared_ptr<ConfigurationInterface> co
GNSSBlockInterface* GNSSFlowgraph::signal_source()
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::signal_source()
{
return blocks_->at(0);
//std::shared_ptr<GNSSBlockInterface> cond_ { blocks_->at(0) };
//return cond_;
//return blocks_->at(0);
std::shared_ptr<GNSSBlockInterface> source_ = std::move(blocks_->at(0));
return source_;
}
GNSSBlockInterface* GNSSFlowgraph::signal_conditioner()
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::signal_conditioner()
{
return blocks_->at(1);
}
ChannelInterface* GNSSFlowgraph::channel(unsigned int index)
std::shared_ptr<ChannelInterface> GNSSFlowgraph::channel(unsigned int index)
{
return (ChannelInterface*) blocks_->at(index + 5);
//return (ChannelInterface*) blocks_->at(index + 5);
//std::shared_ptr<ChannelInterface> sptr = std::make_shared<GNSSBlockInterface>(blocks_->at(index + 5));
//return blocks_->at(index + 5);
std::shared_ptr<GNSSBlockInterface> chan_ = blocks_->at(index + 5);
std::shared_ptr<ChannelInterface> chan = std::dynamic_pointer_cast<ChannelInterface>(chan_);
return chan;
//return sptr;
}
GNSSBlockInterface* GNSSFlowgraph::observables()
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::observables()
{
return blocks_->at(2);
}
GNSSBlockInterface* GNSSFlowgraph::pvt()
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::pvt()
{
return blocks_->at(3);
}
GNSSBlockInterface* GNSSFlowgraph::output_filter()
std::shared_ptr<GNSSBlockInterface> GNSSFlowgraph::output_filter()
{
return blocks_->at(4);
}
@ -487,24 +504,36 @@ void GNSSFlowgraph::init()
/*
* Instantiates the receiver blocks
*/
blocks_->push_back(block_factory_->GetSignalSource(configuration_, queue_));
blocks_->push_back(block_factory_->GetSignalConditioner(configuration_, queue_));
blocks_->push_back(block_factory_->GetObservables(configuration_, queue_));
blocks_->push_back(block_factory_->GetPVT(configuration_, queue_));
blocks_->push_back(block_factory_->GetOutputFilter(configuration_, queue_));
std::shared_ptr<GNSSBlockFactory> block_factory_ = std::make_shared<GNSSBlockFactory>();
std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_ = std::make_shared<std::vector<std::shared_ptr<GNSSBlockInterface>>>();
std::vector<GNSSBlockInterface*>* channels = block_factory_->GetChannels(configuration_, queue_);
std::unique_ptr<GNSSBlockInterface> signal_source_ = block_factory_->GetSignalSource(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> cond_ = block_factory_->GetSignalConditioner(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> obs_ = block_factory_->GetObservables(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> pvt_ = block_factory_->GetPVT(configuration_, queue_);
std::shared_ptr<GNSSBlockInterface> output_ = block_factory_->GetOutputFilter(configuration_, queue_);
blocks_->push_back(std::move(signal_source_));
blocks_->push_back(cond_);
blocks_->push_back(obs_);
blocks_->push_back(pvt_);
blocks_->push_back(output_);
std::shared_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = block_factory_->GetChannels(configuration_, queue_);
channels_count_ = channels->size();
for (unsigned int i = 0; i < channels_count_; i++)
{
blocks_->push_back(channels->at(i));
std::shared_ptr<GNSSBlockInterface> chan_ = std::move(channels->at(i));
blocks_->push_back(chan_);
}
top_block_ = gr::make_top_block("GNSSFlowgraph");
delete channels;
//delete channels;
// fill the available_GNSS_signals_ queue with the satellites ID's to be searched by the acquisition
@ -543,37 +572,37 @@ void GNSSFlowgraph::set_signals_list()
if (default_system.compare(std::string("GPS")) == 0)
{
/*
* Loop to create GPS L1 C/A signals
*/
std::set<unsigned int> available_gps_prn = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28,
29, 30, 31, 32 };
/*
* Loop to create GPS L1 C/A signals
*/
std::set<unsigned int> available_gps_prn = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28,
29, 30, 31, 32 };
for (available_gnss_prn_iter = available_gps_prn.begin();
available_gnss_prn_iter != available_gps_prn.end();
available_gnss_prn_iter++)
{
available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("GPS"),
*available_gnss_prn_iter), std::string("1C")));
}
for (available_gnss_prn_iter = available_gps_prn.begin();
available_gnss_prn_iter != available_gps_prn.end();
available_gnss_prn_iter++)
{
available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("GPS"),
*available_gnss_prn_iter), std::string("1C")));
}
}
if (default_system.compare(std::string("SBAS")) == 0)
{
/*
* Loop to create SBAS L1 C/A signals
*/
std::set<unsigned int> available_sbas_prn = {120, 124, 126};
/*
* Loop to create SBAS L1 C/A signals
*/
std::set<unsigned int> available_sbas_prn = {120, 124, 126};
for (available_gnss_prn_iter = available_sbas_prn.begin();
available_gnss_prn_iter != available_sbas_prn.end();
available_gnss_prn_iter++)
{
available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("SBAS"),
*available_gnss_prn_iter), std::string("1C")));
}
for (available_gnss_prn_iter = available_sbas_prn.begin();
available_gnss_prn_iter != available_sbas_prn.end();
available_gnss_prn_iter++)
{
available_GNSS_signals_.push_back(Gnss_Signal(Gnss_Satellite(std::string("SBAS"),
*available_gnss_prn_iter), std::string("1C")));
}
}
@ -636,7 +665,7 @@ void GNSSFlowgraph::set_signals_list()
// for (available_gnss_list_iter = available_GNSS_signals_.begin(); available_gnss_list_iter
// != available_GNSS_signals_.end(); available_gnss_list_iter++)
// {
// std::cout << *available_gnss_list_iter << std::endl;
// std::cout << *available_gnss_list_iter << std::endl;
// }
}

View File

@ -93,12 +93,12 @@ public:
void set_configuration(std::shared_ptr<ConfigurationInterface> configuration);
GNSSBlockInterface* signal_source();
GNSSBlockInterface* signal_conditioner();
ChannelInterface* channel(unsigned int index);
GNSSBlockInterface* observables();
GNSSBlockInterface* pvt();
GNSSBlockInterface* output_filter();
std::shared_ptr<GNSSBlockInterface> signal_source();
std::shared_ptr<GNSSBlockInterface> signal_conditioner();
std::shared_ptr<ChannelInterface> channel(unsigned int index);
std::shared_ptr<GNSSBlockInterface> observables();
std::shared_ptr<GNSSBlockInterface> pvt();
std::shared_ptr<GNSSBlockInterface> output_filter();
unsigned int applied_actions()
{
@ -131,8 +131,9 @@ private:
unsigned int applied_actions_;
std::string config_file_;
std::shared_ptr<ConfigurationInterface> configuration_;
std::unique_ptr<GNSSBlockFactory> block_factory_;
std::vector<GNSSBlockInterface*>* blocks_;
std::shared_ptr<GNSSBlockFactory> block_factory_;
std::shared_ptr<std::vector<std::shared_ptr<GNSSBlockInterface>>> blocks_;
//std::shared_ptr<std::vector<std::shared_ptr<ChannelInterface>>> channels_;
gr::top_block_sptr top_block_;
boost::shared_ptr<gr::msg_queue> queue_;
std::list<Gnss_Signal> available_GNSS_signals_;

View File

@ -43,7 +43,7 @@
#include "observables_interface.h"
#include "pvt_interface.h"
#include "gnss_block_factory.h"
#include "channel.h"
TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource)
{
@ -53,11 +53,13 @@ TEST(GNSS_Block_Factory_Test, InstantiateFileSignalSource)
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
configuration->set_property("SignalSource.filename", filename);
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
// Example of a factory as a shared_ptr
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue);
// Example of a block as a shared_ptr
std::shared_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration, queue);
LOG(INFO) << "signal source created";
EXPECT_STREQ("SignalSource", signal_source->role().c_str());
EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str());
delete signal_source;
}
@ -66,11 +68,12 @@ TEST(GNSS_Block_Factory_Test, InstantiateUHDSignalSource)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("SignalSource.implementation", "UHD_Signal_Source");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue);
// Example of a factory created with auto
auto factory = new GNSSBlockFactory();
// Example of a block created with auto
auto signal_source = factory->GetSignalSource(configuration, queue);
EXPECT_STREQ("SignalSource", signal_source->role().c_str());
EXPECT_STREQ("UHD_Signal_Source", signal_source->implementation().c_str());
delete signal_source;
}
@ -79,12 +82,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongSignalSource)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("SignalSource.implementation", "Pepito");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
GNSSBlockFactory *factory = new GNSSBlockFactory();
GNSSBlockInterface *signal_source = factory->GetSignalSource(configuration, queue);
EXPECT_EQ(NULL, signal_source);
delete factory;
// Example of a factory as a unique_ptr
std::unique_ptr<GNSSBlockFactory> factory;
// Example of a block as a unique_ptr
std::unique_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration, queue);
EXPECT_EQ(nullptr, signal_source);
}
@ -93,14 +95,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateSignalConditioner)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *signal_conditioner = factory->GetSignalConditioner(configuration, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> signal_conditioner = factory->GetSignalConditioner(configuration, queue);
EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str());
EXPECT_STREQ("Signal_Conditioner", signal_conditioner->implementation().c_str());
delete signal_conditioner;
}
@ -130,13 +128,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateFIRFilter)
configuration->set_property("InputFilter.filter_type", "bandpass");
configuration->set_property("InputFilter.grid_density", "16");
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1,1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1,1, queue);
EXPECT_STREQ("InputFilter", input_filter->role().c_str());
EXPECT_STREQ("Fir_Filter", input_filter->implementation().c_str());
delete input_filter;
}
TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter)
@ -167,14 +163,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateFreqXlatingFIRFilter)
configuration->set_property("InputFilter.sampling_frequency","4000000");
configuration->set_property("InputFilter.IF","34000");
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *input_filter = factory->GetBlock(configuration, "InputFilter", "Freq_Xlating_Fir_Filter", 1,1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Freq_Xlating_Fir_Filter", 1,1, queue);
EXPECT_STREQ("InputFilter", input_filter->role().c_str());
EXPECT_STREQ("Freq_Xlating_Fir_Filter", input_filter->implementation().c_str());
delete input_filter;
}
TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler)
@ -182,14 +175,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateDirectResampler)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Resampler.implementation", "Direct_Resampler");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1,1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1,1, queue);
EXPECT_STREQ("Resampler", resampler->role().c_str());
EXPECT_STREQ("Direct_Resampler", resampler->implementation().c_str());
delete resampler;
}
TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPcpsAcquisition)
@ -197,14 +186,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPcpsAcquisition)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1, queue);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
EXPECT_STREQ("Acquisition", acquisition->role().c_str());
EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str());
delete acquisition;
}
@ -213,14 +199,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1PcpsAmbiguousAcquisition)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
AcquisitionInterface *acquisition = (AcquisitionInterface*)factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
EXPECT_STREQ("Acquisition", acquisition->role().c_str());
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
delete acquisition;
}
@ -229,14 +212,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllFllPllTracking)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_FLL_PLL_Tracking", 1, 1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_FLL_PLL_Tracking", 1, 1, queue);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
EXPECT_STREQ("Tracking", tracking->role().c_str());
EXPECT_STREQ("GPS_L1_CA_DLL_FLL_PLL_Tracking", tracking->implementation().c_str());
delete tracking;
}
@ -245,14 +225,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaDllPllTracking)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1, queue);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
EXPECT_STREQ("Tracking", tracking->role().c_str());
EXPECT_STREQ("GPS_L1_CA_DLL_PLL_Tracking", tracking->implementation().c_str());
delete tracking;
}
@ -261,14 +238,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTcpConnectorTracking)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1, queue);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
EXPECT_STREQ("Tracking", tracking->role().c_str());
EXPECT_STREQ("GPS_L1_CA_TCP_CONNECTOR_Tracking", tracking->implementation().c_str());
delete tracking;
}
@ -277,14 +251,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGalileoE1DllPllVemlTracking)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
TrackingInterface *tracking = (TrackingInterface*)factory->GetBlock(configuration, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1, queue);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
EXPECT_STREQ("Tracking", tracking->role().c_str());
EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
delete tracking;
}
@ -293,42 +264,32 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaTelemetryDecoder)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
TelemetryDecoderInterface *telemetry_decoder = (TelemetryDecoderInterface*)factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> telemetry_decoder = factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1, queue);
EXPECT_STREQ("TelemetryDecoder", telemetry_decoder->role().c_str());
EXPECT_STREQ("GPS_L1_CA_Telemetry_Decoder", telemetry_decoder->implementation().c_str());
delete telemetry_decoder;
}
TEST(GNSS_Block_Factory_Test, InstantiateChannels)
{
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Channels.count", "2");
configuration->set_property("Channels.in_acquisition", "2");
configuration->set_property("Tracking.implementation","GPS_L1_CA_DLL_FLL_PLL_Tracking");
configuration->set_property("TelemetryDecoder.implementation","GPS_L1_CA_Telemetry_Decoder");
configuration->set_property("Channel0.item_type", "gr_complex");
configuration->set_property("Acquisition0.implementation", "GPS_L1_CA_PCPS_Acquisition");
configuration->set_property("Channel1.item_type", "gr_complex");
configuration->set_property("Acquisition1.implementation", "GPS_L1_CA_PCPS_Acquisition");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
std::vector<GNSSBlockInterface*>* channels = factory->GetChannels(configuration, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = std::move(factory->GetChannels(configuration, queue));
EXPECT_EQ((unsigned int) 2, channels->size());
;
for(unsigned int i=0 ; i<channels->size() ; i++) delete channels->at(i);
channels->clear();
delete channels;
channels->erase(channels->begin(), channels->end());
//channels->clear();
}
@ -337,13 +298,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateObservables)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Observables.implementation", "Pass_Through");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue);
std::unique_ptr<GNSSBlockFactory> factory;
auto observables = factory->GetObservables(configuration, queue);
EXPECT_STREQ("Observables", observables->role().c_str());
EXPECT_STREQ("Pass_Through", observables->implementation().c_str());
delete observables;
}
@ -352,43 +310,24 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaObservables)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Observables.implementation", "GPS_L1_CA_Observables");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> observables = factory->GetObservables(configuration, queue);
EXPECT_STREQ("Observables", observables->role().c_str());
EXPECT_STREQ("GPS_L1_CA_Observables", observables->implementation().c_str());
delete observables;
}
TEST(GNSS_Block_Factory_Test, InstantiateWrongObservables)
{
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Observables.implementation", "Pepito");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
ObservablesInterface *observables = (ObservablesInterface*)factory->GetObservables(configuration, queue);
EXPECT_EQ(NULL, observables);
delete observables;
}
TEST(GNSS_Block_Factory_Test, InstantiatePvt)
{
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("PVT.implementation", "Pass_Through");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue);
EXPECT_STREQ("PVT", pvt->role().c_str());
EXPECT_STREQ("Pass_Through", pvt->implementation().c_str());
delete pvt;
std::unique_ptr<GNSSBlockFactory> factory;
auto pvt_ = factory->GetPVT(configuration, queue);
EXPECT_STREQ("PVT", pvt_->role().c_str());
EXPECT_STREQ("Pass_Through", pvt_->implementation().c_str());
}
@ -397,14 +336,11 @@ TEST(GNSS_Block_Factory_Test, InstantiateGpsL1CaPvt)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("PVT.implementation", "GPS_L1_CA_PVT");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration, queue);
std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_);
EXPECT_STREQ("PVT", pvt->role().c_str());
EXPECT_STREQ("GPS_L1_CA_PVT", pvt->implementation().c_str());
delete pvt;
}
@ -413,13 +349,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("PVT.implementation", "Pepito");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
PvtInterface *pvt = (PvtInterface*)factory->GetPVT(configuration, queue);
EXPECT_EQ(NULL, pvt);
delete pvt;
std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration, queue);
std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_);
EXPECT_EQ(nullptr, pvt);
}
@ -429,14 +362,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> output_filter = factory->GetOutputFilter(configuration, queue);
EXPECT_STREQ("OutputFilter", output_filter->role().c_str());
EXPECT_STREQ("Null_Sink_Output_Filter", output_filter->implementation().c_str());
delete output_filter;
}
@ -445,14 +374,10 @@ TEST(GNSS_Block_Factory_Test, InstantiateFileOutputFilter)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("OutputFilter.implementation", "File_Output_Filter");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue);
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> output_filter = factory->GetOutputFilter(configuration, queue);
EXPECT_STREQ("OutputFilter", output_filter->role().c_str());
EXPECT_STREQ("File_Output_Filter", output_filter->implementation().c_str());
delete output_filter;
}
@ -461,10 +386,7 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongOutputFilter)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("OutputFilter.implementation", "Pepito");
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
GNSSBlockInterface *output_filter = factory->GetOutputFilter(configuration, queue);
EXPECT_EQ(NULL, output_filter);
delete output_filter;
std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> output_filter = factory->GetOutputFilter(configuration, queue);
EXPECT_EQ(nullptr, output_filter);
}