Apply project's coding style

This commit is contained in:
Carles Fernandez 2017-10-30 22:31:20 +01:00
parent fd2a32e0eb
commit cc3ed4c672
8 changed files with 252 additions and 179 deletions

View File

@ -48,6 +48,8 @@ option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and other front-ends (RTL-based
option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNURadio driver" OFF) option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNURadio driver" OFF)
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF) option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF) option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF)
option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF)
option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware" OFF)
# Performance analysis tools # Performance analysis tools
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)

View File

@ -424,7 +424,7 @@ $ make
$ sudo make install $ sudo make install
~~~~~~ ~~~~~~
With `Fmcomms2_Signal_Source` you can use any SDR hardware based on fmcomms2, including the ADALM-PLUTO (PlutoSdr) by configuring correctly the .conf file. The `Plutosdr_Signal_Source` offers a simplier manner to use the ADALM-PLUTO because implements only a subset of fmcomms2's parameters valid for it device. With `Fmcomms2_Signal_Source` you can use any SDR hardware based on fmcomms2, including the ADALM-PLUTO (PlutoSdr) by configuring correctly the .conf file. The `Plutosdr_Signal_Source` offers a simplier manner to use the ADALM-PLUTO because implements only a subset of fmcomms2's parameters valid for those devices.
###### Build OpenCL support (OPTIONAL): ###### Build OpenCL support (OPTIONAL):

View File

@ -5,10 +5,10 @@
[GNSS-SDR] [GNSS-SDR]
;######### GLOBAL OPTIONS ################## ;######### GLOBAL OPTIONS ##################
;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. ;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps].
;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE ;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE
; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ ; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/
GNSS-SDR.internal_fs_hz=2000000 GNSS-SDR.internal_fs_sps=2000000
;######### SUPL RRLP GPS assistance configuration ##### ;######### SUPL RRLP GPS assistance configuration #####
@ -119,27 +119,23 @@ TelemetryDecoder_1C.dump=false
TelemetryDecoder_1C.decimation_factor=1; TelemetryDecoder_1C.decimation_factor=1;
;######### OBSERVABLES CONFIG ############ ;######### OBSERVABLES CONFIG ############
Observables.implementation=GPS_L1_CA_Observables Observables.implementation=Hybrid_Observables
Observables.dump=false Observables.dump=false
Observables.dump_filename=./observables.dat Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############ ;######### PVT CONFIG ############
;#implementation: Position Velocity and Time (PVT) implementation algorithm: Use [GPS_L1_CA_PVT] in this version. PVT.implementation=RTKLIB_PVT
PVT.implementation=GPS_L1_CA_PVT PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
;#averaging_depth: Number of PVT observations in the moving average algorithm PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
PVT.averaging_depth=10
;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false]
PVT.flag_averaging=true
PVT.output_rate_ms=100 PVT.output_rate_ms=100
PVT.display_rate_ms=500 PVT.display_rate_ms=500
PVT.dump_filename=./PVT PVT.dump_filename=./PVT
PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea;
PVT.flag_nmea_tty_port=false; PVT.flag_nmea_tty_port=false;
PVT.nmea_dump_devname=/dev/pts/4 PVT.nmea_dump_devname=/dev/pts/4
PVT.dump=false
PVT.flag_rtcm_server=false PVT.flag_rtcm_server=false
PVT.flag_rtcm_tty_port=false PVT.flag_rtcm_tty_port=false
PVT.rtcm_dump_devname=/dev/pts/1 PVT.rtcm_dump_devname=/dev/pts/1
PVT.dump=false

View File

@ -5,10 +5,10 @@
[GNSS-SDR] [GNSS-SDR]
;######### GLOBAL OPTIONS ################## ;######### GLOBAL OPTIONS ##################
;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. ;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [sps].
;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE ;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE
; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ ; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/
GNSS-SDR.internal_fs_hz=2000000 GNSS-SDR.internal_fs_sps=2000000
;######### SUPL RRLP GPS assistance configuration ##### ;######### SUPL RRLP GPS assistance configuration #####
@ -79,11 +79,23 @@ Tracking_1C.dll_bw_hz=4.0;
TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
;######### OBSERVABLES CONFIG ############ ;######### OBSERVABLES CONFIG ############
Observables.implementation=GPS_L1_CA_Observables Observables.implementation=Hybrid_Observables
Observables.dump=false
Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############ ;######### PVT CONFIG ############
PVT.implementation=GPS_L1_CA_PVT PVT.implementation=RTKLIB_PVT
PVT.averaging_depth=100 PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
PVT.flag_averaging=true PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
PVT.output_rate_ms=10 PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
PVT.output_rate_ms=100
PVT.display_rate_ms=500 PVT.display_rate_ms=500
PVT.dump_filename=./PVT
PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea;
PVT.flag_nmea_tty_port=false;
PVT.nmea_dump_devname=/dev/pts/4
PVT.flag_rtcm_server=false
PVT.flag_rtcm_tty_port=false
PVT.rtcm_dump_devname=/dev/pts/1
PVT.dump=false

