code cleaning

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@262 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-10-28 10:56:04 +00:00
parent fb0b2b8b33
commit ae4a867249
34 changed files with 390 additions and 486 deletions

View File

@ -47,29 +47,30 @@ SignalConditioner::SignalConditioner(ConfigurationInterface *configuration,
GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt, GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt,
GNSSBlockInterface *res, std::string role, std::string implementation, GNSSBlockInterface *res, std::string role, std::string implementation,
gr_msg_queue_sptr queue) : data_type_adapt_(data_type_adapt), gr_msg_queue_sptr queue) : data_type_adapt_(data_type_adapt),
in_filt_(in_filt), res_(res), role_(role), implementation_(implementation), in_filt_(in_filt), res_(res), role_(role), implementation_(implementation),
queue_(queue) queue_(queue)
{ {
connected_ = false; connected_ = false;
} }
// Destructor // Destructor
SignalConditioner::~SignalConditioner() SignalConditioner::~SignalConditioner()
{ {
delete data_type_adapt_; delete data_type_adapt_;
delete in_filt_; delete in_filt_;
delete res_; delete res_;
} }
void SignalConditioner::connect(gr_top_block_sptr top_block) void SignalConditioner::connect(gr_top_block_sptr top_block)
{ {
if (connected_) if (connected_)
{ {
LOG_AT_LEVEL(WARNING) << "Signal conditioner already connected internally"; LOG_AT_LEVEL(WARNING) << "Signal conditioner already connected internally";
return; return;
} }
data_type_adapt_->connect(top_block); data_type_adapt_->connect(top_block);
in_filt_->connect(top_block); in_filt_->connect(top_block);
res_->connect(top_block); res_->connect(top_block);
@ -85,9 +86,10 @@ void SignalConditioner::connect(gr_top_block_sptr top_block)
connected_ = true; connected_ = true;
} }
void SignalConditioner::disconnect(gr_top_block_sptr top_block) void SignalConditioner::disconnect(gr_top_block_sptr top_block)
{ {
if (!connected_) if (!connected_)
{ {
LOG_AT_LEVEL(WARNING) << "Signal conditioner already disconnected internally"; LOG_AT_LEVEL(WARNING) << "Signal conditioner already disconnected internally";
@ -106,6 +108,7 @@ void SignalConditioner::disconnect(gr_top_block_sptr top_block)
connected_ = false; connected_ = false;
} }
gr_basic_block_sptr SignalConditioner::get_left_block() gr_basic_block_sptr SignalConditioner::get_left_block()
{ {
return data_type_adapt_->get_left_block(); return data_type_adapt_->get_left_block();

View File

@ -36,8 +36,6 @@
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include "control_message_factory.h" #include "control_message_factory.h"
//#include "gnss_signal.h"
//#include "gnss_synchro.h"
class ConfigurationInterface; class ConfigurationInterface;
@ -51,10 +49,9 @@ class TelemetryDecoderInterface;
*/ */
class SignalConditioner: public GNSSBlockInterface class SignalConditioner: public GNSSBlockInterface
{ {
public: public:
//! Constructor //! Constructor
SignalConditioner(ConfigurationInterface *configuration, SignalConditioner(ConfigurationInterface *configuration,
GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt, GNSSBlockInterface *data_type_adapt, GNSSBlockInterface *in_filt,
GNSSBlockInterface *res, std::string role, std::string implementation, GNSSBlockInterface *res, std::string role, std::string implementation,
gr_msg_queue_sptr queue); gr_msg_queue_sptr queue);
@ -68,34 +65,22 @@ public:
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
std::string role(){ return role_; } std::string role(){ return role_; }
std::string implementation(){ return "Signal_Conditioner"; } std::string implementation(){ return "Signal_Conditioner"; }
size_t item_size(){ return 0; } size_t item_size(){ return 0; }
GNSSBlockInterface *data_type_adapter(){ return data_type_adapt_; } GNSSBlockInterface *data_type_adapter(){ return data_type_adapt_; }
GNSSBlockInterface *input_filter(){ return in_filt_; } GNSSBlockInterface *input_filter(){ return in_filt_; }
GNSSBlockInterface *resampler(){ return res_; } GNSSBlockInterface *resampler(){ return res_; }
private: private:
GNSSBlockInterface *data_type_adapt_; GNSSBlockInterface *data_type_adapt_;
GNSSBlockInterface *in_filt_; GNSSBlockInterface *in_filt_;
GNSSBlockInterface *res_; GNSSBlockInterface *res_;
std::string role_; std::string role_;
std::string implementation_; std::string implementation_;
bool connected_; bool connected_;
//bool stop_; //bool stop_;
gr_msg_queue_sptr queue_; gr_msg_queue_sptr queue_;
}; };
#endif /*GNSS_SDR_SIGNAL_CONDITIONER_H_*/ #endif /*GNSS_SDR_SIGNAL_CONDITIONER_H_*/

View File

@ -41,8 +41,8 @@ using google::LogMessage;
IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::string role, IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams, unsigned int in_streams, unsigned int out_streams,
gr_msg_queue_sptr queue) : gr_msg_queue_sptr queue) :
config_(configuration), role_(role), in_streams_(in_streams), config_(configuration), role_(role), in_streams_(in_streams),
out_streams_(out_streams), queue_(queue) out_streams_(out_streams), queue_(queue)
{ {
std::string default_input_item_type = "gr_complex"; std::string default_input_item_type = "gr_complex";
@ -71,12 +71,13 @@ IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::str
} }
IshortToComplex::~IshortToComplex() IshortToComplex::~IshortToComplex()
{} {}
void IshortToComplex::connect(gr_top_block_sptr top_block) void IshortToComplex::connect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
{ {
top_block->connect(gr_interleaved_short_to_complex_, 0, file_sink_, 0); 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) void IshortToComplex::disconnect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
{ {
top_block->connect(gr_interleaved_short_to_complex_, 0, file_sink_, 0); top_block->connect(gr_interleaved_short_to_complex_, 0, file_sink_, 0);
} }
} }
gr_basic_block_sptr IshortToComplex::get_left_block() gr_basic_block_sptr IshortToComplex::get_left_block()
{ {
return gr_interleaved_short_to_complex_; return gr_interleaved_short_to_complex_;
} }
gr_basic_block_sptr IshortToComplex::get_right_block() gr_basic_block_sptr IshortToComplex::get_right_block()
{ {
return gr_interleaved_short_to_complex_; return gr_interleaved_short_to_complex_;

View File

@ -44,10 +44,8 @@ class ConfigurationInterface;
*/ */
class IshortToComplex: public GNSSBlockInterface class IshortToComplex: public GNSSBlockInterface
{ {
public: public:
IshortToComplex(ConfigurationInterface* configuration,
IshortToComplex(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, std::string role, unsigned int in_streams,
unsigned int out_streams, gr_msg_queue_sptr queue); 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_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
gr_interleaved_short_to_complex_sptr gr_interleaved_short_to_complex_; gr_interleaved_short_to_complex_sptr gr_interleaved_short_to_complex_;
ConfigurationInterface* config_; ConfigurationInterface* config_;
bool dump_; bool dump_;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -46,7 +46,6 @@ class ConfigurationInterface;
*/ */
class FileOutputFilter : public GNSSBlockInterface class FileOutputFilter : public GNSSBlockInterface
{ {
public: public:
FileOutputFilter(ConfigurationInterface* configuration, FileOutputFilter(ConfigurationInterface* configuration,
std::string role, std::string role,
@ -54,7 +53,6 @@ public:
unsigned int out_streams); unsigned int out_streams);
virtual ~FileOutputFilter(); virtual ~FileOutputFilter();
std::string role() std::string role()
{ {
return role_; return role_;
@ -67,14 +65,12 @@ public:
{ {
return item_size_; return item_size_;
} }
void connect(gr_top_block_sptr top_block); void connect(gr_top_block_sptr top_block);
void disconnect(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_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
gr_file_sink_sptr file_sink_; gr_file_sink_sptr file_sink_;
size_t item_size_; size_t item_size_;
std::string filename_; std::string filename_;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -47,7 +47,6 @@ class ConfigurationInterface;
*/ */
class NullSinkOutputFilter : public GNSSBlockInterface class NullSinkOutputFilter : public GNSSBlockInterface
{ {
public: public:
NullSinkOutputFilter(ConfigurationInterface* configuration, NullSinkOutputFilter(ConfigurationInterface* configuration,
std::string role, std::string role,
@ -55,7 +54,6 @@ public:
unsigned int out_streams); unsigned int out_streams);
virtual ~NullSinkOutputFilter(); virtual ~NullSinkOutputFilter();
std::string item_type() std::string item_type()
{ {
return item_type_; return item_type_;
@ -72,20 +70,16 @@ public:
{ {
return item_size_; return item_size_;
} }
void connect(gr_top_block_sptr top_block); void connect(gr_top_block_sptr top_block);
void disconnect(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_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
gr_block_sptr sink_; gr_block_sptr sink_;
size_t item_size_; size_t item_size_;
std::string item_type_; std::string item_type_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
}; };

View File

@ -44,10 +44,8 @@ DirectResamplerConditioner::DirectResamplerConditioner(
unsigned int in_stream, unsigned int out_stream) : unsigned int in_stream, unsigned int out_stream) :
role_(role), in_stream_(in_stream), out_stream_(out_stream) role_(role), in_stream_(in_stream), out_stream_(out_stream)
{ {
std::string default_item_type = "short"; std::string default_item_type = "short";
std::string default_dump_file = "./data/signal_conditioner.dat"; std::string default_dump_file = "./data/signal_conditioner.dat";
sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", sample_freq_in_ = configuration->property(role_ + ".sample_freq_in",
(double)4000000.0); (double)4000000.0);
sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", sample_freq_out_ = configuration->property(role_ + ".sample_freq_out",
@ -70,32 +68,33 @@ DirectResamplerConditioner::DirectResamplerConditioner(
DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")"; DLOG(INFO) << "resampler(" << resampler_->unique_id() << ")";
} }
// else if (item_type_.compare("short") == 0) // else if (item_type_.compare("short") == 0)
// { // {
// item_size_ = sizeof(short); // item_size_ = sizeof(short);
// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_, // resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
// sample_freq_out_); // sample_freq_out_);
// } // }
else else
{ {
LOG_AT_LEVEL(WARNING) << item_type_ LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type for resampler"; << " unrecognized item type for resampler";
item_size_ = sizeof(short); item_size_ = sizeof(short);
} }
if (dump_) if (dump_)
{ {
DLOG(INFO) << "Dumping output into file " << dump_filename_; DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
} }
} }
DirectResamplerConditioner::~DirectResamplerConditioner() {} DirectResamplerConditioner::~DirectResamplerConditioner() {}
void DirectResamplerConditioner::connect(gr_top_block_sptr top_block) void DirectResamplerConditioner::connect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
{ {
top_block->connect(resampler_, 0, file_sink_, 0); 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"; DLOG(INFO) << "nothing to connect internally";
} }
} }
void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block) void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
@ -116,11 +115,13 @@ void DirectResamplerConditioner::disconnect(gr_top_block_sptr top_block)
} }
} }
gr_basic_block_sptr DirectResamplerConditioner::get_left_block() gr_basic_block_sptr DirectResamplerConditioner::get_left_block()
{ {
return resampler_; return resampler_;
} }
gr_basic_block_sptr DirectResamplerConditioner::get_right_block() gr_basic_block_sptr DirectResamplerConditioner::get_right_block()
{ {
return resampler_; return resampler_;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -40,14 +40,12 @@ class ConfigurationInterface;
class DirectResamplerConditioner: public GNSSBlockInterface class DirectResamplerConditioner: public GNSSBlockInterface
{ {
public: public:
DirectResamplerConditioner(ConfigurationInterface* configuration, DirectResamplerConditioner(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, std::string role, unsigned int in_stream,
unsigned int out_stream); unsigned int out_stream);
virtual ~DirectResamplerConditioner(); virtual ~DirectResamplerConditioner();
std::string role() std::string role()
{ {
return role_; return role_;
@ -60,14 +58,12 @@ public:
{ {
return item_size_; return item_size_;
} }
void connect(gr_top_block_sptr top_block); void connect(gr_top_block_sptr top_block);
void disconnect(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_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
std::string role_; std::string role_;
unsigned int in_stream_; unsigned int in_stream_;
unsigned int out_stream_; unsigned int out_stream_;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -46,58 +46,62 @@ direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
return direct_resampler_conditioner_cc_sptr( return direct_resampler_conditioner_cc_sptr(
new direct_resampler_conditioner_cc(sample_freq_in, new direct_resampler_conditioner_cc(sample_freq_in,
sample_freq_out)); sample_freq_out));
} }
direct_resampler_conditioner_cc::direct_resampler_conditioner_cc( direct_resampler_conditioner_cc::direct_resampler_conditioner_cc(
double sample_freq_in, double sample_freq_out) : double sample_freq_in, double sample_freq_out) :
gr_block("direct_resampler_conditioner_cc", gr_make_io_signature(1, 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)), gr_make_io_signature(1, 1,
sizeof(gr_complex))), d_sample_freq_in(sample_freq_in), sizeof(gr_complex))), d_sample_freq_in(sample_freq_in),
d_sample_freq_out(sample_freq_out), d_phase(0), d_lphase(0), d_sample_freq_out(sample_freq_out), d_phase(0), d_lphase(0),
d_history(1) d_history(1)
{ {
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
if (d_sample_freq_in >= d_sample_freq_out) if (d_sample_freq_in >= d_sample_freq_out)
{ {
d_phase_step = (unsigned int)floor((double)4294967296.0 d_phase_step = (unsigned int)floor((double)4294967296.0
* sample_freq_out / sample_freq_in); * sample_freq_out / sample_freq_in);
} }
else else
{ {
d_phase_step = (unsigned int)floor((double)4294967296.0 d_phase_step = (unsigned int)floor((double)4294967296.0
* sample_freq_in / sample_freq_out); * sample_freq_in / sample_freq_out);
} }
set_relative_rate(1.0 * sample_freq_out / sample_freq_in); set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
set_output_multiple(1); set_output_multiple(1);
} }
direct_resampler_conditioner_cc::~direct_resampler_conditioner_cc() direct_resampler_conditioner_cc::~direct_resampler_conditioner_cc()
{ {
} }
void direct_resampler_conditioner_cc::forecast(int noutput_items, void direct_resampler_conditioner_cc::forecast(int noutput_items,
gr_vector_int &ninput_items_required) gr_vector_int &ninput_items_required)
{ {
int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1) int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1)
* sample_freq_in() / sample_freq_out()) + history() - 1); * sample_freq_in() / sample_freq_out()) + history() - 1);
unsigned ninputs = ninput_items_required.size(); unsigned ninputs = ninput_items_required.size();
for (unsigned i = 0; i < ninputs; i++) for (unsigned i = 0; i < ninputs; i++)
{ {
ninput_items_required[i] = nreqd; ninput_items_required[i] = nreqd;
} }
} }
int direct_resampler_conditioner_cc::general_work(int noutput_items, int direct_resampler_conditioner_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items) gr_vector_void_star &output_items)
{ {
const gr_complex *in = (const gr_complex *)input_items[0]; const gr_complex *in = (const gr_complex *)input_items[0];
gr_complex *out = (gr_complex *)output_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; int count = 0;
if (d_sample_freq_in >= d_sample_freq_out) if (d_sample_freq_in >= d_sample_freq_out)
{
while ((lcv < noutput_items))
{ {
if (d_phase <= d_lphase) while ((lcv < noutput_items))
{ {
out[lcv] = *in; if (d_phase <= d_lphase)
lcv++; {
} out[lcv] = *in;
lcv++;
d_lphase = d_phase; }
d_phase += d_phase_step; d_lphase = d_phase;
in++; d_phase += d_phase_step;
count++; in++;
count++;
}
} }
}
else else
{
while ((lcv < noutput_items))
{ {
d_lphase = d_phase; while ((lcv < noutput_items))
d_phase += d_phase_step; {
if (d_phase <= d_lphase) d_lphase = d_phase;
{ d_phase += d_phase_step;
in++; if (d_phase <= d_lphase)
count++; {
} in++;
out[lcv] = *in; count++;
lcv++; }
out[lcv] = *in;
lcv++;
}
} }
}
consume_each(std::min(count, ninput_items[0])); consume_each(std::min(count, ninput_items[0]));
return lcv; return lcv;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -42,8 +42,7 @@
#include <gnuradio/gr_block.h> #include <gnuradio/gr_block.h>
class direct_resampler_conditioner_cc; class direct_resampler_conditioner_cc;
typedef boost::shared_ptr<direct_resampler_conditioner_cc> typedef boost::shared_ptr<direct_resampler_conditioner_cc> direct_resampler_conditioner_cc_sptr;
direct_resampler_conditioner_cc_sptr;
direct_resampler_conditioner_cc_sptr direct_resampler_conditioner_cc_sptr
direct_resampler_make_conditioner_cc(double sample_freq_in, direct_resampler_make_conditioner_cc(double sample_freq_in,
double sample_freq_out); 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 class direct_resampler_conditioner_cc: public gr_block
{ {
private: private:
friend direct_resampler_conditioner_cc_sptr friend direct_resampler_conditioner_cc_sptr
direct_resampler_make_conditioner_cc(double sample_freq_in, direct_resampler_make_conditioner_cc(double sample_freq_in,
double sample_freq_out); double sample_freq_out);
double d_sample_freq_in; //! Specifies the sampling frequency of the input signal 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 double d_sample_freq_out; //! Specifies the sampling frequency of the output signal
unsigned int d_phase; unsigned int d_phase;
unsigned int d_lphase; unsigned int d_lphase;
unsigned int d_phase_step; unsigned int d_phase_step;
unsigned int d_history; unsigned int d_history;
direct_resampler_conditioner_cc(double sample_freq_in, direct_resampler_conditioner_cc(double sample_freq_in,
double sample_freq_out); double sample_freq_out);
public: public:
~direct_resampler_conditioner_cc(); ~direct_resampler_conditioner_cc();
unsigned int sample_freq_in() const unsigned int sample_freq_in() const
{ {
return d_sample_freq_in; return d_sample_freq_in;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -49,14 +49,12 @@ class ConfigurationInterface;
*/ */
class FileSignalSource: public GNSSBlockInterface class FileSignalSource: public GNSSBlockInterface
{ {
public: public:
FileSignalSource(ConfigurationInterface* configuration, std::string role, FileSignalSource(ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams, unsigned int in_streams, unsigned int out_streams,
gr_msg_queue_sptr queue); gr_msg_queue_sptr queue);
virtual ~FileSignalSource(); virtual ~FileSignalSource();
std::string role() std::string role()
{ {
return role_; return role_;
@ -69,12 +67,10 @@ public:
{ {
return item_size_; return item_size_;
} }
void connect(gr_top_block_sptr top_block); void connect(gr_top_block_sptr top_block);
void disconnect(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_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
std::string filename() std::string filename()
{ {
return filename_; return filename_;
@ -97,7 +93,6 @@ public:
} }
private: private:
long samples_; long samples_;
long sampling_frequency_; long sampling_frequency_;
std::string filename_; std::string filename_;
@ -105,20 +100,15 @@ private:
bool repeat_; bool repeat_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;
gr_file_source_sptr file_source_; gr_file_source_sptr file_source_;
gr_block_sptr valve_; gr_block_sptr valve_;
gr_block_sptr sink_; gr_block_sptr sink_;
gr_block_sptr throttle_; gr_block_sptr throttle_;
gr_msg_queue_sptr queue_; gr_msg_queue_sptr queue_;
size_t item_size_; size_t item_size_;
// Throttle control // Throttle control
bool enable_throttle_control_; bool enable_throttle_control_;
}; };

View File

@ -39,13 +39,11 @@
using google::LogMessage; using google::LogMessage;
Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, 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) role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
{ {
std::string default_item_type = "short"; std::string default_item_type = "short";
std::string default_dump_file = "./data/gn3s_source.dat"; std::string default_dump_file = "./data/gn3s_source.dat";
item_type_ = configuration->property(role + ".item_type", item_type_ = configuration->property(role + ".item_type",
default_item_type); default_item_type);
dump_ = configuration->property(role + ".dump", false); dump_ = configuration->property(role + ".dump", false);
@ -60,38 +58,38 @@ Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration,
DLOG(INFO) << "gn3s_source(" << gn3s_source_->unique_id() << ")"; DLOG(INFO) << "gn3s_source(" << gn3s_source_->unique_id() << ")";
} }
// else if (item_type_.compare("short") == 0) // else if (item_type_.compare("short") == 0)
// { // {
// item_size_ = sizeof(short); // item_size_ = sizeof(short);
// resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_, // resampler_ = direct_resampler_make_conditioner_ss(sample_freq_in_,
// sample_freq_out_); // sample_freq_out_);
// } // }
else else
{ {
LOG_AT_LEVEL(WARNING) << item_type_ LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type for resampler"; << " unrecognized item type for resampler";
item_size_ = sizeof(short); item_size_ = sizeof(short);
} }
if (dump_) if (dump_)
{ {
DLOG(INFO) << "Dumping output into file " << dump_filename_; DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
} }
if (dump_) if (dump_)
{ {
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
} }
} }
Gn3sSignalSource::~Gn3sSignalSource() Gn3sSignalSource::~Gn3sSignalSource()
{ {}
}
void Gn3sSignalSource::connect(gr_top_block_sptr top_block) void Gn3sSignalSource::connect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
{ {
top_block->connect(gn3s_source_, 0, file_sink_, 0); 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"; DLOG(INFO) << "nothing to connect internally";
} }
} }
void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block) void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block)
{ {
if (dump_) if (dump_)
@ -112,13 +111,14 @@ void Gn3sSignalSource::disconnect(gr_top_block_sptr top_block)
} }
} }
gr_basic_block_sptr Gn3sSignalSource::get_left_block() gr_basic_block_sptr Gn3sSignalSource::get_left_block()
{ {
LOG_AT_LEVEL(WARNING) LOG_AT_LEVEL(WARNING) << "Left block of a signal source should not be retrieved";
<< "Left block of a signal source should not be retrieved";
return gr_block_sptr(); return gr_block_sptr();
} }
gr_basic_block_sptr Gn3sSignalSource::get_right_block() gr_basic_block_sptr Gn3sSignalSource::get_right_block()
{ {
return gn3s_source_; return gn3s_source_;

View File

@ -40,14 +40,12 @@ class ConfigurationInterface;
class Gn3sSignalSource: public GNSSBlockInterface class Gn3sSignalSource: public GNSSBlockInterface
{ {
public: public:
Gn3sSignalSource(ConfigurationInterface* configuration, Gn3sSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, std::string role, unsigned int in_stream,
unsigned int out_stream, gr_msg_queue_sptr queue); unsigned int out_stream, gr_msg_queue_sptr queue);
virtual ~Gn3sSignalSource(); virtual ~Gn3sSignalSource();
std::string role() std::string role()
{ {
return role_; return role_;
@ -60,14 +58,12 @@ public:
{ {
return item_size_; return item_size_;
} }
void connect(gr_top_block_sptr top_block); void connect(gr_top_block_sptr top_block);
void disconnect(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_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
std::string role_; std::string role_;
unsigned int in_stream_; unsigned int in_stream_;
unsigned int out_stream_; unsigned int out_stream_;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -44,9 +44,7 @@ class ConfigurationInterface;
*/ */
class GpsL1CaTelemetryDecoder : public TelemetryDecoderInterface class GpsL1CaTelemetryDecoder : public TelemetryDecoderInterface
{ {
public: public:
GpsL1CaTelemetryDecoder(ConfigurationInterface* configuration, GpsL1CaTelemetryDecoder(ConfigurationInterface* configuration,
std::string role, std::string role,
unsigned int in_streams, unsigned int in_streams,
@ -54,7 +52,6 @@ public:
gr_msg_queue_sptr queue); gr_msg_queue_sptr queue);
virtual ~GpsL1CaTelemetryDecoder(); virtual ~GpsL1CaTelemetryDecoder();
std::string role() std::string role()
{ {
return role_; return role_;
@ -63,36 +60,29 @@ public:
{ {
return "GPS_L1_CA_Telemetry_Decoder"; return "GPS_L1_CA_Telemetry_Decoder";
} }
void connect(gr_top_block_sptr top_block); void connect(gr_top_block_sptr top_block);
void disconnect(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_left_block();
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
void set_satellite(Gnss_Satellite satellite); void set_satellite(Gnss_Satellite satellite);
void set_channel(int channel){telemetry_decoder_->set_channel(channel);}; void set_channel(int channel){telemetry_decoder_->set_channel(channel);};
void reset() void reset()
{ {
return; return;
}; };
size_t item_size() size_t item_size()
{ {
return 0; return 0;
} }
private: private:
gps_l1_ca_telemetry_decoder_cc_sptr telemetry_decoder_; gps_l1_ca_telemetry_decoder_cc_sptr telemetry_decoder_;
Gnss_Satellite satellite_; Gnss_Satellite satellite_;
int channel_; int channel_;
unsigned int vector_length_; unsigned int vector_length_;
std::string item_type_; std::string item_type_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;
std::string role_; std::string role_;
unsigned int in_streams_; unsigned int in_streams_;
unsigned int out_streams_; unsigned int out_streams_;

View File

@ -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 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) 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, return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, if_freq,
fs_in, vector_length, queue, dump)); 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++) 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( gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
Gnss_Satellite satellite, Gnss_Satellite satellite,
long if_freq, long if_freq,
long fs_in, long fs_in,
unsigned unsigned
int vector_length, int vector_length,
gr_msg_queue_sptr queue, gr_msg_queue_sptr queue,
bool dump) : bool dump) :
gr_block ("gps_navigation_cc", gr_make_io_signature (1, 1, sizeof(Gnss_Synchro)), 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 // initialize internal vars
d_queue = queue; 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) gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{ {
int corr_value = 0; int corr_value = 0;
int preamble_diff=0; int preamble_diff = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
d_sample_counter++; //count for the processed samples 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; d_flag_preamble=false;
//******* frame sync ****************** //******* frame sync ******************
if (abs(corr_value)>=160) if (abs(corr_value) >= 160)
{ {
//TODO: Rewrite with state machine //TODO: Rewrite with state machine
if (d_stat == 0) 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 //1. Copy the current tracking output
current_synchro_data=in[0][0]; current_synchro_data=in[0][0];
//2. Add the telemetry decoder information //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_valid_word = (d_flag_frame_sync == true and d_flag_parity == true);
current_synchro_data.Flag_preamble= d_flag_preamble; current_synchro_data.Flag_preamble = d_flag_preamble;
current_synchro_data.Preamble_timestamp_ms= d_preamble_time_seconds*1000.0; 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.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.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) 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; DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
} }
void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel) void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel)
{ {
d_channel = channel; d_channel = channel;
@ -362,7 +362,7 @@ void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel)
{ {
try try
{ {
d_dump_filename="telemetry"; d_dump_filename = "telemetry";
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel)); d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat"); d_dump_filename.append(".dat");
d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit );

View File

@ -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 * \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: public:
~gps_l1_ca_telemetry_decoder_cc();
~gps_l1_ca_telemetry_decoder_cc(); void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel
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<Gps_Navigation_Message> *nav_queue){d_GPS_FSM.d_nav_queue=nav_queue;}
* \brief Set the navigation 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 set_navigation_queue(concurrent_queue<Gps_Navigation_Message> *nav_queue){d_GPS_FSM.d_nav_queue=nav_queue;} void forecast (int noutput_items, gr_vector_int &ninput_items_required);
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: 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 // constants
gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned unsigned short int d_preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS];
int vector_length, gr_msg_queue_sptr queue, bool dump); // class private vars
gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, long fs_in,unsigned signed int *d_preambles_symbols;
int vector_length, gr_msg_queue_sptr queue, bool dump); 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 //bits and frame
unsigned short int d_preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS]; 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; gr_msg_queue_sptr d_queue;
unsigned int d_samples_per_bit; unsigned int d_vector_length;
long unsigned int d_sample_counter; bool d_dump;
long unsigned int d_preamble_index; Gnss_Satellite d_satellite;
unsigned int d_stat; int d_channel;
bool d_flag_frame_sync;
// symbols //std::deque<double> d_prn_start_sample_history;
double d_symbol_accumulator;
short int d_symbol_accumulator_counter;
//bits and frame double d_preamble_time_seconds;
unsigned short int d_frame_bit_index; double d_preamble_code_phase_seconds;
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;
long d_fs_in; std::string d_dump_filename;
//double d_preamble_duration_seconds; std::ofstream d_dump_file;
// 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<double> 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;
}; };
#endif #endif

View File

@ -38,165 +38,189 @@ struct Ev_gps_word_invalid : sc::event<Ev_gps_word_invalid>{};
struct Ev_gps_word_preamble : sc::event<Ev_gps_word_preamble>{}; struct Ev_gps_word_preamble : sc::event<Ev_gps_word_preamble>{};
struct gps_subframe_fsm_S0: public sc::state<gps_subframe_fsm_S0, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S0: public sc::state<gps_subframe_fsm_S0, GpsL1CaSubframeFsm>
{
public: public:
// sc::transition(event,next_status) // sc::transition(event,next_status)
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_S0(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S0(my_context ctx): my_base( ctx )
//std::cout<<"Enter S0 "<<std::endl; {
} //std::cout<<"Enter S0 "<<std::endl;
}
}; };
struct gps_subframe_fsm_S1: public sc::state<gps_subframe_fsm_S1, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S1: public sc::state<gps_subframe_fsm_S1, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions;
gps_subframe_fsm_S1(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S1(my_context ctx): my_base( ctx )
//std::cout<<"Enter S1 "<<std::endl; {
} //std::cout<<"Enter S1 "<<std::endl;
}
}; };
struct gps_subframe_fsm_S2: public sc::state<gps_subframe_fsm_S2, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S2: public sc::state<gps_subframe_fsm_S2, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions;
gps_subframe_fsm_S2(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S2(my_context ctx): my_base( ctx )
//std::cout<<"Enter S2 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(0); //std::cout<<"Enter S2 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(0);
}
}; };
struct gps_subframe_fsm_S3: public sc::state<gps_subframe_fsm_S3, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S3: public sc::state<gps_subframe_fsm_S3, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions;
gps_subframe_fsm_S3(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S3(my_context ctx): my_base( ctx )
//std::cout<<"Enter S3 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(1); //std::cout<<"Enter S3 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(1);
}
}; };
struct gps_subframe_fsm_S4: public sc::state<gps_subframe_fsm_S4, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S4: public sc::state<gps_subframe_fsm_S4, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions;
gps_subframe_fsm_S4(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S4(my_context ctx): my_base( ctx )
//std::cout<<"Enter S4 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(2); //std::cout<<"Enter S4 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(2);
}
}; };
struct gps_subframe_fsm_S5: public sc::state<gps_subframe_fsm_S5, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S5: public sc::state<gps_subframe_fsm_S5, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions;
gps_subframe_fsm_S5(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S5(my_context ctx): my_base( ctx )
//std::cout<<"Enter S5 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(3); //std::cout<<"Enter S5 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(3);
}
}; };
struct gps_subframe_fsm_S6: public sc::state<gps_subframe_fsm_S6, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S6: public sc::state<gps_subframe_fsm_S6, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions;
gps_subframe_fsm_S6(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S6(my_context ctx): my_base( ctx )
//std::cout<<"Enter S6 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(4); //std::cout<<"Enter S6 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(4);
}
}; };
struct gps_subframe_fsm_S7: public sc::state<gps_subframe_fsm_S7, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S7: public sc::state<gps_subframe_fsm_S7, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions;
gps_subframe_fsm_S7(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S7(my_context ctx): my_base( ctx )
//std::cout<<"Enter S7 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(5); //std::cout<<"Enter S7 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(5);
}
}; };
struct gps_subframe_fsm_S8: public sc::state<gps_subframe_fsm_S8, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S8: public sc::state<gps_subframe_fsm_S8, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions;
gps_subframe_fsm_S8(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S8(my_context ctx): my_base( ctx )
//std::cout<<"Enter S8 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(6); //std::cout<<"Enter S8 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(6);
}
}; };
struct gps_subframe_fsm_S9: public sc::state<gps_subframe_fsm_S9, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S9: public sc::state<gps_subframe_fsm_S9, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions;
gps_subframe_fsm_S9(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S9(my_context ctx): my_base( ctx )
//std::cout<<"Enter S9 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(7); //std::cout<<"Enter S9 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(7);
}
}; };
struct gps_subframe_fsm_S10: public sc::state<gps_subframe_fsm_S10, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S10: public sc::state<gps_subframe_fsm_S10, GpsL1CaSubframeFsm>
{
public: public:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >, typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions; sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions;
gps_subframe_fsm_S10(my_context ctx): my_base( ctx ){ gps_subframe_fsm_S10(my_context ctx): my_base( ctx )
//std::cout<<"Enter S10 "<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(8); //std::cout<<"Enter S10 "<<std::endl;
} context< GpsL1CaSubframeFsm >().gps_word_to_subframe(8);
}
}; };
struct gps_subframe_fsm_S11: public sc::state<gps_subframe_fsm_S11, GpsL1CaSubframeFsm > { struct gps_subframe_fsm_S11: public sc::state<gps_subframe_fsm_S11, GpsL1CaSubframeFsm>
{
public: 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 ){ gps_subframe_fsm_S11(my_context ctx): my_base( ctx )
//std::cout<<"Completed GPS Subframe!"<<std::endl; {
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(9); //std::cout<<"Completed GPS Subframe!"<<std::endl;
context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe context< GpsL1CaSubframeFsm >().gps_word_to_subframe(9);
// DECODE SUBFRAME context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe
//std::cout<<"Enter S11"<<std::endl; // DECODE SUBFRAME
} //std::cout<<"Enter S11"<<std::endl;
}
}; };
@ -231,7 +255,7 @@ void GpsL1CaSubframeFsm::gps_subframe_to_nav_msg()
d_nav.i_satellite_PRN = i_satellite_PRN; d_nav.i_satellite_PRN = i_satellite_PRN;
d_nav.i_channel_ID = i_channel_ID; d_nav.i_channel_ID = i_channel_ID;
d_nav.d_subframe_timestamp_ms = this->d_preamble_time_ms; d_nav.d_subframe_timestamp_ms = this->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 * \todo change satellite validation to subframe 5 because it will have a complete set of ephemeris parameters
*/ */

