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 *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();

View File

@ -36,8 +36,6 @@
#include <gnuradio/gr_msg_queue.h>
#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_*/

View File

@ -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_;

View File

@ -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_;

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
* 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_;

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
* 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_;
};

View File

@ -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_;

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
* 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_;

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
* 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;

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
* Satellite Systems receiver
@ -42,8 +42,7 @@
#include <gnuradio/gr_block.h>
class direct_resampler_conditioner_cc;
typedef boost::shared_ptr<direct_resampler_conditioner_cc>
direct_resampler_conditioner_cc_sptr;
typedef boost::shared_ptr<direct_resampler_conditioner_cc> 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;

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
* 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_;
};

View File

@ -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_;

View File

@ -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_;

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
* 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_;

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
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<std::string>(d_channel));
d_dump_filename.append(".dat");
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
*
*/
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<Gps_Navigation_Message> *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<Gps_Navigation_Message> *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<double> 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<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;
std::string d_dump_filename;
std::ofstream d_dump_file;
};
#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 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:
// 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 "<<std::endl;
}
// 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 "<<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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S2 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
}
gps_subframe_fsm_S1(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S3 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(0);
}
gps_subframe_fsm_S2(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S4 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(1);
}
gps_subframe_fsm_S3(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S5 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(2);
}
gps_subframe_fsm_S4(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S6 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(3);
}
gps_subframe_fsm_S5(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S7 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(4);
}
gps_subframe_fsm_S6(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S8 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(5);
}
gps_subframe_fsm_S7(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S9 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(6);
}
gps_subframe_fsm_S8(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S10 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(7);
}
gps_subframe_fsm_S9(my_context ctx): my_base( ctx )
{
//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:
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
sc::transition< Ev_gps_word_valid, gps_subframe_fsm_S11 > > reactions;
typedef mpl::list<sc::transition< Ev_gps_word_invalid, gps_subframe_fsm_S0 >,
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 "<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(8);
}
gps_subframe_fsm_S10(my_context ctx): my_base( ctx )
{
//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:
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!"<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(9);
context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe
// DECODE SUBFRAME
//std::cout<<"Enter S11"<<std::endl;
}
gps_subframe_fsm_S11(my_context ctx): my_base( ctx )
{
//std::cout<<"Completed GPS Subframe!"<<std::endl;
context< GpsL1CaSubframeFsm >().gps_word_to_subframe(9);
context< GpsL1CaSubframeFsm >().gps_subframe_to_nav_msg(); //decode the subframe
// 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_channel_ID = i_channel_ID;
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
*/

View File

@ -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;

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
* 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 */

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
* 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;

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
* 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;

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
* 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;

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
* Satellite Systems receiver
@ -50,9 +50,7 @@
*/
class ObservablesInterface : public GNSSBlockInterface
{
public:
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
* Satellite Systems receiver
@ -50,9 +50,7 @@
*/
class PvtInterface : public GNSSBlockInterface
{
public:
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
* 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;

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
* Satellite Systems receiver
@ -53,14 +53,11 @@ template<typename Data>class 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<int> *channel_internal_queue) = 0;
};
#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
* 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<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*>();
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;i<control_messages_count;i++) {
}
for(unsigned int i=0; i<control_messages_count; i++)
{
control_messages->push_back(new ControlMessage);
memcpy(control_messages->at(i), queue_message->msg() + (i*sizeof(ControlMessage)), sizeof(ControlMessage));
}
}
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
* 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_;

View File

@ -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<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
* 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<std::string, std::string> properties_;
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_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

View File

@ -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 <complex>
#include <gnss_satellite.h>
@ -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_ */

View File

@ -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<GPS_SUBFRAME_BITS>
{
value = false;
}
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 value;
value = 0;
unsigned long int value = 0;
for (int i=0; i<num_of_slices; i++)
{
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;
// 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);
if (long_int_size_bytes==8)
{
// read the MSB and perform the sign extension
if (bits[GPS_SUBFRAME_BITS-slices[0].position]==1)
{
value^=0xFFFFFFFFFFFFFFFF; //64 bits variable
}
else
{
value&=0;
}
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
if (bits[GPS_SUBFRAME_BITS - slices[0].position] == 1)
{
value^=0xFFFFFFFFFFFFFFFF; //64 bits variable
}
else
{
value&=0;
}
for (int i=0; i<num_of_slices; i++)
{
for (int j=0; j<slices[i].length; j++)
{
value<<=1; //shift left
value&=0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
if (bits[GPS_SUBFRAME_BITS - slices[i].position-j] == 1)
{
value+=1; // insert the bit
}
}
}
}else{
// read the MSB and perform the sign extension
if (bits[GPS_SUBFRAME_BITS-slices[0].position]==1)
{
value^=0xFFFFFFFF;
}
else
{
value&=0;
}
for (int i=0; i<num_of_slices; i++)
{
for (int j=0; j<slices[i].length; j++)
{
value<<=1; //shift left
value&=0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
if (bits[GPS_SUBFRAME_BITS - slices[i].position - j] == 1)
{
value+=1; // insert the bit
}
}
}
}
else // we assume we are in a 32 bits system
{
// read the MSB and perform the sign extension
if (bits[GPS_SUBFRAME_BITS-slices[0].position] == 1)
{
value^=0xFFFFFFFF;
}
else
{
value&=0;
}
for (int i=0; i<num_of_slices; i++)
{
for (int j=0; j<slices[i].length; j++)
{
value<<=1; //shift left
value&=0xFFFFFFFE; //reset the corresponding bit
if (bits[GPS_SUBFRAME_BITS - slices[i].position-j] == 1)
{
value+=1; // insert the bit
}
}
}
}
for (int i=0; i<num_of_slices; i++)
{
for (int j=0; j<slices[i].length; j++)
{
value<<=1; //shift left
value&=0xFFFFFFFE; //reset the corresponding bit
if (bits[GPS_SUBFRAME_BITS - slices[i].position - j] == 1)
{
value+=1; // insert the bit
}
}
}
}
return value;
}
@ -433,12 +431,6 @@ void Gps_Navigation_Message::satellitePosition(double transmitTime)
int Gps_Navigation_Message::subframe_decoder(char *subframe)
{
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));
}
break;
default:
break;
} // switch subframeID ...
@ -746,23 +739,19 @@ double Gps_Navigation_Message::utc_time(double gpstime_corrected)
bool Gps_Navigation_Message::satellite_validation()
{
bool flag_data_valid = false;
b_valid_ephemeris_set_flag=false;
b_valid_ephemeris_set_flag = false;
// First Step:
// check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception
// 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_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!=-1)
if (d_TOW_SF1 != 0 and d_TOW_SF2 != 0 and d_TOW_SF3 != 0)
{
//std::cout<<"d_TOW_SF3-d_TOW_SF2="<<d_TOW_SF3-d_TOW_SF2<<std::endl;
//std::cout<<"d_TOW_SF2-d_TOW_SF1="<<d_TOW_SF2-d_TOW_SF1<<std::endl;
flag_data_valid = true;
b_valid_ephemeris_set_flag=true;
if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC!=-1)
{
flag_data_valid = true;
b_valid_ephemeris_set_flag=true;
}
}
}
return flag_data_valid;
}

View File

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