2012-02-19 17:45:51 +00:00
|
|
|
/*!
|
|
|
|
* \file signal_conditioner.cc
|
|
|
|
* \brief It holds blocks to change data type, filter and resample input data.
|
|
|
|
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2012-02-19 17:45:51 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2012-02-19 17:45:51 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "signal_conditioner.h"
|
2019-03-04 07:12:50 +00:00
|
|
|
#include "configuration_interface.h"
|
2012-02-19 17:45:51 +00:00
|
|
|
#include <glog/logging.h>
|
2018-12-03 14:43:43 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2012-02-19 17:45:51 +00:00
|
|
|
|
|
|
|
// Constructor
|
2020-06-29 07:07:41 +00:00
|
|
|
SignalConditioner::SignalConditioner(const ConfigurationInterface *configuration,
|
2018-04-29 08:23:19 +00:00
|
|
|
std::shared_ptr<GNSSBlockInterface> data_type_adapt,
|
|
|
|
std::shared_ptr<GNSSBlockInterface> in_filt,
|
|
|
|
std::shared_ptr<GNSSBlockInterface> res,
|
|
|
|
std::string role,
|
2018-12-03 14:43:43 +00:00
|
|
|
std::string implementation) : data_type_adapt_(std::move(data_type_adapt)),
|
|
|
|
in_filt_(std::move(in_filt)),
|
|
|
|
res_(std::move(res)),
|
|
|
|
role_(std::move(role)),
|
|
|
|
implementation_(std::move(implementation))
|
2012-02-19 17:45:51 +00:00
|
|
|
{
|
|
|
|
connected_ = false;
|
2018-03-03 01:03:39 +00:00
|
|
|
if (configuration)
|
|
|
|
{
|
|
|
|
};
|
2012-02-19 17:45:51 +00:00
|
|
|
}
|
|
|
|
|
2012-10-28 10:56:04 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
void SignalConditioner::connect(gr::top_block_sptr top_block)
|
2012-02-19 17:45:51 +00:00
|
|
|
{
|
|
|
|
if (connected_)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Signal conditioner already connected internally";
|
2012-02-19 17:45:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
data_type_adapt_->connect(top_block);
|
|
|
|
in_filt_->connect(top_block);
|
|
|
|
res_->connect(top_block);
|
|
|
|
|
2016-05-09 16:53:48 +00:00
|
|
|
top_block->connect(data_type_adapt_->get_right_block(), 0, in_filt_->get_left_block(), 0);
|
2012-02-19 17:45:51 +00:00
|
|
|
DLOG(INFO) << "data_type_adapter -> input_filter";
|
2016-05-09 16:53:48 +00:00
|
|
|
|
|
|
|
top_block->connect(in_filt_->get_right_block(), 0, res_->get_left_block(), 0);
|
2012-02-19 17:45:51 +00:00
|
|
|
DLOG(INFO) << "input_filter -> resampler";
|
|
|
|
connected_ = true;
|
|
|
|
}
|
|
|
|
|
2012-10-28 10:56:04 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
void SignalConditioner::disconnect(gr::top_block_sptr top_block)
|
2012-02-19 17:45:51 +00:00
|
|
|
{
|
|
|
|
if (!connected_)
|
|
|
|
{
|
2014-03-16 19:58:29 +00:00
|
|
|
LOG(WARNING) << "Signal conditioner already disconnected internally";
|
2012-02-19 17:45:51 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
top_block->disconnect(data_type_adapt_->get_right_block(), 0,
|
2018-03-03 01:03:39 +00:00
|
|
|
in_filt_->get_left_block(), 0);
|
2012-02-19 17:45:51 +00:00
|
|
|
top_block->disconnect(in_filt_->get_right_block(), 0,
|
2018-03-03 01:03:39 +00:00
|
|
|
res_->get_left_block(), 0);
|
2012-02-19 17:45:51 +00:00
|
|
|
|
|
|
|
data_type_adapt_->disconnect(top_block);
|
|
|
|
in_filt_->disconnect(top_block);
|
|
|
|
res_->disconnect(top_block);
|
|
|
|
|
|
|
|
connected_ = false;
|
|
|
|
}
|
|
|
|
|
2012-10-28 10:56:04 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
gr::basic_block_sptr SignalConditioner::get_left_block()
|
2012-02-19 17:45:51 +00:00
|
|
|
{
|
|
|
|
return data_type_adapt_->get_left_block();
|
|
|
|
}
|
|
|
|
|
2018-04-29 08:23:19 +00:00
|
|
|
|
2013-07-04 13:47:40 +00:00
|
|
|
gr::basic_block_sptr SignalConditioner::get_right_block()
|
2012-02-19 17:45:51 +00:00
|
|
|
{
|
|
|
|
return res_->get_right_block();
|
|
|
|
}
|