mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-09 19:53:04 +00:00
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:
@@ -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();
|
||||
|
||||
@@ -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_*/
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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_;
|
||||
};
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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_;
|
||||
};
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user