From d76b6060f567bfcd1e2e5b47319823a2a9de8434 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 14 Feb 2015 11:49:06 +0100 Subject: [PATCH] some cleaning --- .../adapters/gps_l1_ca_pcps_acquisition.cc | 84 ++++++++++--------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index dcb216c60..4c3b25974 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -90,17 +90,17 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( code_= new gr_complex[vector_length_]; - // if (item_type_.compare("gr_complex") == 0 || (item_type_.compare("cshort") == 0)) - // { - item_size_ = sizeof(gr_complex); - acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_, - shift_resolution_, if_, fs_in_, code_length_, code_length_, - bit_transition_flag_, queue_, dump_, dump_filename_); + // if (item_type_.compare("gr_complex") == 0 ) + // { + item_size_ = sizeof(gr_complex); + acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, max_dwells_, + shift_resolution_, if_, fs_in_, code_length_, code_length_, + bit_transition_flag_, queue_, dump_, dump_filename_); - 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) << "acquisition(" << acquisition_cc_->unique_id() << ")"; + DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() << ")"; + DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() << ")"; // } if (item_type_.compare("cshort") == 0) @@ -132,10 +132,10 @@ GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition() void GpsL1CaPcpsAcquisition::set_channel(unsigned int channel) { channel_ = channel; - if (item_type_.compare("gr_complex") == 0) - { - acquisition_cc_->set_channel(channel_); - } + //if (item_type_.compare("gr_complex") == 0) + //{ + acquisition_cc_->set_channel(channel_); + //} } @@ -170,8 +170,8 @@ void GpsL1CaPcpsAcquisition::set_doppler_max(unsigned int doppler_max) doppler_max_ = doppler_max; // if (item_type_.compare("gr_complex") == 0) // { - acquisition_cc_->set_doppler_max(doppler_max_); - // } + acquisition_cc_->set_doppler_max(doppler_max_); + // } } @@ -180,8 +180,8 @@ void GpsL1CaPcpsAcquisition::set_doppler_step(unsigned int doppler_step) doppler_step_ = doppler_step; // if (item_type_.compare("gr_complex") == 0) // { - acquisition_cc_->set_doppler_step(doppler_step_); - // } + acquisition_cc_->set_doppler_step(doppler_step_); + // } } @@ -191,19 +191,19 @@ void GpsL1CaPcpsAcquisition::set_channel_queue( { channel_internal_queue_ = channel_internal_queue; // if (item_type_.compare("gr_complex") == 0) - // { - acquisition_cc_->set_channel_queue(channel_internal_queue_); - // } + // { + acquisition_cc_->set_channel_queue(channel_internal_queue_); + // } } void GpsL1CaPcpsAcquisition::set_gnss_synchro(Gnss_Synchro* gnss_synchro) { gnss_synchro_ = gnss_synchro; - // if (item_type_.compare("gr_complex") == 0) - // { - acquisition_cc_->set_gnss_synchro(gnss_synchro_); - // } + // if (item_type_.compare("gr_complex") == 0) + // { + acquisition_cc_->set_gnss_synchro(gnss_synchro_); + // } } @@ -229,22 +229,22 @@ void GpsL1CaPcpsAcquisition::init() void GpsL1CaPcpsAcquisition::set_local_code() { - // if (item_type_.compare("gr_complex") == 0) - // { - std::complex* code = new std::complex[code_length_]; + // if (item_type_.compare("gr_complex") == 0) + // { + std::complex* code = new std::complex[code_length_]; - gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); + gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); - for (unsigned int i = 0; i < sampled_ms_; i++) - { - memcpy(&(code_[i*code_length_]), code, - sizeof(gr_complex)*code_length_); - } + for (unsigned int i = 0; i < sampled_ms_; i++) + { + memcpy(&(code_[i*code_length_]), code, + sizeof(gr_complex)*code_length_); + } - acquisition_cc_->set_local_code(code_); + acquisition_cc_->set_local_code(code_); - delete[] code; - // } + delete[] code; + // } } @@ -252,16 +252,16 @@ void GpsL1CaPcpsAcquisition::reset() { // if (item_type_.compare("gr_complex") == 0) // { - acquisition_cc_->set_active(true); - // } + acquisition_cc_->set_active(true); + // } } void GpsL1CaPcpsAcquisition::set_state(int state) { // if (item_type_.compare("gr_complex") == 0) // { - acquisition_cc_->set_state(state); - // } + acquisition_cc_->set_state(state); + // } } @@ -322,6 +322,8 @@ void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block) } else if (item_type_.compare("cshort") == 0) { + // Since a short-based acq implementation is not available, + // 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); @@ -329,6 +331,8 @@ void GpsL1CaPcpsAcquisition::disconnect(gr::top_block_sptr top_block) } else if (item_type_.compare("cbyte") == 0) { + // Since a byte-based acq implementation is not available, + // we just convert cshorts to gr_complex top_block->disconnect(cbyte_to_float_x2_, 0, float_to_complex_, 0); top_block->disconnect(cbyte_to_float_x2_, 1, float_to_complex_, 1); top_block->disconnect(float_to_complex_, 0, stream_to_vector_, 0);