1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-26 15:03:14 +00:00

Now the block factory automatically detects the input data type

So it is no longer required to specify Channel.input_type=cshort in the
configuration. An error raises if Acquisition and Tracking Blocks are
not configured with the same input data type.
This commit is contained in:
Carles Fernandez 2016-08-15 11:57:12 +02:00
parent 838e643d51
commit 62e1e6f81a

View File

@ -41,6 +41,7 @@
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include "configuration_interface.h"
#include "in_memory_configuration.h"
#include "gnss_block_interface.h"
#include "pass_through.h"
#include "file_signal_source.h"
@ -285,8 +286,19 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_1C(
{
appendix3 = "";
}
// Automatically detect input data type
std::shared_ptr<InMemoryConfiguration> config;
config = std::make_shared<InMemoryConfiguration>();
std::string default_item_type = "gr_complex";
std::string acq_item_type = configuration->property("Acquisition_1C" + appendix1 + ".item_type", default_item_type);
std::string trk_item_type = configuration->property("Tracking_1C" + appendix2 + ".item_type", default_item_type);
if(acq_item_type.compare(trk_item_type))
{
LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!";
}
config->set_property("Channel.item_type", acq_item_type);
std::unique_ptr<GNSSBlockInterface> pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue);
std::unique_ptr<GNSSBlockInterface> pass_through_ = GetBlock(config, "Channel", "Pass_Through", 1, 1, queue);
std::unique_ptr<AcquisitionInterface> acq_ = GetAcqBlock(configuration, "Acquisition_1C" + appendix1, acq, 1, 0);
std::unique_ptr<TrackingInterface> trk_ = GetTrkBlock(configuration, "Tracking_1C"+ appendix2, trk, 1, 1);
std::unique_ptr<TelemetryDecoderInterface> tlm_ = GetTlmBlock(configuration, "TelemetryDecoder_1C" + appendix3, tlm, 1, 1);
@ -339,6 +351,17 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_2S(
{
appendix3 = "";
}
// Automatically detect input data type
std::shared_ptr<InMemoryConfiguration> config;
config = std::make_shared<InMemoryConfiguration>();
std::string default_item_type = "gr_complex";
std::string acq_item_type = configuration->property("Acquisition_2S" + appendix1 + ".item_type", default_item_type);
std::string trk_item_type = configuration->property("Tracking_2S" + appendix2 + ".item_type", default_item_type);
if(acq_item_type.compare(trk_item_type))
{
LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!";
}
config->set_property("Channel.item_type", acq_item_type);
std::unique_ptr<GNSSBlockInterface> pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue);
std::unique_ptr<AcquisitionInterface> acq_ = GetAcqBlock(configuration, "Acquisition_2S" + appendix1 , acq, 1, 0);
@ -395,6 +418,17 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_1B(
{
appendix3 = "";
}
// Automatically detect input data type
std::shared_ptr<InMemoryConfiguration> config;
config = std::make_shared<InMemoryConfiguration>();
std::string default_item_type = "gr_complex";
std::string acq_item_type = configuration->property("Acquisition_1B" + appendix1 + ".item_type", default_item_type);
std::string trk_item_type = configuration->property("Tracking_1B" + appendix2 + ".item_type", default_item_type);
if(acq_item_type.compare(trk_item_type))
{
LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!";
}
config->set_property("Channel.item_type", acq_item_type);
std::unique_ptr<GNSSBlockInterface> pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue);
std::unique_ptr<AcquisitionInterface> acq_ = GetAcqBlock(configuration, "Acquisition_1B" + appendix1, acq, 1, 0);
@ -451,6 +485,17 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_5X(
{
appendix3 = "";
}
// Automatically detect input data type
std::shared_ptr<InMemoryConfiguration> config;
config = std::make_shared<InMemoryConfiguration>();
std::string default_item_type = "gr_complex";
std::string acq_item_type = configuration->property("Acquisition_5X" + appendix1 + ".item_type", default_item_type);
std::string trk_item_type = configuration->property("Tracking_5X" + appendix2 + ".item_type", default_item_type);
if(acq_item_type.compare(trk_item_type))
{
LOG(ERROR) << "Acquisition and Tracking blocks must have the same input data type!";
}
config->set_property("Channel.item_type", acq_item_type);
std::unique_ptr<GNSSBlockInterface> pass_through_ = GetBlock(configuration, "Channel", "Pass_Through", 1, 1, queue);
std::unique_ptr<AcquisitionInterface> acq_ = GetAcqBlock(configuration, "Acquisition_5X" + appendix1, acq, 1, 0);