Fix compilation in Mac OS and crosscompilation.

Formatting rules applied
This commit is contained in:
Carles Fernandez 2019-01-28 01:08:57 +01:00
parent 5395b0bc3b
commit fa19b2e6a4
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
1 changed files with 30 additions and 31 deletions

View File

@ -32,27 +32,26 @@
*/
#include "beidou_b1i_pcps_acquisition.h"
#include "Beidou_B1I.h"
#include "acq_conf.h"
#include "beidou_b1i_signal_processing.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h>
#include "beidou_b1i_signal_processing.h"
#include "Beidou_B1I.h"
using google::LogMessage;
BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
ConfigurationInterface* configuration,
std::string role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
const std::string& role,
unsigned int in_streams,
unsigned int out_streams) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
Acq_Conf acq_parameters = Acq_Conf();
Acq_Conf acq_parameters = Acq_Conf();
configuration_ = configuration;
std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat";
@ -61,7 +60,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
item_type_ = configuration_->property(role + ".item_type", default_item_type);
long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000);
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
acq_parameters.fs_in = fs_in_;
dump_ = configuration_->property(role + ".dump", false);
@ -82,7 +81,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
acq_parameters.dump_filename = dump_filename_;
//--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / ( BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS)));
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_;
@ -93,7 +92,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0)
if (item_type_ == "cshort")
{
item_size_ = sizeof(lv_16sc_t);
}
@ -114,7 +113,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
if (item_type_.compare("cbyte") == 0)
if (item_type_ == "cbyte")
{
cbyte_to_float_x2_ = make_complex_byte_to_float_x2();
float_to_complex_ = gr::blocks::float_to_complex::make();
@ -123,7 +122,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
channel_ = 0;
threshold_ = 0.0;
doppler_step_ = 0;
gnss_synchro_ = 0;
gnss_synchro_ = nullptr;
if (in_streams_ > 1)
{
LOG(ERROR) << "This implementation only supports one input stream";
@ -210,7 +209,7 @@ void BeidouB1iPcpsAcquisition::init()
void BeidouB1iPcpsAcquisition::set_local_code()
{
std::complex<float>* code = new std::complex<float>[code_length_];
auto* code = new std::complex<float>[code_length_];
beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
@ -254,9 +253,9 @@ float BeidouB1iPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
double lambda = static_cast<double>(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
float threshold = static_cast<float>(quantile(mydist, val));
auto threshold = static_cast<float>(quantile(mydist, val));
return threshold;
}
@ -264,15 +263,15 @@ float BeidouB1iPcpsAcquisition::calculate_threshold(float pfa)
void BeidouB1iPcpsAcquisition::connect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to connect
// nothing to connect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to connect
// nothing to connect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
top_block->connect(cbyte_to_float_x2_, 0, float_to_complex_, 0);
top_block->connect(cbyte_to_float_x2_, 1, float_to_complex_, 1);
@ -287,15 +286,15 @@ void BeidouB1iPcpsAcquisition::connect(gr::top_block_sptr top_block)
void BeidouB1iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
// nothing to disconnect
// nothing to disconnect
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
// nothing to disconnect
// nothing to disconnect
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
// Since a byte-based acq implementation is not available,
// we just convert cshorts to gr_complex
@ -312,15 +311,15 @@ void BeidouB1iPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
gr::basic_block_sptr BeidouB1iPcpsAcquisition::get_left_block()
{
if (item_type_.compare("gr_complex") == 0)
if (item_type_ == "gr_complex")
{
return acquisition_;
}
else if (item_type_.compare("cshort") == 0)
else if (item_type_ == "cshort")
{
return acquisition_;
}
else if (item_type_.compare("cbyte") == 0)
else if (item_type_ == "cbyte")
{
return cbyte_to_float_x2_;
}