2018-01-23 16:31:42 +00:00
|
|
|
/*!
|
|
|
|
* \file labsat_signal_source.cc
|
|
|
|
* \brief Labsat 2 and 3 front-end signal sampler driver
|
|
|
|
* \author Javier Arribas, jarribas(at)cttc.es
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2018-01-23 16:31:42 +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
|
2018-01-23 16:31:42 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "labsat_signal_source.h"
|
|
|
|
#include "configuration_interface.h"
|
2018-02-26 02:15:53 +00:00
|
|
|
#include "labsat23_source.h"
|
|
|
|
#include <glog/logging.h>
|
2018-12-08 17:49:31 +00:00
|
|
|
#include <cstdint>
|
2018-12-03 14:43:43 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2018-01-23 16:31:42 +00:00
|
|
|
|
2020-06-29 07:07:41 +00:00
|
|
|
LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configuration,
|
2020-06-18 09:49:28 +00:00
|
|
|
const std::string& role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
2018-01-23 16:31:42 +00:00
|
|
|
{
|
2020-07-09 22:37:55 +00:00
|
|
|
const std::string default_item_type("gr_complex");
|
2019-04-12 10:59:57 +00:00
|
|
|
std::string default_dump_file = "./labsat_output.dat";
|
2018-01-23 16:31:42 +00:00
|
|
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
|
|
|
dump_ = configuration->property(role + ".dump", false);
|
|
|
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
|
|
|
|
2018-01-23 20:23:02 +00:00
|
|
|
int channel_selector = configuration->property(role + ".selected_channel", 1);
|
2018-01-23 16:31:42 +00:00
|
|
|
|
2019-04-12 10:59:57 +00:00
|
|
|
std::string default_filename = "./example_capture.LS3";
|
2018-01-23 16:31:42 +00:00
|
|
|
filename_ = configuration->property(role + ".filename", default_filename);
|
|
|
|
|
2018-12-03 11:52:17 +00:00
|
|
|
if (item_type_ == "gr_complex")
|
2018-01-23 16:31:42 +00:00
|
|
|
{
|
|
|
|
item_size_ = sizeof(gr_complex);
|
2020-06-18 09:49:28 +00:00
|
|
|
labsat23_source_ = labsat23_make_source_sptr(filename_.c_str(), channel_selector, queue);
|
2018-01-23 16:31:42 +00:00
|
|
|
DLOG(INFO) << "Item size " << item_size_;
|
|
|
|
DLOG(INFO) << "labsat23_source_(" << labsat23_source_->unique_id() << ")";
|
2018-01-23 19:09:39 +00:00
|
|
|
}
|
|
|
|
else
|
2018-01-23 16:31:42 +00:00
|
|
|
{
|
2018-01-23 19:09:39 +00:00
|
|
|
LOG(WARNING) << item_type_ << " unrecognized item type for LabSat source";
|
2018-12-08 17:49:31 +00:00
|
|
|
item_size_ = sizeof(int16_t);
|
2018-01-23 16:31:42 +00:00
|
|
|
}
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
|
|
|
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
|
|
|
}
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
|
|
|
}
|
2018-06-03 20:43:53 +00:00
|
|
|
if (in_stream_ > 0)
|
|
|
|
{
|
|
|
|
LOG(ERROR) << "A signal source does not have an input stream";
|
|
|
|
}
|
|
|
|
if (out_stream_ > 1)
|
|
|
|
{
|
|
|
|
LOG(ERROR) << "This implementation only supports one output stream";
|
|
|
|
}
|
2018-01-23 16:31:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LabsatSignalSource::connect(gr::top_block_sptr top_block)
|
|
|
|
{
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->connect(labsat23_source_, 0, file_sink_, 0);
|
|
|
|
DLOG(INFO) << "connected labsat23_source_ to file sink";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DLOG(INFO) << "nothing to connect internally";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LabsatSignalSource::disconnect(gr::top_block_sptr top_block)
|
|
|
|
{
|
|
|
|
if (dump_)
|
|
|
|
{
|
|
|
|
top_block->disconnect(labsat23_source_, 0, file_sink_, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gr::basic_block_sptr LabsatSignalSource::get_left_block()
|
|
|
|
{
|
|
|
|
LOG(WARNING) << "Left block of a signal source should not be retrieved";
|
|
|
|
return gr::block_sptr();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gr::basic_block_sptr LabsatSignalSource::get_right_block()
|
|
|
|
{
|
|
|
|
return labsat23_source_;
|
|
|
|
}
|