From ae4a867249c120f1987741948ac7a9f7a49c37d3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 28 Oct 2012 10:56:04 +0000 Subject: [PATCH] code cleaning git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@262 64b25241-fba3-4117-9849-534c7e92360d --- .../adapters/signal_conditioner.cc | 19 +- .../conditioner/adapters/signal_conditioner.h | 17 +- .../adapters/ishort_to_complex.cc | 14 +- .../adapters/ishort_to_complex.h | 6 +- .../adapters/file_output_filter.h | 6 +- .../adapters/null_sink_output_filter.h | 8 +- .../adapters/direct_resampler_conditioner.cc | 25 +-- .../adapters/direct_resampler_conditioner.h | 6 +- .../direct_resampler_conditioner_cc.cc | 93 +++++---- .../direct_resampler_conditioner_cc.h | 11 +- .../adapters/file_signal_source.h | 12 +- .../adapters/gn3s_signal_source.cc | 36 ++-- .../adapters/gn3s_signal_source.h | 4 - .../adapters/gps_l1_ca_telemetry_decoder.h | 14 +- .../gps_l1_ca_telemetry_decoder_cc.cc | 30 +-- .../gps_l1_ca_telemetry_decoder_cc.h | 115 +++++------ .../libs/gps_l1_ca_subframe_fsm.cc | 194 ++++++++++-------- .../libs/gps_l1_ca_subframe_fsm.h | 3 - src/core/interfaces/acquisition_interface.h | 6 +- src/core/interfaces/channel_interface.h | 4 +- src/core/interfaces/configuration_interface.h | 11 +- src/core/interfaces/gnss_block_interface.h | 4 +- src/core/interfaces/observables_interface.h | 4 +- src/core/interfaces/pvt_interface.h | 4 +- .../interfaces/telemetry_decoder_interface.h | 4 +- src/core/interfaces/tracking_interface.h | 5 +- src/core/receiver/control_message_factory.cc | 21 +- src/core/receiver/file_configuration.h | 12 +- src/core/receiver/gnss_flowgraph.cc | 13 +- src/core/receiver/in_memory_configuration.h | 8 +- src/core/system_parameters/GPS_L1_CA.h | 2 +- src/core/system_parameters/Galileo_E1.h | 6 +- .../gps_navigation_message.cc | 127 ++++++------ ...lileo_e1_dll_pll_veml_plot_sample_32bits.m | 32 +-- 34 files changed, 390 insertions(+), 486 deletions(-) diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.cc b/src/algorithms/conditioner/adapters/signal_conditioner.cc index f0dbfc54d..612c2ae10 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/signal_conditioner.cc @@ -47,29 +47,30 @@ SignalConditioner::SignalConditioner(ConfigurationInterface *configuration, GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt, GNSSBlockInterface *res, std::string role, std::string implementation, gr_msg_queue_sptr queue) : data_type_adapt_(data_type_adapt), - in_filt_(in_filt), res_(res), role_(role), implementation_(implementation), - queue_(queue) + in_filt_(in_filt), res_(res), role_(role), implementation_(implementation), + queue_(queue) { connected_ = false; } + // Destructor SignalConditioner::~SignalConditioner() { - delete data_type_adapt_; - delete in_filt_; - delete res_; + delete data_type_adapt_; + delete in_filt_; + delete res_; } + + void SignalConditioner::connect(gr_top_block_sptr top_block) { - if (connected_) { LOG_AT_LEVEL(WARNING) << "Signal conditioner already connected internally"; return; } - data_type_adapt_->connect(top_block); in_filt_->connect(top_block); res_->connect(top_block); @@ -85,9 +86,10 @@ void SignalConditioner::connect(gr_top_block_sptr top_block) connected_ = true; } + + void SignalConditioner::disconnect(gr_top_block_sptr top_block) { - if (!connected_) { LOG_AT_LEVEL(WARNING) << "Signal conditioner already disconnected internally"; @@ -106,6 +108,7 @@ void SignalConditioner::disconnect(gr_top_block_sptr top_block) connected_ = false; } + gr_basic_block_sptr SignalConditioner::get_left_block() { return data_type_adapt_->get_left_block(); diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.h b/src/algorithms/conditioner/adapters/signal_conditioner.h index b79159518..1a29bef12 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.h +++ b/src/algorithms/conditioner/adapters/signal_conditioner.h @@ -36,8 +36,6 @@ #include #include "gnss_block_interface.h" #include "control_message_factory.h" -//#include "gnss_signal.h" -//#include "gnss_synchro.h" class ConfigurationInterface; @@ -51,10 +49,9 @@ class TelemetryDecoderInterface; */ class SignalConditioner: public GNSSBlockInterface { - public: //! Constructor - SignalConditioner(ConfigurationInterface *configuration, + SignalConditioner(ConfigurationInterface *configuration, GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt, GNSSBlockInterface *res, std::string role, std::string implementation, gr_msg_queue_sptr queue); @@ -68,34 +65,22 @@ public: gr_basic_block_sptr get_right_block(); std::string role(){ return role_; } - std::string implementation(){ return "Signal_Conditioner"; } - size_t item_size(){ return 0; } GNSSBlockInterface *data_type_adapter(){ return data_type_adapt_; } - GNSSBlockInterface *input_filter(){ return in_filt_; } - GNSSBlockInterface *resampler(){ return res_; } - - - private: - GNSSBlockInterface *data_type_adapt_; GNSSBlockInterface *in_filt_; GNSSBlockInterface *res_; - std::string role_; std::string implementation_; - bool connected_; //bool stop_; gr_msg_queue_sptr queue_; - - }; #endif /*GNSS_SDR_SIGNAL_CONDITIONER_H_*/ diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index e90dfd009..9bd837afd 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -41,8 +41,8 @@ using google::LogMessage; IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, gr_msg_queue_sptr queue) : - config_(configuration), role_(role), in_streams_(in_streams), - out_streams_(out_streams), queue_(queue) + config_(configuration), role_(role), in_streams_(in_streams), + out_streams_(out_streams), queue_(queue) { std::string default_input_item_type = "gr_complex"; @@ -71,12 +71,13 @@ IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::str } + IshortToComplex::~IshortToComplex() {} + void IshortToComplex::connect(gr_top_block_sptr top_block) { - if (dump_) { top_block->connect(gr_interleaved_short_to_complex_, 0, file_sink_, 0); @@ -87,21 +88,24 @@ void IshortToComplex::connect(gr_top_block_sptr top_block) } } + void IshortToComplex::disconnect(gr_top_block_sptr top_block) { - if (dump_) { top_block->connect(gr_interleaved_short_to_complex_, 0, file_sink_, 0); } - } + + gr_basic_block_sptr IshortToComplex::get_left_block() { return gr_interleaved_short_to_complex_; } + + gr_basic_block_sptr IshortToComplex::get_right_block() { return gr_interleaved_short_to_complex_; diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h index 7bb979ae4..93e68b1ec 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.h @@ -44,10 +44,8 @@ class ConfigurationInterface; */ class IshortToComplex: public GNSSBlockInterface { - public: - - IshortToComplex(ConfigurationInterface* configuration, + IshortToComplex(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, gr_msg_queue_sptr queue); @@ -71,9 +69,7 @@ public: gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_right_block(); - private: - gr_interleaved_short_to_complex_sptr gr_interleaved_short_to_complex_; ConfigurationInterface* config_; bool dump_; diff --git a/src/algorithms/output_filter/adapters/file_output_filter.h b/src/algorithms/output_filter/adapters/file_output_filter.h index ebd909d90..3d6f65970 100644 --- a/src/algorithms/output_filter/adapters/file_output_filter.h +++ b/src/algorithms/output_filter/adapters/file_output_filter.h @@ -7,7 +7,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -46,7 +46,6 @@ class ConfigurationInterface; */ class FileOutputFilter : public GNSSBlockInterface { - public: FileOutputFilter(ConfigurationInterface* configuration, std::string role, @@ -54,7 +53,6 @@ public: unsigned int out_streams); virtual ~FileOutputFilter(); - std::string role() { return role_; @@ -67,14 +65,12 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); void disconnect(gr_top_block_sptr top_block); gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_right_block(); private: - gr_file_sink_sptr file_sink_; size_t item_size_; std::string filename_; diff --git a/src/algorithms/output_filter/adapters/null_sink_output_filter.h b/src/algorithms/output_filter/adapters/null_sink_output_filter.h index 2a59fdda5..a81e4dc19 100644 --- a/src/algorithms/output_filter/adapters/null_sink_output_filter.h +++ b/src/algorithms/output_filter/adapters/null_sink_output_filter.h @@ -9,7 +9,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -47,7 +47,6 @@ class ConfigurationInterface; */ class NullSinkOutputFilter : public GNSSBlockInterface { - public: NullSinkOutputFilter(ConfigurationInterface* configuration, std::string role, @@ -55,7 +54,6 @@ public: unsigned int out_streams); virtual ~NullSinkOutputFilter(); - std::string item_type() { return item_type_; @@ -72,20 +70,16 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); void disconnect(gr_top_block_sptr top_block); gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_right_block(); private: - gr_block_sptr sink_; size_t item_size_; - std::string item_type_; std::string role_; - unsigned int in_streams_; unsigned int out_streams_; }; diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index c35631d17..a02cbacc9 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -44,10 +44,8 @@ DirectResamplerConditioner::DirectResamplerConditioner( unsigned int in_stream, unsigned int out_stream) : role_(role), in_stream_(in_stream), out_stream_(out_stream) { - std::string default_item_type = "short"; std::string default_dump_file = "./data/signal_conditioner.dat"; - sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", (double)4000000.0); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", @@ -70,32 +68,33 @@ DirectResamplerConditioner::DirectResamplerConditioner( DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")"; } -// else if (item_type_.compare("short") == 0) -// { -// item_size_ = sizeof(short); -// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_, -// sample_freq_out_); -// } + // else if (item_type_.compare("short") == 0) + // { + // item_size_ = sizeof(short); + // resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_, + // sample_freq_out_); + // } else { LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type for resampler"; item_size_ = sizeof(short); } - if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } - } + + DirectResamplerConditioner::~DirectResamplerConditioner() {} + + void DirectResamplerConditioner::connect(gr_top_block_sptr top_block) { - if (dump_) { top_block->connect(resampler_, 0, file_sink_, 0); @@ -105,9 +104,9 @@ void DirectResamplerConditioner::connect(gr_top_block_sptr top_block) { DLOG(INFO) << "nothing to connect internally"; } - } + void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block) { if (dump_) @@ -116,11 +115,13 @@ void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block) } } + gr_basic_block_sptr DirectResamplerConditioner::get_left_block() { return resampler_; } + gr_basic_block_sptr DirectResamplerConditioner::get_right_block() { return resampler_; diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.h b/src/algorithms/resampler/adapters/direct_resampler_conditioner.h index ab1106cb7..8b7155e51 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.h +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.h @@ -6,7 +6,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -40,14 +40,12 @@ class ConfigurationInterface; class DirectResamplerConditioner: public GNSSBlockInterface { - public: DirectResamplerConditioner(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream); virtual ~DirectResamplerConditioner(); - std::string role() { return role_; @@ -60,14 +58,12 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); void disconnect(gr_top_block_sptr top_block); gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_right_block(); private: - std::string role_; unsigned int in_stream_; unsigned int out_stream_; diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc index f5e105100..7d060ef7f 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc @@ -8,7 +8,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -46,58 +46,62 @@ direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc( return direct_resampler_conditioner_cc_sptr( new direct_resampler_conditioner_cc(sample_freq_in, - sample_freq_out)); + sample_freq_out)); } + + direct_resampler_conditioner_cc::direct_resampler_conditioner_cc( double sample_freq_in, double sample_freq_out) : - gr_block("direct_resampler_conditioner_cc", gr_make_io_signature(1, 1, - sizeof(gr_complex)), gr_make_io_signature(1, 1, - sizeof(gr_complex))), d_sample_freq_in(sample_freq_in), - d_sample_freq_out(sample_freq_out), d_phase(0), d_lphase(0), - d_history(1) + gr_block("direct_resampler_conditioner_cc", gr_make_io_signature(1, 1, + sizeof(gr_complex)), gr_make_io_signature(1, 1, + sizeof(gr_complex))), d_sample_freq_in(sample_freq_in), + d_sample_freq_out(sample_freq_out), d_phase(0), d_lphase(0), + d_history(1) { - // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 if (d_sample_freq_in >= d_sample_freq_out) - { - d_phase_step = (unsigned int)floor((double)4294967296.0 - * sample_freq_out / sample_freq_in); - } + { + d_phase_step = (unsigned int)floor((double)4294967296.0 + * sample_freq_out / sample_freq_in); + } else - { - d_phase_step = (unsigned int)floor((double)4294967296.0 - * sample_freq_in / sample_freq_out); - } - + { + d_phase_step = (unsigned int)floor((double)4294967296.0 + * sample_freq_in / sample_freq_out); + } set_relative_rate(1.0 * sample_freq_out / sample_freq_in); set_output_multiple(1); } + + + direct_resampler_conditioner_cc::~direct_resampler_conditioner_cc() { } + + void direct_resampler_conditioner_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required) { - int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1) * sample_freq_in() / sample_freq_out()) + history() - 1); unsigned ninputs = ninput_items_required.size(); - for (unsigned i = 0; i < ninputs; i++) { ninput_items_required[i] = nreqd; } } + + int direct_resampler_conditioner_cc::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const gr_complex *in = (const gr_complex *)input_items[0]; gr_complex *out = (gr_complex *)output_items[0]; @@ -105,36 +109,35 @@ int direct_resampler_conditioner_cc::general_work(int noutput_items, int count = 0; if (d_sample_freq_in >= d_sample_freq_out) - { - while ((lcv < noutput_items)) { - if (d_phase <= d_lphase) - { - out[lcv] = *in; - lcv++; - } - - d_lphase = d_phase; - d_phase += d_phase_step; - in++; - count++; + while ((lcv < noutput_items)) + { + if (d_phase <= d_lphase) + { + out[lcv] = *in; + lcv++; + } + d_lphase = d_phase; + d_phase += d_phase_step; + in++; + count++; + } } - } else - { - while ((lcv < noutput_items)) { - d_lphase = d_phase; - d_phase += d_phase_step; - if (d_phase <= d_lphase) - { - in++; - count++; - } - out[lcv] = *in; - lcv++; + while ((lcv < noutput_items)) + { + d_lphase = d_phase; + d_phase += d_phase_step; + if (d_phase <= d_lphase) + { + in++; + count++; + } + out[lcv] = *in; + lcv++; + } } - } consume_each(std::min(count, ninput_items[0])); return lcv; diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h index 0afdd8e69..81c8059d0 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h @@ -13,7 +13,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -42,8 +42,7 @@ #include class direct_resampler_conditioner_cc; -typedef boost::shared_ptr - direct_resampler_conditioner_cc_sptr; +typedef boost::shared_ptr direct_resampler_conditioner_cc_sptr; direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(double sample_freq_in, double sample_freq_out); @@ -55,27 +54,21 @@ direct_resampler_make_conditioner_cc(double sample_freq_in, */ class direct_resampler_conditioner_cc: public gr_block { - private: - friend direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(double sample_freq_in, double sample_freq_out); - double d_sample_freq_in; //! Specifies the sampling frequency of the input signal double d_sample_freq_out; //! Specifies the sampling frequency of the output signal unsigned int d_phase; unsigned int d_lphase; unsigned int d_phase_step; unsigned int d_history; - direct_resampler_conditioner_cc(double sample_freq_in, double sample_freq_out); public: - ~direct_resampler_conditioner_cc(); - unsigned int sample_freq_in() const { return d_sample_freq_in; diff --git a/src/algorithms/signal_source/adapters/file_signal_source.h b/src/algorithms/signal_source/adapters/file_signal_source.h index d81d44cbb..eb436583e 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.h +++ b/src/algorithms/signal_source/adapters/file_signal_source.h @@ -9,7 +9,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -49,14 +49,12 @@ class ConfigurationInterface; */ class FileSignalSource: public GNSSBlockInterface { - public: FileSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams, gr_msg_queue_sptr queue); virtual ~FileSignalSource(); - std::string role() { return role_; @@ -69,12 +67,10 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); void disconnect(gr_top_block_sptr top_block); gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_right_block(); - std::string filename() { return filename_; @@ -97,7 +93,6 @@ public: } private: - long samples_; long sampling_frequency_; std::string filename_; @@ -105,20 +100,15 @@ private: bool repeat_; bool dump_; std::string dump_filename_; - std::string role_; - unsigned int in_streams_; unsigned int out_streams_; - gr_file_source_sptr file_source_; gr_block_sptr valve_; gr_block_sptr sink_; gr_block_sptr throttle_; - gr_msg_queue_sptr queue_; size_t item_size_; - // Throttle control bool enable_throttle_control_; }; diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc index d234a0bb5..f5d541208 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc @@ -39,13 +39,11 @@ using google::LogMessage; Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, gr_msg_queue_sptr queue) : + std::string role, unsigned int in_stream, unsigned int out_stream, gr_msg_queue_sptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) { - std::string default_item_type = "short"; std::string default_dump_file = "./data/gn3s_source.dat"; - item_type_ = configuration->property(role + ".item_type", default_item_type); dump_ = configuration->property(role + ".dump", false); @@ -60,38 +58,38 @@ Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, DLOG(INFO) << "gn3s_source(" << gn3s_source_->unique_id() << ")"; } -// else if (item_type_.compare("short") == 0) -// { -// item_size_ = sizeof(short); -// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_, -// sample_freq_out_); -// } + // else if (item_type_.compare("short") == 0) + // { + // item_size_ = sizeof(short); + // resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_, + // sample_freq_out_); + // } else { LOG_AT_LEVEL(WARNING) << item_type_ << " unrecognized item type for resampler"; item_size_ = sizeof(short); } - if (dump_) { DLOG(INFO) << "Dumping output into file " << dump_filename_; file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); } - - if (dump_) { DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } } + + Gn3sSignalSource::~Gn3sSignalSource() -{ -} +{} + + + void Gn3sSignalSource::connect(gr_top_block_sptr top_block) { - if (dump_) { top_block->connect(gn3s_source_, 0, file_sink_, 0); @@ -101,9 +99,10 @@ void Gn3sSignalSource::connect(gr_top_block_sptr top_block) { DLOG(INFO) << "nothing to connect internally"; } - } + + void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block) { if (dump_) @@ -112,13 +111,14 @@ void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block) } } + gr_basic_block_sptr Gn3sSignalSource::get_left_block() { - LOG_AT_LEVEL(WARNING) - << "Left block of a signal source should not be retrieved"; + LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved"; return gr_block_sptr(); } + gr_basic_block_sptr Gn3sSignalSource::get_right_block() { return gn3s_source_; diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.h b/src/algorithms/signal_source/adapters/gn3s_signal_source.h index 299c192bd..99a25972a 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.h +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.h @@ -40,14 +40,12 @@ class ConfigurationInterface; class Gn3sSignalSource: public GNSSBlockInterface { - public: Gn3sSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, gr_msg_queue_sptr queue); virtual ~Gn3sSignalSource(); - std::string role() { return role_; @@ -60,14 +58,12 @@ public: { return item_size_; } - void connect(gr_top_block_sptr top_block); void disconnect(gr_top_block_sptr top_block); gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_right_block(); private: - std::string role_; unsigned int in_stream_; unsigned int out_stream_; diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h index eb1407e13..e123381cf 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h @@ -6,7 +6,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -44,9 +44,7 @@ class ConfigurationInterface; */ class GpsL1CaTelemetryDecoder : public TelemetryDecoderInterface { - public: - GpsL1CaTelemetryDecoder(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, @@ -54,7 +52,6 @@ public: gr_msg_queue_sptr queue); virtual ~GpsL1CaTelemetryDecoder(); - std::string role() { return role_; @@ -63,36 +60,29 @@ public: { return "GPS_L1_CA_Telemetry_Decoder"; } - void connect(gr_top_block_sptr top_block); void disconnect(gr_top_block_sptr top_block); gr_basic_block_sptr get_left_block(); gr_basic_block_sptr get_right_block(); - void set_satellite(Gnss_Satellite satellite); void set_channel(int channel){telemetry_decoder_->set_channel(channel);}; - void reset() { return; }; - size_t item_size() { return 0; } + private: - gps_l1_ca_telemetry_decoder_cc_sptr telemetry_decoder_; - Gnss_Satellite satellite_; int channel_; unsigned int vector_length_; std::string item_type_; - bool dump_; std::string dump_filename_; - std::string role_; unsigned int in_streams_; unsigned int out_streams_; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index 3d358f89e..d51c8a95c 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -57,7 +57,6 @@ gps_l1_ca_telemetry_decoder_cc_sptr gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in, unsigned int vector_length, gr_msg_queue_sptr queue, bool dump) { - return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, if_freq, fs_in, vector_length, queue, dump)); } @@ -68,22 +67,22 @@ void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int { for (unsigned i = 0; i < 3; i++) { - ninput_items_required[i] = d_samples_per_bit*8; //set the required sample history + ninput_items_required[i] = d_samples_per_bit * 8; //set the required sample history } } gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( - Gnss_Satellite satellite, - long if_freq, - long fs_in, - unsigned + Gnss_Satellite satellite, + long if_freq, + long fs_in, + unsigned int vector_length, gr_msg_queue_sptr queue, bool dump) : gr_block ("gps_navigation_cc", gr_make_io_signature (1, 1, sizeof(Gnss_Synchro)), - gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) + gr_make_io_signature(1, 1, sizeof(Gnss_Synchro))) { // initialize internal vars d_queue = queue; @@ -176,7 +175,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { int corr_value = 0; - int preamble_diff=0; + int preamble_diff = 0; Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; d_sample_counter++; //count for the processed samples @@ -199,7 +198,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i } d_flag_preamble=false; //******* frame sync ****************** - if (abs(corr_value)>=160) + if (abs(corr_value) >= 160) { //TODO: Rewrite with state machine if (d_stat == 0) @@ -311,11 +310,11 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i //1. Copy the current tracking output current_synchro_data=in[0][0]; //2. Add the telemetry decoder information - current_synchro_data.Flag_valid_word=(d_flag_frame_sync == true and d_flag_parity == true); - current_synchro_data.Flag_preamble= d_flag_preamble; - current_synchro_data.Preamble_timestamp_ms= d_preamble_time_seconds*1000.0; - current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs*1000.0; - current_synchro_data.Preamble_symbol_counter=fmod((double)(d_sample_counter - d_preamble_index),6000); //not corrected the preamble correlation lag! -> to be taken into account in TX Time + current_synchro_data.Flag_valid_word = (d_flag_frame_sync == true and d_flag_parity == true); + current_synchro_data.Flag_preamble = d_flag_preamble; + current_synchro_data.Preamble_timestamp_ms = d_preamble_time_seconds * 1000.0; + current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs * 1000.0; + current_synchro_data.Preamble_symbol_counter = fmod((double)(d_sample_counter - d_preamble_index), 6000); //not corrected the preamble correlation lag! -> to be taken into account in TX Time if(d_dump == true) { @@ -350,6 +349,7 @@ void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite) DLOG(INFO) << "Navigation Satellite set to " << d_satellite; } + void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel) { d_channel = channel; @@ -362,7 +362,7 @@ void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel) { try { - d_dump_filename="telemetry"; + d_dump_filename = "telemetry"; d_dump_filename.append(boost::lexical_cast(d_channel)); d_dump_filename.append(".dat"); d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h index f43d27475..41d0e7825 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h @@ -56,81 +56,70 @@ gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long * \brief This class implements a block that decodes the NAV data defined in IS-GPS-200E * */ -class gps_l1_ca_telemetry_decoder_cc : public gr_block { - +class gps_l1_ca_telemetry_decoder_cc : public gr_block +{ public: - - ~gps_l1_ca_telemetry_decoder_cc(); - - void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN - void set_channel(int channel); //!< Set receiver's channel - - /*! - * \brief Set the navigation queue - */ - void set_navigation_queue(concurrent_queue *nav_queue){d_GPS_FSM.d_nav_queue=nav_queue;} - - int general_work (int noutput_items, gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - - void forecast (int noutput_items, gr_vector_int &ninput_items_required); - + ~gps_l1_ca_telemetry_decoder_cc(); + void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN + void set_channel(int channel); //!< Set receiver's channel + /*! + * \brief Set the navigation queue + */ + void set_navigation_queue(concurrent_queue *nav_queue){d_GPS_FSM.d_nav_queue=nav_queue;} + int general_work (int noutput_items, gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); + void forecast (int noutput_items, gr_vector_int &ninput_items_required); private: + friend gps_l1_ca_telemetry_decoder_cc_sptr + gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned + int vector_length, gr_msg_queue_sptr queue, bool dump); + gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned + int vector_length, gr_msg_queue_sptr queue, bool dump); + bool gps_word_parityCheck(unsigned int gpsword); - friend gps_l1_ca_telemetry_decoder_cc_sptr - gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, gr_msg_queue_sptr queue, bool dump); + // constants + unsigned short int d_preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS]; + // class private vars - gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned - int vector_length, gr_msg_queue_sptr queue, bool dump); + signed int *d_preambles_symbols; + unsigned int d_samples_per_bit; + long unsigned int d_sample_counter; + long unsigned int d_preamble_index; + unsigned int d_stat; + bool d_flag_frame_sync; - bool gps_word_parityCheck(unsigned int gpsword); + // symbols + double d_symbol_accumulator; + short int d_symbol_accumulator_counter; - // constants - unsigned short int d_preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS]; + //bits and frame + unsigned short int d_frame_bit_index; + unsigned int d_GPS_frame_4bytes; + unsigned int d_prev_GPS_frame_4bytes; + bool d_flag_parity; + bool d_flag_preamble; + int d_word_number; - // class private vars + long d_fs_in; + //double d_preamble_duration_seconds; + // navigation message vars + Gps_Navigation_Message d_nav; + GpsL1CaSubframeFsm d_GPS_FSM; - signed int *d_preambles_symbols; - unsigned int d_samples_per_bit; - long unsigned int d_sample_counter; - long unsigned int d_preamble_index; - unsigned int d_stat; - bool d_flag_frame_sync; + gr_msg_queue_sptr d_queue; + unsigned int d_vector_length; + bool d_dump; + Gnss_Satellite d_satellite; + int d_channel; - // symbols - double d_symbol_accumulator; - short int d_symbol_accumulator_counter; + //std::deque d_prn_start_sample_history; - //bits and frame - unsigned short int d_frame_bit_index; - unsigned int d_GPS_frame_4bytes; - unsigned int d_prev_GPS_frame_4bytes; - bool d_flag_parity; - bool d_flag_preamble; - int d_word_number; + double d_preamble_time_seconds; + double d_preamble_code_phase_seconds; - long d_fs_in; - //double d_preamble_duration_seconds; - // navigation message vars - Gps_Navigation_Message d_nav; - GpsL1CaSubframeFsm d_GPS_FSM; - - - gr_msg_queue_sptr d_queue; - unsigned int d_vector_length; - bool d_dump; - Gnss_Satellite d_satellite; - int d_channel; - - //std::deque d_prn_start_sample_history; - - double d_preamble_time_seconds; - double d_preamble_code_phase_seconds; - - std::string d_dump_filename; - std::ofstream d_dump_file; + std::string d_dump_filename; + std::ofstream d_dump_file; }; #endif diff --git a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc index 81dad1ee3..084f1d868 100644 --- a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc +++ b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.cc @@ -38,165 +38,189 @@ struct Ev_gps_word_invalid : sc::event{}; struct Ev_gps_word_preamble : sc::event{}; -struct gps_subframe_fsm_S0: public sc::state { +struct gps_subframe_fsm_S0: public sc::state +{ public: - // sc::transition(event,next_status) - typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions; - gps_subframe_fsm_S0(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S0 "< reactions; + gps_subframe_fsm_S0(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S0 "< { +struct gps_subframe_fsm_S1: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions; - gps_subframe_fsm_S1(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S1 "< { +struct gps_subframe_fsm_S2: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions; - gps_subframe_fsm_S2(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S2 "<().gps_word_to_subframe(0); - } + gps_subframe_fsm_S2(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S2 "<().gps_word_to_subframe(0); + } }; -struct gps_subframe_fsm_S3: public sc::state { +struct gps_subframe_fsm_S3: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions; - gps_subframe_fsm_S3(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S3 "<().gps_word_to_subframe(1); - } + gps_subframe_fsm_S3(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S3 "<().gps_word_to_subframe(1); + } }; -struct gps_subframe_fsm_S4: public sc::state { +struct gps_subframe_fsm_S4: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions; - gps_subframe_fsm_S4(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S4 "<().gps_word_to_subframe(2); - } + gps_subframe_fsm_S4(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S4 "<().gps_word_to_subframe(2); + } }; -struct gps_subframe_fsm_S5: public sc::state { +struct gps_subframe_fsm_S5: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions; - gps_subframe_fsm_S5(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S5 "<().gps_word_to_subframe(3); - } + gps_subframe_fsm_S5(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S5 "<().gps_word_to_subframe(3); + } }; -struct gps_subframe_fsm_S6: public sc::state { +struct gps_subframe_fsm_S6: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions; - gps_subframe_fsm_S6(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S6 "<().gps_word_to_subframe(4); - } + gps_subframe_fsm_S6(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S6 "<().gps_word_to_subframe(4); + } }; -struct gps_subframe_fsm_S7: public sc::state { +struct gps_subframe_fsm_S7: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions; - gps_subframe_fsm_S7(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S7 "<().gps_word_to_subframe(5); - } + gps_subframe_fsm_S7(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S7 "<().gps_word_to_subframe(5); + } }; -struct gps_subframe_fsm_S8: public sc::state { +struct gps_subframe_fsm_S8: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions; - gps_subframe_fsm_S8(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S8 "<().gps_word_to_subframe(6); - } + gps_subframe_fsm_S8(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S8 "<().gps_word_to_subframe(6); + } }; -struct gps_subframe_fsm_S9: public sc::state { +struct gps_subframe_fsm_S9: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions; - gps_subframe_fsm_S9(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S9 "<().gps_word_to_subframe(7); - } + gps_subframe_fsm_S9(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S9 "<().gps_word_to_subframe(7); + } }; -struct gps_subframe_fsm_S10: public sc::state { +struct gps_subframe_fsm_S10: public sc::state +{ public: - typedef mpl::list, - sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions; + typedef mpl::list, + sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions; - gps_subframe_fsm_S10(my_context ctx): my_base( ctx ){ - //std::cout<<"Enter S10 "<().gps_word_to_subframe(8); - } + gps_subframe_fsm_S10(my_context ctx): my_base( ctx ) + { + //std::cout<<"Enter S10 "<().gps_word_to_subframe(8); + } }; -struct gps_subframe_fsm_S11: public sc::state { +struct gps_subframe_fsm_S11: public sc::state +{ public: - typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions; + typedef sc::transition< Ev_gps_word_preamble, gps_subframe_fsm_S1 > reactions; - gps_subframe_fsm_S11(my_context ctx): my_base( ctx ){ - //std::cout<<"Completed GPS Subframe!"<().gps_word_to_subframe(9); - context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe - // DECODE SUBFRAME - //std::cout<<"Enter S11"<().gps_word_to_subframe(9); + context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe + // DECODE SUBFRAME + //std::cout<<"Enter S11"<d_preamble_time_ms; - d_nav.b_update_tow_flag=true; + d_nav.b_update_tow_flag = true; /*! * \todo change satellite validation to subframe 5 because it will have a complete set of ephemeris parameters */ diff --git a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h index ec30ba988..ce35703bf 100644 --- a/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h +++ b/src/algorithms/telemetry_decoder/libs/gps_l1_ca_subframe_fsm.h @@ -65,10 +65,7 @@ struct gps_subframe_fsm_S11; class GpsL1CaSubframeFsm : public sc::state_machine< GpsL1CaSubframeFsm, gps_subframe_fsm_S0 > { -private: - public: - // channel and satellite info int i_channel_ID; unsigned int i_satellite_PRN; diff --git a/src/core/interfaces/acquisition_interface.h b/src/core/interfaces/acquisition_interface.h index c86ced79b..0479db88a 100644 --- a/src/core/interfaces/acquisition_interface.h +++ b/src/core/interfaces/acquisition_interface.h @@ -12,7 +12,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -54,9 +54,8 @@ class AcquisitionInterface: public GNSSBlockInterface { public: - //virtual void set_active(bool active) = 0; - virtual void set_gnss_synchro(Gnss_Synchro* gnss_synchro) = 0; + virtual void set_gnss_synchro(Gnss_Synchro* gnss_synchro) = 0; virtual void set_channel(unsigned int channel) = 0; virtual void set_threshold(float threshold) = 0; virtual void set_doppler_max(unsigned int doppler_max) = 0; @@ -65,7 +64,6 @@ public: virtual void init() = 0; virtual signed int mag() = 0; virtual void reset() = 0; - }; #endif /* GNSS_SDR_ACQUISITION_INTERFACE */ diff --git a/src/core/interfaces/channel_interface.h b/src/core/interfaces/channel_interface.h index eb2a12b63..b03551bd7 100644 --- a/src/core/interfaces/channel_interface.h +++ b/src/core/interfaces/channel_interface.h @@ -11,7 +11,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -50,9 +50,7 @@ */ class ChannelInterface: public GNSSBlockInterface { - public: - virtual Gnss_Signal get_signal() const = 0; virtual void start_acquisition() = 0; virtual void set_signal(Gnss_Signal) = 0; diff --git a/src/core/interfaces/configuration_interface.h b/src/core/interfaces/configuration_interface.h index 4d3b25df1..15ab05aa4 100644 --- a/src/core/interfaces/configuration_interface.h +++ b/src/core/interfaces/configuration_interface.h @@ -9,7 +9,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -50,19 +50,14 @@ */ class ConfigurationInterface { - public: - virtual ~ConfigurationInterface() {} - - virtual std::string property(std::string property_name, - std::string default_value) = 0; + virtual std::string property(std::string property_name, std::string default_value) = 0; virtual bool property(std::string property_name, bool default_value) = 0; virtual long property(std::string property_name, long default_value) = 0; virtual int property(std::string property_name, int default_value) = 0; - virtual unsigned int property(std::string property_name, - unsigned int default_value) = 0; + virtual unsigned int property(std::string property_name, unsigned int default_value) = 0; virtual float property(std::string property_name, float default_value) = 0; virtual double property(std::string property_name, double default_value) = 0; virtual void set_property(std::string property_name, std::string value) = 0; diff --git a/src/core/interfaces/gnss_block_interface.h b/src/core/interfaces/gnss_block_interface.h index 5d397f008..7960d1c63 100644 --- a/src/core/interfaces/gnss_block_interface.h +++ b/src/core/interfaces/gnss_block_interface.h @@ -10,7 +10,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -51,11 +51,9 @@ */ class GNSSBlockInterface { - public: virtual ~GNSSBlockInterface() {} - virtual std::string role() = 0; virtual std::string implementation() = 0; virtual size_t item_size() = 0; diff --git a/src/core/interfaces/observables_interface.h b/src/core/interfaces/observables_interface.h index 70486cd73..9bc164296 100644 --- a/src/core/interfaces/observables_interface.h +++ b/src/core/interfaces/observables_interface.h @@ -10,7 +10,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -50,9 +50,7 @@ */ class ObservablesInterface : public GNSSBlockInterface { - public: - virtual void reset() = 0; }; diff --git a/src/core/interfaces/pvt_interface.h b/src/core/interfaces/pvt_interface.h index 4cb6cb1c4..9a88d0eab 100644 --- a/src/core/interfaces/pvt_interface.h +++ b/src/core/interfaces/pvt_interface.h @@ -10,7 +10,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -50,9 +50,7 @@ */ class PvtInterface : public GNSSBlockInterface { - public: - virtual void reset() = 0; }; diff --git a/src/core/interfaces/telemetry_decoder_interface.h b/src/core/interfaces/telemetry_decoder_interface.h index 97dbc1b31..2847423b0 100644 --- a/src/core/interfaces/telemetry_decoder_interface.h +++ b/src/core/interfaces/telemetry_decoder_interface.h @@ -10,7 +10,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -50,9 +50,7 @@ */ class TelemetryDecoderInterface : public GNSSBlockInterface { - public: - virtual void reset() = 0; virtual void set_satellite(Gnss_Satellite sat) = 0; virtual void set_channel(int channel) = 0; diff --git a/src/core/interfaces/tracking_interface.h b/src/core/interfaces/tracking_interface.h index 4936d9d17..87a9b5266 100644 --- a/src/core/interfaces/tracking_interface.h +++ b/src/core/interfaces/tracking_interface.h @@ -10,7 +10,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -53,14 +53,11 @@ templateclass concurrent_queue; */ class TrackingInterface : public GNSSBlockInterface { - public: - virtual void start_tracking() = 0; virtual void set_gnss_synchro(Gnss_Synchro* gnss_synchro) = 0; virtual void set_channel(unsigned int channel) = 0; virtual void set_channel_queue(concurrent_queue *channel_internal_queue) = 0; - }; #endif /* GNSS_SDR_TRACKING_INTERFACE_H_ */ diff --git a/src/core/receiver/control_message_factory.cc b/src/core/receiver/control_message_factory.cc index 777fdbf19..60e9db787 100644 --- a/src/core/receiver/control_message_factory.cc +++ b/src/core/receiver/control_message_factory.cc @@ -5,7 +5,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -44,8 +44,8 @@ ControlMessageFactory::ControlMessageFactory() ControlMessageFactory::~ControlMessageFactory() {} -gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigned int what) { - +gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigned int what) +{ ControlMessage *control_message = new ControlMessage; control_message->who = who; @@ -59,21 +59,22 @@ gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigne return queue_message; } -std::vector* ControlMessageFactory::GetControlMessages(gr_message_sptr queue_message) { - +std::vector* ControlMessageFactory::GetControlMessages(gr_message_sptr queue_message) +{ std::vector* control_messages = new std::vector(); unsigned int control_messages_count = queue_message->length() / sizeof(ControlMessage); - if(queue_message->length() % sizeof(ControlMessage) != 0) { + if(queue_message->length() % sizeof(ControlMessage) != 0) + { LOG_AT_LEVEL(WARNING) << "Queue message has size " << queue_message->length() << " which is not" << " multiple of control message size " << sizeof(ControlMessage); LOG_AT_LEVEL(WARNING) << "Ignoring this queue message to prevent unexpected results."; return control_messages; - } - for(unsigned int i=0;ipush_back(new ControlMessage); memcpy(control_messages->at(i), queue_message->msg() + (i*sizeof(ControlMessage)), sizeof(ControlMessage)); - } - + } return control_messages; } diff --git a/src/core/receiver/file_configuration.h b/src/core/receiver/file_configuration.h index d7310759f..649666dfc 100644 --- a/src/core/receiver/file_configuration.h +++ b/src/core/receiver/file_configuration.h @@ -9,7 +9,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -53,15 +53,13 @@ class InMemoryConfiguration; * The file is in the INI format, containing sections and pairs of names and values. * For more information about the INI format, see http://en.wikipedia.org/wiki/INI_file */ -class FileConfiguration : public ConfigurationInterface { - +class FileConfiguration : public ConfigurationInterface +{ public: FileConfiguration(std::string filename); FileConfiguration(); - //! Virtual destructor virtual ~FileConfiguration(); - std::string property(std::string property_name, std::string default_value); bool property(std::string property_name, bool default_value); long property(std::string property_name, long default_value); @@ -69,13 +67,9 @@ public: unsigned int property(std::string property_name, unsigned int default_value); float property(std::string property_name, float default_value); double property(std::string property_name, double default_value); - void set_property(std::string property_name, std::string value); - private: - void init(); - std::string filename_; INIReader *ini_reader_; InMemoryConfiguration* overrided_; diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index c59b82520..6a514551c 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -101,16 +101,14 @@ void GNSSFlowgraph::stop() { for (unsigned int i = 0; i < channels_count_; i++) { - // if(channels_state_[i]==2) channel(i)-> + // if(channels_state_[i]==2) channel(i)-> channel(i)->stop(); } - for (unsigned int i = 0; i < channels_count_; i++) { std::cout << "Channel " << i << " in state " << channels_state_[i] << std::endl; } - DLOG(INFO) << "Threads finished. Return to main program."; top_block_->stop(); running_ = false; @@ -596,16 +594,7 @@ void GNSSFlowgraph::set_signals_list() available_GNSS_signals_.remove(signal_value); available_GNSS_signals_.insert(gnss_it, signal_value); } - } - -// std::cout << "Signal queue: " << std::endl; -// Gnss_Signal aux_signal; -// for (std::list::iterator it = available_GNSS_signals_.begin(); it != available_GNSS_signals_.end(); it++) { -// aux_signal = *it; -// std::cout << aux_signal.get_satellite().get_system() << " " << aux_signal.get_signal() << " PRN " << aux_signal.get_satellite().get_PRN() << std::endl; -// } - } diff --git a/src/core/receiver/in_memory_configuration.h b/src/core/receiver/in_memory_configuration.h index e49ffd1c4..2bb2d3006 100644 --- a/src/core/receiver/in_memory_configuration.h +++ b/src/core/receiver/in_memory_configuration.h @@ -8,7 +8,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -50,11 +50,9 @@ class StringConverter; */ class InMemoryConfiguration : public ConfigurationInterface { - public: InMemoryConfiguration(); virtual ~InMemoryConfiguration(); - std::string property(std::string property_name, std::string default_value); bool property(std::string property_name, bool default_value); long property(std::string property_name, long default_value); @@ -62,13 +60,9 @@ public: unsigned int property(std::string property_name, unsigned int default_value); float property(std::string property_name, float default_value); double property(std::string property_name, double default_value); - void set_property(std::string property_name, std::string value); - bool is_present(std::string property_name); - private: - std::map properties_; StringConverter *converter_; }; diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 63e309412..50c8bf1e3 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -49,7 +49,7 @@ const double F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)] const double GPS_L1_FREQ_HZ = 1.57542e9; //!< L1 [Hz] const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s] const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips] -const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds] +const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds] /*! * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms diff --git a/src/core/system_parameters/Galileo_E1.h b/src/core/system_parameters/Galileo_E1.h index 24da6e272..855368710 100644 --- a/src/core/system_parameters/Galileo_E1.h +++ b/src/core/system_parameters/Galileo_E1.h @@ -28,8 +28,8 @@ * ------------------------------------------------------------------------- */ -#ifndef GALILEO_E1_H_ -#define GALILEO_E1_H_ +#ifndef GNSS_SDR_GALILEO_E1_H_ +#define GNSS_SDR_GALILEO_E1_H_ #include #include @@ -154,4 +154,4 @@ const std::string Galileo_E1_C_PRIMARY_CODE[Galileo_E1_NUMBER_OF_CODES] = { "CD7AAC98501F29507EA4E0183E8A40D2E5117E47BB5D18D01A3732DE4C821DFE86521CBEA7DB29BE1148BD544ECC681689BCD1B41EAF755310B7659342F8EE11CB41550CC30E566E192796B66C1A83C0B28BACCFA6C393043A0A2CB89712BC1CCB174DE58E66896AF39C1CEED1E05B0435F8CF6FD920D100F51584FE24879987399481DBF27DDB6286B6353919E552E669290CE02AB4CD5113D7F484229F379C7332767EC69E4336439B05DE1C1E3563DD303A4F580BFF20A40E49CB0822F715ED0221EBCDB5DBAD751124B1715E82F37488265135B6C8BBCF4F801ECC4D3525FF189493AD4EFF0C042B070C4CA8FB1FDF43D79F06A6E4E3D35D7B07D4B728D5DC54EEDACBBBA1EDDCDC07ADF7DFCFEF835E44DF1FF66DAF2A7BAEBE218AC3B15E183044D6A8A89B3C101B40BED97ED5DF93BBC1B84931D56B8C822A6D058AC74CFA4C85D8B456698E82D5B7574C17B041E5F4BEED09F75012355CBC322B822C63F10C18A8F279E9A0E18E1FEF183D23E13894E31F6D046956FE8A647558228F6D4D6910151EC03937876B6ED7A078D33DAEB3F2239353BB8181E62B286BBC41588DE10F478A5CE5B508F205A41820356767B0A0ED4B8DB9EFE348362E9A90D6C30218B295B338B51C09239D02FC8A1E7DAAAB60AC37F5E67CFC88EEF69567B5C81A03B449F4ED38B9D295A36AA3503173F6F6F66D93CE72D753076040FACDE", "ADDCEDB50E907D20E826E6E8A0D30C20C74B2DF204EA784BAE9F618CAE33A3C937729DF9CB10BA2A4C33E0182A37200C0CC509729D828B8A2A20F283AC4F9306596684EA3FB5492A4C9F2DB459E7531C9F9C0950E7D9E93B3EE5912AE7E39AC8F4EC14B18F24E325003F477E347C5AC1B67CDB11AF3BBBBCD0AC3703024B5767AA67A208254F798684BFD1D3EACD757EEC77254950A146620400DB95E694574F739A991EBA771EBBDFF1056BB39A77DBE0636A032E17141332F951C57C6C90F348F165E3ABDD60D429D5D6BEC7E3E3463806F819EB2D212B3528A5EDE51F235AD100A35E890955F8A1DC51FDCB53EABCA2540997DD054C1F5B29462995B876B44D085904E55E1B838BEF600A992EB49CE078DF75AF3D0F137685AC0D07F0BE1EB87B63A41E74DDE869C8A683BDE60AF5D77FF18F7137495BCEFD0ED28F62F9C3E25D332B5F861D999FCDC0B4851A984A4DBB53401FD40351ADA4335C702BCC8D900C737507B990BDDBE91D201E3A0946DC968D43FD10D04B0B76667FF5B4291C2124B0124C6B710A6D1BCFAEB016B9DEEB0F7A4FE044CA4EA0CCD84B7682617C3A545071EC295B0663B3F577D562DE1D9DD80DE6A1EFD6D5991EB5246F1597B86D0E9A90CF6DB0EB2B8E7BAE9431E567F01AA98502C773742246467ABF911A91A51F6C1B9E0C3233DC1A37D17DB91A5F0F661B0EB5886964456C7818601BD0C" }; -#endif /* GALILEO_E1_H_ */ +#endif /* GNSS_SDR_GALILEO_E1_H_ */ diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index d76d2780e..6334d7abc 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -39,7 +39,6 @@ void Gps_Navigation_Message::reset() { - b_update_tow_flag=false; b_valid_ephemeris_set_flag=false; d_TOW=0; @@ -209,7 +208,6 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset { value = false; } - return value; } @@ -219,9 +217,7 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const bits_slice *slices, int num_of_slices) { - unsigned long int value; - - value = 0; + unsigned long int value = 0; for (int i=0; i