View File

@ -6,7 +6,7 @@
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
* *
* GNSS-SDR is a software defined Global Navigation * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -44,93 +44,94 @@ using google::LogMessage;
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration, Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, std::string role, unsigned int in_stream, unsigned int out_stream,
boost::shared_ptr<gr::msg_queue> queue) : boost::shared_ptr<gr::msg_queue> queue) :
role_(role), in_stream_(in_stream), out_stream_(out_stream), role_(role), in_stream_(in_stream), out_stream_(out_stream),
queue_(queue) queue_(queue)
{ {
std::string default_item_type="gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_file="./data/signal_source.dat"; std::string default_dump_file = "./data/signal_source.dat";
uri_= configuration->property(role+".device_address",std::string("192.168.2.1")); uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1"));
freq_= configuration->property(role+".freq",GPS_L1_FREQ_HZ); freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
sample_rate_=configuration->property(role+".sampling_frequency",2600000); sample_rate_ = configuration->property(role + ".sampling_frequency", 2600000);
bandwidth_= configuration->property(role+".bandwidth",2000000); bandwidth_ = configuration->property(role + ".bandwidth", 2000000);
rx1_en_=configuration->property(role+".rx1_enable",true); rx1_en_ = configuration->property(role + ".rx1_enable", true);
rx2_en_=configuration->property(role+".rx2_enable",false); rx2_en_ = configuration->property(role + ".rx2_enable", false);
buffer_size_=configuration->property(role+".buffer_size",0xA0000); buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000);
decimation_=configuration->property(role+".decimation",1); decimation_ = configuration->property(role + ".decimation", 1);
quadrature_=configuration->property(role+".quadrature",true); quadrature_ = configuration->property(role + ".quadrature", true);
rf_dc_=configuration->property(role+".rf_dc",true); rf_dc_ = configuration->property(role + ".rf_dc", true);
bb_dc_=configuration->property(role+".bb_dc",true); bb_dc_ = configuration->property(role + ".bb_dc", true);
gain_mode_rx1_=configuration->property(role+".gain_mode_rx1",std::string("manual")); gain_mode_rx1_ = configuration->property(role + ".gain_mode_rx1", std::string("manual"));
gain_mode_rx2_=configuration->property(role+".gain_mode_rx2",std::string("manual")); gain_mode_rx2_ = configuration->property(role + ".gain_mode_rx2", std::string("manual"));
rf_gain_rx1_=configuration->property(role+".gain_rx1",64.0); rf_gain_rx1_ = configuration->property(role + ".gain_rx1", 64.0);
rf_gain_rx2_=configuration->property(role+".gain_rx2",64.0); rf_gain_rx2_ = configuration->property(role + ".gain_rx2", 64.0);
rf_port_select_=configuration->property(role+".rf_port_select",std::string("A_BALANCED")); rf_port_select_ = configuration->property(role + ".rf_port_select", std::string("A_BALANCED"));
filter_file_=configuration->property(role+".filter_file",std::string("")); filter_file_ = configuration->property(role + ".filter_file", std::string(""));
filter_auto_=configuration->property(role+".filter_auto",true); filter_auto_ = configuration->property(role + ".filter_auto", true);
item_type_=configuration->property(role+".item_type",default_item_type); item_type_ = configuration->property(role + ".item_type", default_item_type);
samples_=configuration->property(role+".samples",0); samples_ = configuration->property(role + ".samples", 0);
dump_=configuration->property(role+".dump",false); dump_ = configuration->property(role + ".dump", false);
dump_filename_=configuration->property(role+".dump_filename",default_dump_file); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
item_size_=sizeof(gr_complex);
std::cout<<"device address: "<<uri_<<std::endl; item_size_ = sizeof(gr_complex);
std::cout<<"LO frequency : "<<freq_<<"Hz"<<std::endl;
std::cout<<"sample rate: "<<sample_rate_<<"Hz"<<std::endl;
if(item_type_.compare("gr_complex")==0) std::cout << "device address: " << uri_ << std::endl;
{ std::cout << "LO frequency : " << freq_ << "Hz" << std::endl;
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source_f32c::make( std::cout << "sample rate: " << sample_rate_ << "Hz" << std::endl;
uri_.c_str(), freq_, sample_rate_,
decimation_, bandwidth_,
rx1_en_, rx2_en_,
buffer_size_, quadrature_, rf_dc_,
bb_dc_, gain_mode_rx1_.c_str(), rf_gain_rx1_,
gain_mode_rx2_.c_str(), rf_gain_rx2_,
rf_port_select_.c_str(), filter_file_.c_str(),
filter_auto_);
}
else
{
LOG(FATAL) <<"Exception: item type "<<item_type_<<" not suported!";
}
if (samples_ != 0) if(item_type_.compare("gr_complex")==0)
{ {
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; fmcomms2_source_f32c_ = gr::iio::fmcomms2_source_f32c::make(
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); uri_.c_str(), freq_, sample_rate_,
DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; decimation_, bandwidth_,
} rx1_en_, rx2_en_,
buffer_size_, quadrature_, rf_dc_,
bb_dc_, gain_mode_rx1_.c_str(), rf_gain_rx1_,
gain_mode_rx2_.c_str(), rf_gain_rx2_,
rf_port_select_.c_str(), filter_file_.c_str(),
filter_auto_);
}
else
{
LOG(FATAL) << "Exception: item type " << item_type_ << " not suported!";
}
if (samples_ != 0)
{
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}
if (dump_) if (dump_)
{ {
DLOG(INFO) << "Dumping output into file " << dump_filename_; DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
} }
} }
Fmcomms2SignalSource::~Fmcomms2SignalSource() Fmcomms2SignalSource::~Fmcomms2SignalSource()
{ {}
}
void Fmcomms2SignalSource::connect(gr::top_block_sptr top_block) void Fmcomms2SignalSource::connect(gr::top_block_sptr top_block)
{ {
if (samples_ != 0) if (samples_ != 0)
{ {
top_block->connect(fmcomms2_source_f32c_, 0, valve_, 0); top_block->connect(fmcomms2_source_f32c_, 0, valve_, 0);
DLOG(INFO) << "connected fmcomms2 source to valve"; DLOG(INFO) << "connected fmcomms2 source to valve";
if (dump_) if (dump_)
{ {
top_block->connect(valve_, 0, file_sink_, 0); top_block->connect(valve_, 0, file_sink_, 0);
DLOG(INFO) << "connected valve to file sink"; DLOG(INFO) << "connected valve to file sink";
} }
} }
else else
{ {
if (dump_) if (dump_)
{ {
top_block->connect(fmcomms2_source_f32c_ , 0, file_sink_, 0); top_block->connect(fmcomms2_source_f32c_ , 0, file_sink_, 0);
DLOG(INFO) << "connected fmcomms2 source to file sink"; DLOG(INFO) << "connected fmcomms2 source to file sink";
} }

View File

@ -7,7 +7,7 @@
* This class represent a fmcomms2 signal source. It use the gr_iio block * This class represent a fmcomms2 signal source. It use the gr_iio block
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
* *
* GNSS-SDR is a software defined Global Navigation * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -51,7 +51,7 @@ public:
virtual ~Fmcomms2SignalSource(); virtual ~Fmcomms2SignalSource();
std::string role() inline std::string role() override
{ {
return role_; return role_;
} }
@ -59,42 +59,43 @@ public:
/*! /*!
* \brief Returns "fmcomms2_Signal_Source" * \brief Returns "fmcomms2_Signal_Source"
*/ */
std::string implementation() inline std::string implementation() override
{ {
return "Fmcomms2_Signal_Source"; return "Fmcomms2_Signal_Source";
} }
size_t item_size()
inline size_t item_size() override
{ {
return item_size_; return item_size_;
} }
void connect(gr::top_block_sptr top_block); void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block); void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block(); gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block(); gr::basic_block_sptr get_right_block() override;
private: private:
std::string role_; std::string role_;
// Front-end settings // Front-end settings
std::string uri_;//device direction std::string uri_;//device direction
unsigned long freq_; //frequency of local oscilator unsigned long freq_; //frequency of local oscilator
unsigned long sample_rate_; unsigned long sample_rate_;
unsigned long bandwidth_; unsigned long bandwidth_;
unsigned long buffer_size_; //reception buffer unsigned long buffer_size_; //reception buffer
unsigned int decimation_; unsigned int decimation_;
bool rx1_en_; bool rx1_en_;
bool rx2_en_; bool rx2_en_;
bool quadrature_; bool quadrature_;
bool rf_dc_; bool rf_dc_;
bool bb_dc_; bool bb_dc_;
std::string gain_mode_rx1_; std::string gain_mode_rx1_;
std::string gain_mode_rx2_; std::string gain_mode_rx2_;
double rf_gain_rx1_; double rf_gain_rx1_;
double rf_gain_rx2_; double rf_gain_rx2_;
std::string rf_port_select_; std::string rf_port_select_;
std::string filter_file_; std::string filter_file_;
bool filter_auto_; bool filter_auto_;
unsigned int in_stream_; unsigned int in_stream_;
unsigned int out_stream_; unsigned int out_stream_;
@ -105,7 +106,7 @@ private:
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_; gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_;
boost::shared_ptr<gr::block> valve_; boost::shared_ptr<gr::block> valve_;
gr::blocks::file_sink::sptr file_sink_; gr::blocks::file_sink::sptr file_sink_;

View File

@ -1,3 +1,33 @@
/*!
* \file plutosdr_signal_source.cc
* \brief Signal source for PlutoSDR
* \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "plutosdr_signal_source.h" #include "plutosdr_signal_source.h"
#include <iostream> #include <iostream>
#include <boost/format.hpp> #include <boost/format.hpp>
@ -14,67 +44,68 @@ using google::LogMessage;
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, std::string role, unsigned int in_stream, unsigned int out_stream,
boost::shared_ptr<gr::msg_queue> queue) : boost::shared_ptr<gr::msg_queue> queue) :
role_(role), in_stream_(in_stream), out_stream_(out_stream), role_(role), in_stream_(in_stream), out_stream_(out_stream),
queue_(queue) queue_(queue)
{ {
std::string default_item_type="gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_file="./data/signal_source.dat"; std::string default_dump_file = "./data/signal_source.dat";
uri_ = configuration->property(role+".device_address",std::string("192.168.2.1")); uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1"));
freq_= configuration->property(role+".freq",GPS_L1_FREQ_HZ); freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
sample_rate_=configuration->property(role+".sampling_frequency",3000000); sample_rate_ configuration->property(role + ".sampling_frequency", 3000000);
bandwidth_ = configuration->property(role+".bandwidth",2000000); bandwidth_ = configuration->property(role + ".bandwidth", 2000000);
buffer_size_=configuration->property(role+".buffer_size",0xA0000); buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000);
decimation_=configuration->property(role+".decimation",1); decimation_ = configuration->property(role + ".decimation", 1);
quadrature_=configuration->property(role+".quadrature",true); quadrature_ = configuration->property(role + ".quadrature", true);
rf_dc_ =configuration->property(role+".rf_dc",true); rf_dc_ = configuration->property(role + ".rf_dc", true);
bb_dc_ =configuration->property(role+".bb_dc",true); bb_dc_ = configuration->property(role + ".bb_dc", true);
gain_mode_=configuration->property(role+".gain_mode",std::string("manual")); gain_mode_ = configuration->property(role + ".gain_mode", std::string("manual"));
rf_gain_=configuration->property(role+".gain",50.0); rf_gain_ = configuration->property(role + ".gain", 50.0);
filter_file_=configuration->property(role+".filter_file",std::string("")); filter_file_ = configuration->property(role + ".filter_file", std::string(""));
filter_auto_=configuration->property(role+".filter_auto",true); filter_auto_ = configuration->property(role + ".filter_auto", true);
item_type_=configuration->property(role+".item_type",default_item_type); item_type_ = configuration->property(role + ".item_type", default_item_type);
samples_=configuration->property(role+".samples",0); samples_ = configuration->property(role + ".samples", 0);
dump_=configuration->property(role+".dump",false); dump_ = configuration->property(role + ".dump", false);
dump_filename_=configuration->property(role+".dump_filename",default_dump_file); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
if(item_type_.compare("gr_complex") != 0)
{
std::cout<<"bad item_type!!"<<std::endl;
LOG(FATAL) <<"Exception: item type must be gr_complex!";
}
item_size_=sizeof(gr_complex);
if(item_type_.compare("gr_complex") != 0)
{
std::cout << "bad item_type!!" << std::endl;
LOG(FATAL) << "Exception: item type must be gr_complex!";
}
std::cout<<"device address: "<<uri_<<std::endl; item_size_ = sizeof(gr_complex);
std::cout<<"frequency : "<<freq_<<"Hz"<<std::endl;
std::cout<<"sample rate: "<<sample_rate_<<"Hz"<<std::endl;
std::cout<<"gain mode: "<<gain_mode_<<std::endl;
std::cout<<"item type: "<<item_type_<<std::endl;
plutosdr_source_=gr::iio::pluto_source::make(uri_, freq_, sample_rate_, std::cout << "device address: " << uri_ << std::endl;
decimation_, bandwidth_, buffer_size_, quadrature_, rf_dc_, bb_dc_, std::cout << "frequency : " << freq_ << "Hz" << std::endl;
gain_mode_.c_str(), rf_gain_,filter_file_.c_str(), filter_auto_); std::cout << "sample rate: " << sample_rate_ << "Hz" << std::endl;
std::cout << "gain mode: " << gain_mode_ << std::endl;
std::cout << "item type: " << item_type_ << std::endl;
if (samples_ != 0) plutosdr_source_ = gr::iio::pluto_source::make(uri_, freq_, sample_rate_,
{ decimation_, bandwidth_, buffer_size_, quadrature_, rf_dc_, bb_dc_,
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; gain_mode_.c_str(), rf_gain_,filter_file_.c_str(), filter_auto_);
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; if (samples_ != 0)
} {
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}
if (dump_) if (dump_)
{ {
DLOG(INFO) << "Dumping output into file " << dump_filename_; DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
} }
} }
PlutosdrSignalSource::~PlutosdrSignalSource() PlutosdrSignalSource::~PlutosdrSignalSource()
{} {}
void PlutosdrSignalSource::connect(gr::top_block_sptr top_block) void PlutosdrSignalSource::connect(gr::top_block_sptr top_block)
{ {
if (samples_ != 0) if (samples_ != 0)

View File

@ -1,3 +1,33 @@
/*!
* \file plutosdr_signal_source.h
* \brief Signal source for PlutoSDR
* \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_ #ifndef GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_
#define GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_ #define GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_
@ -22,7 +52,7 @@ public:
virtual ~PlutosdrSignalSource(); virtual ~PlutosdrSignalSource();
std::string role() std::string role() override
{ {
return role_; return role_;
} }
@ -30,37 +60,37 @@ public:
/*! /*!
* \brief Returns "Plutosdr_Signal_Source" * \brief Returns "Plutosdr_Signal_Source"
*/ */
std::string implementation() std::string implementation() override
{ {
return "Plutosdr_Signal_Source"; return "Plutosdr_Signal_Source";
} }
size_t item_size() size_t item_size() override
{ {
return item_size_; return item_size_;
} }
void connect(gr::top_block_sptr top_block); void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block); void disconnect(gr::top_block_sptr top_block) override;
gr::basic_block_sptr get_left_block(); gr::basic_block_sptr get_left_block() override;
gr::basic_block_sptr get_right_block(); gr::basic_block_sptr get_right_block() override;
private: private:
std::string role_; std::string role_;
// Front-end settings // Front-end settings
std::string uri_;//device direction std::string uri_; // device direction
unsigned long freq_; //frequency of local oscilator unsigned long freq_; // frequency of local oscilator
unsigned long sample_rate_; unsigned long sample_rate_;
unsigned long bandwidth_; unsigned long bandwidth_;
unsigned long buffer_size_; //reception buffer unsigned long buffer_size_; // reception buffer
unsigned int decimation_; unsigned int decimation_;
bool quadrature_; bool quadrature_;
bool rf_dc_; bool rf_dc_;
bool bb_dc_; bool bb_dc_;
std::string gain_mode_; std::string gain_mode_;
double rf_gain_; double rf_gain_;
std::string filter_file_; std::string filter_file_;
bool filter_auto_; bool filter_auto_;
unsigned int in_stream_; unsigned int in_stream_;
unsigned int out_stream_; unsigned int out_stream_;
@ -71,7 +101,7 @@ private:
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
gr::iio::pluto_source::sptr plutosdr_source_; gr::iio::pluto_source::sptr plutosdr_source_;
boost::shared_ptr<gr::block> valve_; boost::shared_ptr<gr::block> valve_;
gr::blocks::file_sink::sptr file_sink_; gr::blocks::file_sink::sptr file_sink_;