View File

@ -65,10 +65,7 @@ struct gps_subframe_fsm_S11;
class GpsL1CaSubframeFsm : public sc::state_machine< GpsL1CaSubframeFsm, gps_subframe_fsm_S0 > class GpsL1CaSubframeFsm : public sc::state_machine< GpsL1CaSubframeFsm, gps_subframe_fsm_S0 >
{ {
private:
public: public:
// channel and satellite info // channel and satellite info
int i_channel_ID; int i_channel_ID;
unsigned int i_satellite_PRN; unsigned int i_satellite_PRN;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -54,9 +54,8 @@ class AcquisitionInterface: public GNSSBlockInterface
{ {
public: public:
//virtual void set_active(bool active) = 0; //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_channel(unsigned int channel) = 0;
virtual void set_threshold(float threshold) = 0; virtual void set_threshold(float threshold) = 0;
virtual void set_doppler_max(unsigned int doppler_max) = 0; virtual void set_doppler_max(unsigned int doppler_max) = 0;
@ -65,7 +64,6 @@ public:
virtual void init() = 0; virtual void init() = 0;
virtual signed int mag() = 0; virtual signed int mag() = 0;
virtual void reset() = 0; virtual void reset() = 0;
}; };
#endif /* GNSS_SDR_ACQUISITION_INTERFACE */ #endif /* GNSS_SDR_ACQUISITION_INTERFACE */

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -50,9 +50,7 @@
*/ */
class ChannelInterface: public GNSSBlockInterface class ChannelInterface: public GNSSBlockInterface
{ {
public: public:
virtual Gnss_Signal get_signal() const = 0; virtual Gnss_Signal get_signal() const = 0;
virtual void start_acquisition() = 0; virtual void start_acquisition() = 0;
virtual void set_signal(Gnss_Signal) = 0; virtual void set_signal(Gnss_Signal) = 0;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -50,19 +50,14 @@
*/ */
class ConfigurationInterface class ConfigurationInterface
{ {
public: public:
virtual ~ConfigurationInterface() 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 bool property(std::string property_name, bool default_value) = 0;
virtual long property(std::string property_name, long 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 int property(std::string property_name, int default_value) = 0;
virtual unsigned int property(std::string property_name, virtual unsigned int property(std::string property_name, unsigned int default_value) = 0;
unsigned int default_value) = 0;
virtual float property(std::string property_name, float 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 double property(std::string property_name, double default_value) = 0;
virtual void set_property(std::string property_name, std::string value) = 0; virtual void set_property(std::string property_name, std::string value) = 0;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -51,11 +51,9 @@
*/ */
class GNSSBlockInterface class GNSSBlockInterface
{ {
public: public:
virtual ~GNSSBlockInterface() virtual ~GNSSBlockInterface()
{} {}
virtual std::string role() = 0; virtual std::string role() = 0;
virtual std::string implementation() = 0; virtual std::string implementation() = 0;
virtual size_t item_size() = 0; virtual size_t item_size() = 0;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -50,9 +50,7 @@
*/ */
class ObservablesInterface : public GNSSBlockInterface class ObservablesInterface : public GNSSBlockInterface
{ {
public: public:
virtual void reset() = 0; virtual void reset() = 0;
}; };

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -50,9 +50,7 @@
*/ */
class PvtInterface : public GNSSBlockInterface class PvtInterface : public GNSSBlockInterface
{ {
public: public:
virtual void reset() = 0; virtual void reset() = 0;
}; };

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -50,9 +50,7 @@
*/ */
class TelemetryDecoderInterface : public GNSSBlockInterface class TelemetryDecoderInterface : public GNSSBlockInterface
{ {
public: public:
virtual void reset() = 0; virtual void reset() = 0;
virtual void set_satellite(Gnss_Satellite sat) = 0; virtual void set_satellite(Gnss_Satellite sat) = 0;
virtual void set_channel(int channel) = 0; virtual void set_channel(int channel) = 0;

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -53,14 +53,11 @@ template<typename Data>class concurrent_queue;
*/ */
class TrackingInterface : public GNSSBlockInterface class TrackingInterface : public GNSSBlockInterface
{ {
public: public:
virtual void start_tracking() = 0; virtual void start_tracking() = 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_channel(unsigned int channel) = 0;
virtual void set_channel_queue(concurrent_queue<int> *channel_internal_queue) = 0; virtual void set_channel_queue(concurrent_queue<int> *channel_internal_queue) = 0;
}; };
#endif /* GNSS_SDR_TRACKING_INTERFACE_H_ */ #endif /* GNSS_SDR_TRACKING_INTERFACE_H_ */

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -44,8 +44,8 @@ ControlMessageFactory::ControlMessageFactory()
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; ControlMessage *control_message = new ControlMessage;
control_message->who = who; control_message->who = who;
@ -59,21 +59,22 @@ gr_message_sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigne
return queue_message; return queue_message;
} }
std::vector<ControlMessage*>* ControlMessageFactory::GetControlMessages(gr_message_sptr queue_message) { std::vector<ControlMessage*>* ControlMessageFactory::GetControlMessages(gr_message_sptr queue_message)
{
std::vector<ControlMessage*>* control_messages = new std::vector<ControlMessage*>(); std::vector<ControlMessage*>* control_messages = new std::vector<ControlMessage*>();
unsigned int control_messages_count = queue_message->length() / sizeof(ControlMessage); 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" << LOG_AT_LEVEL(WARNING) << "Queue message has size " << queue_message->length() << " which is not" <<
" multiple of control message size " << sizeof(ControlMessage); " multiple of control message size " << sizeof(ControlMessage);
LOG_AT_LEVEL(WARNING) << "Ignoring this queue message to prevent unexpected results."; LOG_AT_LEVEL(WARNING) << "Ignoring this queue message to prevent unexpected results.";
return control_messages; return control_messages;
} }
for(unsigned int i=0;i<control_messages_count;i++) { for(unsigned int i=0; i<control_messages_count; i++)
{
control_messages->push_back(new ControlMessage); control_messages->push_back(new ControlMessage);
memcpy(control_messages->at(i), queue_message->msg() + (i*sizeof(ControlMessage)), sizeof(ControlMessage)); memcpy(control_messages->at(i), queue_message->msg() + (i*sizeof(ControlMessage)), sizeof(ControlMessage));
} }
return control_messages; return control_messages;
} }

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -53,15 +53,13 @@ class InMemoryConfiguration;
* The file is in the INI format, containing sections and pairs of names and values. * 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 * For more information about the INI format, see http://en.wikipedia.org/wiki/INI_file
*/ */
class FileConfiguration : public ConfigurationInterface { class FileConfiguration : public ConfigurationInterface
{
public: public:
FileConfiguration(std::string filename); FileConfiguration(std::string filename);
FileConfiguration(); FileConfiguration();
//! Virtual destructor //! Virtual destructor
virtual ~FileConfiguration(); virtual ~FileConfiguration();
std::string property(std::string property_name, std::string default_value); std::string property(std::string property_name, std::string default_value);
bool property(std::string property_name, bool default_value); bool property(std::string property_name, bool default_value);
long property(std::string property_name, long 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); unsigned int property(std::string property_name, unsigned int default_value);
float property(std::string property_name, float default_value); float property(std::string property_name, float default_value);
double property(std::string property_name, double default_value); double property(std::string property_name, double default_value);
void set_property(std::string property_name, std::string value); void set_property(std::string property_name, std::string value);
private: private:
void init(); void init();
std::string filename_; std::string filename_;
INIReader *ini_reader_; INIReader *ini_reader_;
InMemoryConfiguration* overrided_; InMemoryConfiguration* overrided_;

View File

@ -101,16 +101,14 @@ void GNSSFlowgraph::stop()
{ {
for (unsigned int i = 0; i < channels_count_; i++) 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(); channel(i)->stop();
} }
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{ {
std::cout << "Channel " << i << " in state " << channels_state_[i] std::cout << "Channel " << i << " in state " << channels_state_[i]
<< std::endl; << std::endl;
} }
DLOG(INFO) << "Threads finished. Return to main program."; DLOG(INFO) << "Threads finished. Return to main program.";
top_block_->stop(); top_block_->stop();
running_ = false; running_ = false;
@ -596,16 +594,7 @@ void GNSSFlowgraph::set_signals_list()
available_GNSS_signals_.remove(signal_value); available_GNSS_signals_.remove(signal_value);
available_GNSS_signals_.insert(gnss_it, signal_value); available_GNSS_signals_.insert(gnss_it, signal_value);
} }
} }
// std::cout << "Signal queue: " << std::endl;
// Gnss_Signal aux_signal;
// for (std::list<Gnss_Signal>::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;
// }
} }

View File

@ -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 * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -50,11 +50,9 @@ class StringConverter;
*/ */
class InMemoryConfiguration : public ConfigurationInterface class InMemoryConfiguration : public ConfigurationInterface
{ {
public: public:
InMemoryConfiguration(); InMemoryConfiguration();
virtual ~InMemoryConfiguration(); virtual ~InMemoryConfiguration();
std::string property(std::string property_name, std::string default_value); std::string property(std::string property_name, std::string default_value);
bool property(std::string property_name, bool default_value); bool property(std::string property_name, bool default_value);
long property(std::string property_name, long 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); unsigned int property(std::string property_name, unsigned int default_value);
float property(std::string property_name, float default_value); float property(std::string property_name, float default_value);
double property(std::string property_name, double default_value); double property(std::string property_name, double default_value);
void set_property(std::string property_name, std::string value); void set_property(std::string property_name, std::string value);
bool is_present(std::string property_name); bool is_present(std::string property_name);
private: private:
std::map<std::string, std::string> properties_; std::map<std::string, std::string> properties_;
StringConverter *converter_; StringConverter *converter_;
}; };

View File

@ -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_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_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_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 * \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms

View File

@ -28,8 +28,8 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#ifndef GALILEO_E1_H_ #ifndef GNSS_SDR_GALILEO_E1_H_
#define GALILEO_E1_H_ #define GNSS_SDR_GALILEO_E1_H_
#include <complex> #include <complex>
#include <gnss_satellite.h> #include <gnss_satellite.h>
@ -154,4 +154,4 @@ const std::string Galileo_E1_C_PRIMARY_CODE[Galileo_E1_NUMBER_OF_CODES] = {
"CD7AAC98501F29507EA4E0183E8A40D2E5117E47BB5D18D01A3732DE4C821DFE86521CBEA7DB29BE1148BD544ECC681689BCD1B41EAF755310B7659342F8EE11CB41550CC30E566E192796B66C1A83C0B28BACCFA6C393043A0A2CB89712BC1CCB174DE58E66896AF39C1CEED1E05B0435F8CF6FD920D100F51584FE24879987399481DBF27DDB6286B6353919E552E669290CE02AB4CD5113D7F484229F379C7332767EC69E4336439B05DE1C1E3563DD303A4F580BFF20A40E49CB0822F715ED0221EBCDB5DBAD751124B1715E82F37488265135B6C8BBCF4F801ECC4D3525FF189493AD4EFF0C042B070C4CA8FB1FDF43D79F06A6E4E3D35D7B07D4B728D5DC54EEDACBBBA1EDDCDC07ADF7DFCFEF835E44DF1FF66DAF2A7BAEBE218AC3B15E183044D6A8A89B3C101B40BED97ED5DF93BBC1B84931D56B8C822A6D058AC74CFA4C85D8B456698E82D5B7574C17B041E5F4BEED09F75012355CBC322B822C63F10C18A8F279E9A0E18E1FEF183D23E13894E31F6D046956FE8A647558228F6D4D6910151EC03937876B6ED7A078D33DAEB3F2239353BB8181E62B286BBC41588DE10F478A5CE5B508F205A41820356767B0A0ED4B8DB9EFE348362E9A90D6C30218B295B338B51C09239D02FC8A1E7DAAAB60AC37F5E67CFC88EEF69567B5C81A03B449F4ED38B9D295A36AA3503173F6F6F66D93CE72D753076040FACDE", "CD7AAC98501F29507EA4E0183E8A40D2E5117E47BB5D18D01A3732DE4C821DFE86521CBEA7DB29BE1148BD544ECC681689BCD1B41EAF755310B7659342F8EE11CB41550CC30E566E192796B66C1A83C0B28BACCFA6C393043A0A2CB89712BC1CCB174DE58E66896AF39C1CEED1E05B0435F8CF6FD920D100F51584FE24879987399481DBF27DDB6286B6353919E552E669290CE02AB4CD5113D7F484229F379C7332767EC69E4336439B05DE1C1E3563DD303A4F580BFF20A40E49CB0822F715ED0221EBCDB5DBAD751124B1715E82F37488265135B6C8BBCF4F801ECC4D3525FF189493AD4EFF0C042B070C4CA8FB1FDF43D79F06A6E4E3D35D7B07D4B728D5DC54EEDACBBBA1EDDCDC07ADF7DFCFEF835E44DF1FF66DAF2A7BAEBE218AC3B15E183044D6A8A89B3C101B40BED97ED5DF93BBC1B84931D56B8C822A6D058AC74CFA4C85D8B456698E82D5B7574C17B041E5F4BEED09F75012355CBC322B822C63F10C18A8F279E9A0E18E1FEF183D23E13894E31F6D046956FE8A647558228F6D4D6910151EC03937876B6ED7A078D33DAEB3F2239353BB8181E62B286BBC41588DE10F478A5CE5B508F205A41820356767B0A0ED4B8DB9EFE348362E9A90D6C30218B295B338B51C09239D02FC8A1E7DAAAB60AC37F5E67CFC88EEF69567B5C81A03B449F4ED38B9D295A36AA3503173F6F6F66D93CE72D753076040FACDE",
"ADDCEDB50E907D20E826E6E8A0D30C20C74B2DF204EA784BAE9F618CAE33A3C937729DF9CB10BA2A4C33E0182A37200C0CC509729D828B8A2A20F283AC4F9306596684EA3FB5492A4C9F2DB459E7531C9F9C0950E7D9E93B3EE5912AE7E39AC8F4EC14B18F24E325003F477E347C5AC1B67CDB11AF3BBBBCD0AC3703024B5767AA67A208254F798684BFD1D3EACD757EEC77254950A146620400DB95E694574F739A991EBA771EBBDFF1056BB39A77DBE0636A032E17141332F951C57C6C90F348F165E3ABDD60D429D5D6BEC7E3E3463806F819EB2D212B3528A5EDE51F235AD100A35E890955F8A1DC51FDCB53EABCA2540997DD054C1F5B29462995B876B44D085904E55E1B838BEF600A992EB49CE078DF75AF3D0F137685AC0D07F0BE1EB87B63A41E74DDE869C8A683BDE60AF5D77FF18F7137495BCEFD0ED28F62F9C3E25D332B5F861D999FCDC0B4851A984A4DBB53401FD40351ADA4335C702BCC8D900C737507B990BDDBE91D201E3A0946DC968D43FD10D04B0B76667FF5B4291C2124B0124C6B710A6D1BCFAEB016B9DEEB0F7A4FE044CA4EA0CCD84B7682617C3A545071EC295B0663B3F577D562DE1D9DD80DE6A1EFD6D5991EB5246F1597B86D0E9A90CF6DB0EB2B8E7BAE9431E567F01AA98502C773742246467ABF911A91A51F6C1B9E0C3233DC1A37D17DB91A5F0F661B0EB5886964456C7818601BD0C" "ADDCEDB50E907D20E826E6E8A0D30C20C74B2DF204EA784BAE9F618CAE33A3C937729DF9CB10BA2A4C33E0182A37200C0CC509729D828B8A2A20F283AC4F9306596684EA3FB5492A4C9F2DB459E7531C9F9C0950E7D9E93B3EE5912AE7E39AC8F4EC14B18F24E325003F477E347C5AC1B67CDB11AF3BBBBCD0AC3703024B5767AA67A208254F798684BFD1D3EACD757EEC77254950A146620400DB95E694574F739A991EBA771EBBDFF1056BB39A77DBE0636A032E17141332F951C57C6C90F348F165E3ABDD60D429D5D6BEC7E3E3463806F819EB2D212B3528A5EDE51F235AD100A35E890955F8A1DC51FDCB53EABCA2540997DD054C1F5B29462995B876B44D085904E55E1B838BEF600A992EB49CE078DF75AF3D0F137685AC0D07F0BE1EB87B63A41E74DDE869C8A683BDE60AF5D77FF18F7137495BCEFD0ED28F62F9C3E25D332B5F861D999FCDC0B4851A984A4DBB53401FD40351ADA4335C702BCC8D900C737507B990BDDBE91D201E3A0946DC968D43FD10D04B0B76667FF5B4291C2124B0124C6B710A6D1BCFAEB016B9DEEB0F7A4FE044CA4EA0CCD84B7682617C3A545071EC295B0663B3F577D562DE1D9DD80DE6A1EFD6D5991EB5246F1597B86D0E9A90CF6DB0EB2B8E7BAE9431E567F01AA98502C773742246467ABF911A91A51F6C1B9E0C3233DC1A37D17DB91A5F0F661B0EB5886964456C7818601BD0C"
}; };
#endif /* GALILEO_E1_H_ */ #endif /* GNSS_SDR_GALILEO_E1_H_ */

View File

@ -39,7 +39,6 @@
void Gps_Navigation_Message::reset() void Gps_Navigation_Message::reset()
{ {
b_update_tow_flag=false; b_update_tow_flag=false;
b_valid_ephemeris_set_flag=false; b_valid_ephemeris_set_flag=false;
d_TOW=0; d_TOW=0;
@ -209,7 +208,6 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS>
{ {
value = false; value = false;
} }
return value; return value;
} }
@ -219,9 +217,7 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset<GPS_SUBFRAME_BITS>
unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices) unsigned long int Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRAME_BITS> bits, const bits_slice *slices, int num_of_slices)
{ {
unsigned long int value; unsigned long int value = 0;
value = 0;
for (int i=0; i<num_of_slices; i++) for (int i=0; i<num_of_slices; i++)
{ {
for (int j=0; j<slices[i].length; j++) for (int j=0; j<slices[i].length; j++)
@ -245,56 +241,58 @@ signed long int Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_S
{ {
signed long int value = 0; signed long int value = 0;
// Bug correction: Discriminate between 64 bits and 32 bits compiler // Discriminate between 64 bits and 32 bits compiler
int long_int_size_bytes = sizeof(signed long int); int long_int_size_bytes = sizeof(signed long int);
if (long_int_size_bytes==8) if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
{ {
// read the MSB and perform the sign extension // read the MSB and perform the sign extension
if (bits[GPS_SUBFRAME_BITS-slices[0].position]==1) if (bits[GPS_SUBFRAME_BITS - slices[0].position] == 1)
{ {
value^=0xFFFFFFFFFFFFFFFF; //64 bits variable value^=0xFFFFFFFFFFFFFFFF; //64 bits variable
} }
else else
{ {
value&=0; value&=0;
} }
for (int i=0; i<num_of_slices; i++) for (int i=0; i<num_of_slices; i++)
{ {
for (int j=0; j<slices[i].length; j++) for (int j=0; j<slices[i].length; j++)
{ {
value<<=1; //shift left value<<=1; //shift left
value&=0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable) value&=0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
if (bits[GPS_SUBFRAME_BITS - slices[i].position-j] == 1) if (bits[GPS_SUBFRAME_BITS - slices[i].position - j] == 1)
{ {
value+=1; // insert the bit value+=1; // insert the bit
} }
} }
} }
}else{ }
// read the MSB and perform the sign extension else // we assume we are in a 32 bits system
if (bits[GPS_SUBFRAME_BITS-slices[0].position]==1) {
{ // read the MSB and perform the sign extension
value^=0xFFFFFFFF; if (bits[GPS_SUBFRAME_BITS-slices[0].position] == 1)
} {
else value^=0xFFFFFFFF;
{ }
value&=0; else
} {
value&=0;
}
for (int i=0; i<num_of_slices; i++) for (int i=0; i<num_of_slices; i++)
{ {
for (int j=0; j<slices[i].length; j++) for (int j=0; j<slices[i].length; j++)
{ {
value<<=1; //shift left value<<=1; //shift left
value&=0xFFFFFFFE; //reset the corresponding bit value&=0xFFFFFFFE; //reset the corresponding bit
if (bits[GPS_SUBFRAME_BITS - slices[i].position-j] == 1) if (bits[GPS_SUBFRAME_BITS - slices[i].position - j] == 1)
{ {
value+=1; // insert the bit value+=1; // insert the bit
} }
} }
} }
} }
return value; return value;
} }
@ -433,12 +431,6 @@ void Gps_Navigation_Message::satellitePosition(double transmitTime)
int Gps_Navigation_Message::subframe_decoder(char *subframe) int Gps_Navigation_Message::subframe_decoder(char *subframe)
{ {
int subframe_ID = 0; int subframe_ID = 0;
@ -665,6 +657,7 @@ int Gps_Navigation_Message::subframe_decoder(char *subframe)
almanacHealth[24] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV24, num_of_slices(HEALTH_SV24)); almanacHealth[24] = (int)read_navigation_unsigned(subframe_bits, HEALTH_SV24, num_of_slices(HEALTH_SV24));
} }
break; break;
default: default:
break; break;
} // switch subframeID ... } // switch subframeID ...
@ -746,23 +739,19 @@ double Gps_Navigation_Message::utc_time(double gpstime_corrected)
bool Gps_Navigation_Message::satellite_validation() bool Gps_Navigation_Message::satellite_validation()
{ {
bool flag_data_valid = false; bool flag_data_valid = false;
b_valid_ephemeris_set_flag=false; b_valid_ephemeris_set_flag = false;
// First Step: // First Step:
// check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception // check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception
// and check if the data have been filled (!=0) // and check if the data have been filled (!=0)
if (d_TOW_SF1!=0 and d_TOW_SF2!=0 and d_TOW_SF3!=0) if (d_TOW_SF1 != 0 and d_TOW_SF2 != 0 and d_TOW_SF3 != 0)
{
if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!=-1)
{ {
//std::cout<<"d_TOW_SF3-d_TOW_SF2="<<d_TOW_SF3-d_TOW_SF2<<std::endl; if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!=-1)
//std::cout<<"d_TOW_SF2-d_TOW_SF1="<<d_TOW_SF2-d_TOW_SF1<<std::endl; {
flag_data_valid = true; flag_data_valid = true;
b_valid_ephemeris_set_flag=true; b_valid_ephemeris_set_flag=true;
}
} }
}
return flag_data_valid; return flag_data_valid;
} }

