1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

code cleaning

This commit is contained in:
Carles Fernandez 2016-01-20 22:59:22 +01:00
parent 1f3554384d
commit d095b581ae

View File

@ -85,29 +85,29 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
code_ = new gr_complex[vector_length_]; code_ = new gr_complex[vector_length_];
if (item_type_.compare("cshort") == 0 ) if (item_type_.compare("cshort") == 0 )
{ {
item_size_ = sizeof(lv_16sc_t); item_size_ = sizeof(lv_16sc_t);
acquisition_sc_ = pcps_make_acquisition_sc(sampled_ms_, max_dwells_, acquisition_sc_ = pcps_make_acquisition_sc(sampled_ms_, max_dwells_,
shift_resolution_, if_, fs_in_, code_length_, code_length_, shift_resolution_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, queue_, dump_, dump_filename_); bit_transition_flag_, queue_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")"; DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")";
}else{ }else{
item_size_ = sizeof(gr_complex); item_size_ = sizeof(gr_complex);
acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_, acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_,
shift_resolution_, if_, fs_in_, code_length_, code_length_, shift_resolution_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, queue_, dump_, dump_filename_); bit_transition_flag_, queue_, dump_, dump_filename_);
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")"; DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")";
} }
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")"; DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")";
//now is supported natively by the acquisition (_sc variant) //now is supported natively by the acquisition (_sc variant)
// if (item_type_.compare("cshort") == 0) // if (item_type_.compare("cshort") == 0)
// { // {
// cshort_to_float_x2_ = make_cshort_to_float_x2(); // cshort_to_float_x2_ = make_cshort_to_float_x2();
// float_to_complex_ = gr::blocks::float_to_complex::make(); // float_to_complex_ = gr::blocks::float_to_complex::make();
// } // }
if (item_type_.compare("cbyte") == 0) if (item_type_.compare("cbyte") == 0)
{ {
@ -133,11 +133,13 @@ void GpsL1CaPcpsAcquisition::set_channel(unsigned int channel)
{ {
channel_ = channel; channel_ = channel;
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_channel(channel_); acquisition_sc_->set_channel(channel_);
}else{ }
acquisition_cc_->set_channel(channel_); else
} {
acquisition_cc_->set_channel(channel_);
}
} }
@ -160,11 +162,13 @@ void GpsL1CaPcpsAcquisition::set_threshold(float threshold)
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_threshold(threshold_); acquisition_sc_->set_threshold(threshold_);
}else{ }
acquisition_cc_->set_threshold(threshold_); else
} {
acquisition_cc_->set_threshold(threshold_);
}
} }
@ -173,11 +177,13 @@ void GpsL1CaPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
doppler_max_ = doppler_max; doppler_max_ = doppler_max;
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_doppler_max(doppler_max_); acquisition_sc_->set_doppler_max(doppler_max_);
}else{ }
acquisition_cc_->set_doppler_max(doppler_max_); else
} {
acquisition_cc_->set_doppler_max(doppler_max_);
}
} }
@ -186,11 +192,13 @@ void GpsL1CaPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
doppler_step_ = doppler_step; doppler_step_ = doppler_step;
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_doppler_step(doppler_step_); acquisition_sc_->set_doppler_step(doppler_step_);
}else{ }
acquisition_cc_->set_doppler_step(doppler_step_); else
} {
acquisition_cc_->set_doppler_step(doppler_step_);
}
} }
@ -201,11 +209,13 @@ void GpsL1CaPcpsAcquisition::set_channel_queue(
channel_internal_queue_ = channel_internal_queue; channel_internal_queue_ = channel_internal_queue;
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_channel_queue(channel_internal_queue_); acquisition_sc_->set_channel_queue(channel_internal_queue_);
}else{ }
acquisition_cc_->set_channel_queue(channel_internal_queue_); else
} {
acquisition_cc_->set_channel_queue(channel_internal_queue_);
}
} }
@ -214,33 +224,39 @@ void GpsL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro)
gnss_synchro_ = gnss_synchro; gnss_synchro_ = gnss_synchro;
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_gnss_synchro(gnss_synchro_); acquisition_sc_->set_gnss_synchro(gnss_synchro_);
}else{ }
acquisition_cc_->set_gnss_synchro(gnss_synchro_); else
} {
acquisition_cc_->set_gnss_synchro(gnss_synchro_);
}
} }
signed int GpsL1CaPcpsAcquisition::mag() signed int GpsL1CaPcpsAcquisition::mag()
{ {
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
return acquisition_sc_->mag(); return acquisition_sc_->mag();
}else{ }
return acquisition_cc_->mag(); else
} {
return acquisition_cc_->mag();
}
} }
void GpsL1CaPcpsAcquisition::init() void GpsL1CaPcpsAcquisition::init()
{ {
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->init(); acquisition_sc_->init();
}else{ }
acquisition_cc_->init(); else
} {
acquisition_cc_->init();
}
set_local_code(); set_local_code();
} }
@ -262,11 +278,13 @@ void GpsL1CaPcpsAcquisition::set_local_code()
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_local_code(code_); acquisition_sc_->set_local_code(code_);
}else{ }
acquisition_cc_->set_local_code(code_); else
} {
acquisition_cc_->set_local_code(code_);
}
delete[] code; delete[] code;
// } // }
@ -275,23 +293,27 @@ void GpsL1CaPcpsAcquisition::set_local_code()
void GpsL1CaPcpsAcquisition::reset() void GpsL1CaPcpsAcquisition::reset()
{ {
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_active(true); acquisition_sc_->set_active(true);
}else{ }
acquisition_cc_->set_active(true); else
} {
acquisition_cc_->set_active(true);
}
} }
void GpsL1CaPcpsAcquisition::set_state(int state) void GpsL1CaPcpsAcquisition::set_state(int state)
{ {
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
acquisition_sc_->set_state(state); acquisition_sc_->set_state(state);
}else{ }
acquisition_cc_->set_state(state); else
} {
acquisition_cc_->set_state(state);
}
} }
@ -324,12 +346,7 @@ void GpsL1CaPcpsAcquisition::connect(gr::top_block_sptr top_block)
} }
else if (item_type_.compare("cshort") == 0) else if (item_type_.compare("cshort") == 0)
{ {
//top_block->connect(cshort_to_float_x2_, 0, float_to_complex_, 0); top_block->connect(stream_to_vector_, 0, acquisition_sc_, 0);
//top_block->connect(cshort_to_float_x2_, 1, float_to_complex_, 1);
//top_block->connect(float_to_complex_, 0, stream_to_vector_, 0);
//top_block->connect(stream_to_vector_, 0, acquisition_cc_, 0);
top_block->connect(stream_to_vector_, 0, acquisition_sc_, 0);
} }
else if (item_type_.compare("cbyte") == 0) else if (item_type_.compare("cbyte") == 0)
{ {
@ -353,13 +370,7 @@ void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block)
} }
else if (item_type_.compare("cshort") == 0) else if (item_type_.compare("cshort") == 0)
{ {
// Since a short-based acq implementation is not available, top_block->disconnect(stream_to_vector_, 0, acquisition_sc_, 0);
// we just convert cshorts to gr_complex
//top_block->disconnect(cshort_to_float_x2_, 0, float_to_complex_, 0);
//top_block->disconnect(cshort_to_float_x2_, 1, float_to_complex_, 1);
//top_block->disconnect(float_to_complex_, 0, stream_to_vector_, 0);
//top_block->disconnect(stream_to_vector_, 0, acquisition_cc_, 0);
top_block->disconnect(stream_to_vector_, 0, acquisition_sc_, 0);
} }
else if (item_type_.compare("cbyte") == 0) else if (item_type_.compare("cbyte") == 0)
{ {
@ -385,8 +396,7 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
} }
else if (item_type_.compare("cshort") == 0) else if (item_type_.compare("cshort") == 0)
{ {
//return cshort_to_float_x2_; return stream_to_vector_;
return stream_to_vector_;
} }
else if (item_type_.compare("cbyte") == 0) else if (item_type_.compare("cbyte") == 0)
{ {
@ -402,11 +412,13 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block() gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block()
{ {
if (item_type_.compare("cshort") == 0) if (item_type_.compare("cshort") == 0)
{ {
return acquisition_sc_; return acquisition_sc_;
}else{ }
return acquisition_cc_; else
} {
return acquisition_cc_;
}
} }