mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Several changes in notch input filter adapter
Re-definition of the adapter
This commit is contained in:
parent
3ed545ac3f
commit
70dc68b984
@ -30,19 +30,50 @@
|
||||
*/
|
||||
|
||||
#include "notch_filter.h"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <glog/logging.h>
|
||||
#include <volk/volk.h>
|
||||
#include "configuration_interface.h"
|
||||
#include "notch_cc.cc"
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) :
|
||||
config_(configuration), role_(role), in_streams_(in_streams),
|
||||
role_(role), in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
(*this).init();
|
||||
size_t item_size_;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_file = "./data/input_filter.dat";
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
DLOG(INFO) << "dump_ is " << dump_;
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
notch_filter_ = make_notch_filter();
|
||||
DLOG(INFO) << "Item size " << item_size_;
|
||||
DLOG(INFO) << "input filter(" << notch_filter_->unique_id() << ")";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << item_type_
|
||||
<< " unrecognized item type for notch filter";
|
||||
item_size_ = sizeof(gr_complex);
|
||||
}
|
||||
if (dump_)
|
||||
{
|
||||
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||
}
|
||||
}
|
||||
|
||||
NotchFilter::~NotchFilter()
|
||||
@ -50,26 +81,32 @@ NotchFilter::~NotchFilter()
|
||||
|
||||
void NotchFilter::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
top_block->connect(notch_filter_, 0, file_sink_, 0);
|
||||
DLOG(INFO) << "connected notch filter output to file sink";
|
||||
}
|
||||
else
|
||||
{
|
||||
DLOG(INFO) << "nothing to connect internally";
|
||||
}
|
||||
}
|
||||
|
||||
void NotchFilter::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
|
||||
if (dump_)
|
||||
{
|
||||
top_block->disconnect(notch_filter_, 0, file_sink_, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr NotchFilter::get_left_block()
|
||||
{
|
||||
|
||||
return notch_filter_;
|
||||
}
|
||||
|
||||
gr::basic_block_sptr NotchFilter::get_right_block()
|
||||
{
|
||||
|
||||
return notch_filter_;
|
||||
}
|
||||
|
||||
void NotchFilter::init()
|
||||
{
|
||||
|
||||
}
|
@ -37,7 +37,7 @@
|
||||
#include <vector>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include "gnss_block_interface.h"
|
||||
#include "notch_cc.h"
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@ -69,19 +69,16 @@ public:
|
||||
gr::basic_block_sptr get_right_block();
|
||||
|
||||
private:
|
||||
gr::filter::iir_filter_ccc::sptr iir_filter_ccf_;
|
||||
|
||||
ConfigurationInterface* config_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::string input_item_type_;
|
||||
std::string output_item_type_;
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
void init();
|
||||
|
||||
|
||||
gr::block_sptr notch_filter_;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_NOTCH_FILTER_H_
|
||||
|
Loading…
Reference in New Issue
Block a user