View File

@ -42,30 +42,30 @@ end
% GNSS-SDR format conversion to MATLAB GPS receiver % GNSS-SDR format conversion to MATLAB GPS receiver
for N=1:1:channels for N=1:1:channels
trackResults(N).status='T'; %fake track trackResults(N).status = 'T'; %fake track
trackResults(N).codeFreq=GNSS_tracking(N).code_freq_hz.'; trackResults(N).codeFreq = GNSS_tracking(N).code_freq_hz.';
trackResults(N).carrFreq=GNSS_tracking(N).carrier_doppler_hz.'; trackResults(N).carrFreq = GNSS_tracking(N).carrier_doppler_hz.';
trackResults(N).dllDiscr = GNSS_tracking(N).code_error.'; trackResults(N).dllDiscr = GNSS_tracking(N).code_error.';
trackResults(N).dllDiscrFilt = GNSS_tracking(N).code_nco.'; trackResults(N).dllDiscrFilt = GNSS_tracking(N).code_nco.';
trackResults(N).pllDiscr = GNSS_tracking(N).carr_error.'; trackResults(N).pllDiscr = GNSS_tracking(N).carr_error.';
trackResults(N).pllDiscrFilt = GNSS_tracking(N).carr_nco.'; trackResults(N).pllDiscrFilt = GNSS_tracking(N).carr_nco.';
trackResults(N).I_P=GNSS_tracking(N).prompt_I.'; trackResults(N).I_P = GNSS_tracking(N).prompt_I.';
trackResults(N).Q_P=GNSS_tracking(N).prompt_Q.'; trackResults(N).Q_P = GNSS_tracking(N).prompt_Q.';
trackResults(N).I_VE= GNSS_tracking(N).VE.'; trackResults(N).I_VE = GNSS_tracking(N).VE.';
trackResults(N).I_E= GNSS_tracking(N).E.'; trackResults(N).I_E = GNSS_tracking(N).E.';
trackResults(N).I_L = GNSS_tracking(N).L.'; trackResults(N).I_L = GNSS_tracking(N).L.';
trackResults(N).I_VL = GNSS_tracking(N).VL.'; trackResults(N).I_VL = GNSS_tracking(N).VL.';
trackResults(N).Q_VE = zeros(1,length(GNSS_tracking(N).VE)); trackResults(N).Q_VE = zeros(1,length(GNSS_tracking(N).VE));
trackResults(N).Q_E = zeros(1,length(GNSS_tracking(N).E)); trackResults(N).Q_E = zeros(1,length(GNSS_tracking(N).E));
trackResults(N).Q_L =zeros(1,length(GNSS_tracking(N).L)); trackResults(N).Q_L = zeros(1,length(GNSS_tracking(N).L));
trackResults(N).Q_VL =zeros(1,length(GNSS_tracking(N).VL)); trackResults(N).Q_VL = zeros(1,length(GNSS_tracking(N).VL));
trackResults(N).PRN=N; %fake PRN trackResults(N).PRN = N; %fake PRN
% Use original MATLAB tracking plot function % Use original MATLAB tracking plot function
settings.numberOfChannels=channels; settings.numberOfChannels = channels;
settings.msToProcess=length(GNSS_tracking(N).E)*4; settings.msToProcess = length(GNSS_tracking(N).E)*4;
plotVEMLTracking(N,trackResults,settings) plotVEMLTracking(N,trackResults,settings)
end end