mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
bds_b3i: fixing code with clang format
This commit is contained in:
parent
3136817737
commit
5a4227507d
@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* \file beidou_b3i_telemetry_decoder.cc
|
||||
* \brief Implementation of an adapter of a Beidou B1I NAV data decoder block
|
||||
* \brief Implementation of an adapter of a Beidou B3I NAV data decoder block
|
||||
* to a TelemetryDecoderInterface
|
||||
* \author Damian Miralles, 2019. dmiralles2009@gmail.com
|
||||
*
|
||||
@ -29,78 +29,56 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "beidou_b3i_telemetry_decoder.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <glog/logging.h>
|
||||
|
||||
|
||||
BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams) : role_(role),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
{
|
||||
std::string default_dump_filename = "./navigation.dat";
|
||||
DLOG(INFO) << "role " << role;
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
// make telemetry decoder object
|
||||
telemetry_decoder_ = beidou_b3i_make_telemetry_decoder_gs(satellite_, dump_);
|
||||
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
|
||||
channel_ = 0;
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
}
|
||||
if (out_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one output stream";
|
||||
}
|
||||
BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder(
|
||||
ConfigurationInterface *configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams)
|
||||
: role_(role), in_streams_(in_streams), out_streams_(out_streams) {
|
||||
std::string default_dump_filename = "./navigation.dat";
|
||||
DLOG(INFO) << "role " << role;
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ =
|
||||
configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
// make telemetry decoder object
|
||||
telemetry_decoder_ = beidou_b3i_make_telemetry_decoder_gs(satellite_, dump_);
|
||||
DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")";
|
||||
channel_ = 0;
|
||||
if (in_streams_ > 1) {
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
}
|
||||
if (out_streams_ > 1) {
|
||||
LOG(ERROR) << "This implementation only supports one output stream";
|
||||
}
|
||||
}
|
||||
|
||||
BeidouB3iTelemetryDecoder::~BeidouB3iTelemetryDecoder() = default;
|
||||
|
||||
BeidouB3iTelemetryDecoder::~BeidouB3iTelemetryDecoder()
|
||||
{
|
||||
void BeidouB3iTelemetryDecoder::set_satellite(const Gnss_Satellite &satellite) {
|
||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
telemetry_decoder_->set_satellite(satellite_);
|
||||
DLOG(INFO) << "TELEMETRY DECODER: satellite set to " << satellite_;
|
||||
}
|
||||
|
||||
|
||||
void BeidouB3iTelemetryDecoder::set_satellite(const Gnss_Satellite& satellite)
|
||||
{
|
||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
telemetry_decoder_->set_satellite(satellite_);
|
||||
DLOG(INFO) << "TELEMETRY DECODER: satellite set to " << satellite_;
|
||||
void BeidouB3iTelemetryDecoder::connect(gr::top_block_sptr top_block) {
|
||||
if (top_block) { /* top_block is not null */
|
||||
};
|
||||
// Nothing to connect internally
|
||||
DLOG(INFO) << "nothing to connect internally";
|
||||
}
|
||||
|
||||
|
||||
void BeidouB3iTelemetryDecoder::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
// Nothing to connect internally
|
||||
DLOG(INFO) << "nothing to connect internally";
|
||||
void BeidouB3iTelemetryDecoder::disconnect(gr::top_block_sptr top_block) {
|
||||
if (top_block) { /* top_block is not null */
|
||||
};
|
||||
// Nothing to disconnect
|
||||
}
|
||||
|
||||
|
||||
void BeidouB3iTelemetryDecoder::disconnect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if (top_block)
|
||||
{ /* top_block is not null */
|
||||
};
|
||||
// Nothing to disconnect
|
||||
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_left_block() {
|
||||
return telemetry_decoder_;
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_left_block()
|
||||
{
|
||||
return telemetry_decoder_;
|
||||
}
|
||||
|
||||
|
||||
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_right_block()
|
||||
{
|
||||
return telemetry_decoder_;
|
||||
gr::basic_block_sptr BeidouB3iTelemetryDecoder::get_right_block() {
|
||||
return telemetry_decoder_;
|
||||
}
|
||||
|
@ -29,69 +29,58 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_H_
|
||||
#define GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_H_
|
||||
|
||||
#include "beidou_b3i_telemetry_decoder_gs.h"
|
||||
#include "gnss_satellite.h" // for Gnss_Satellite
|
||||
#include "gnss_satellite.h" // for Gnss_Satellite
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
#include <cstddef> // for size_t
|
||||
#include <cstddef> // for size_t
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
#include <string>
|
||||
class ConfigurationInterface;
|
||||
|
||||
/*!
|
||||
* \brief This class implements a NAV data decoder for BEIDOU B1I
|
||||
*/
|
||||
class BeidouB3iTelemetryDecoder : public TelemetryDecoderInterface
|
||||
{
|
||||
class BeidouB3iTelemetryDecoder : public TelemetryDecoderInterface {
|
||||
public:
|
||||
BeidouB3iTelemetryDecoder(ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
BeidouB3iTelemetryDecoder(ConfigurationInterface *configuration,
|
||||
std::string role, unsigned int in_streams,
|
||||
unsigned int out_streams);
|
||||
|
||||
virtual ~BeidouB3iTelemetryDecoder();
|
||||
virtual ~BeidouB3iTelemetryDecoder();
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
inline std::string role() override { return role_; }
|
||||
|
||||
//! Returns "BEIDOU_B3I_Telemetry_Decoder"
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "BEIDOU_B3I_Telemetry_Decoder";
|
||||
}
|
||||
//! Returns "BEIDOU_B3I_Telemetry_Decoder"
|
||||
inline std::string implementation() override {
|
||||
return "BEIDOU_B3I_Telemetry_Decoder";
|
||||
}
|
||||
|
||||
void connect(gr::top_block_sptr top_block) override;
|
||||
void disconnect(gr::top_block_sptr top_block) override;
|
||||
gr::basic_block_sptr get_left_block() override;
|
||||
gr::basic_block_sptr get_right_block() override;
|
||||
void connect(gr::top_block_sptr top_block) override;
|
||||
void disconnect(gr::top_block_sptr top_block) override;
|
||||
gr::basic_block_sptr get_left_block() override;
|
||||
gr::basic_block_sptr get_right_block() override;
|
||||
|
||||
void set_satellite(const Gnss_Satellite& satellite) override;
|
||||
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
||||
void set_satellite(const Gnss_Satellite &satellite) override;
|
||||
inline void set_channel(int channel) override {
|
||||
telemetry_decoder_->set_channel(channel);
|
||||
}
|
||||
|
||||
inline void reset() override
|
||||
{
|
||||
return;
|
||||
}
|
||||
inline void reset() override { return; }
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
inline size_t item_size() override { return 0; }
|
||||
|
||||
private:
|
||||
beidou_b3i_telemetry_decoder_gs_sptr telemetry_decoder_;
|
||||
Gnss_Satellite satellite_;
|
||||
int channel_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
beidou_b3i_telemetry_decoder_gs_sptr telemetry_decoder_;
|
||||
Gnss_Satellite satellite_;
|
||||
int channel_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,83 +34,87 @@
|
||||
#include "beidou_dnav_navigation_message.h"
|
||||
#include "gnss_satellite.h"
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||
#include <string>
|
||||
|
||||
|
||||
class beidou_b3i_telemetry_decoder_gs;
|
||||
|
||||
using beidou_b3i_telemetry_decoder_gs_sptr = boost::shared_ptr<beidou_b3i_telemetry_decoder_gs>;
|
||||
using beidou_b3i_telemetry_decoder_gs_sptr =
|
||||
boost::shared_ptr<beidou_b3i_telemetry_decoder_gs>;
|
||||
|
||||
beidou_b3i_telemetry_decoder_gs_sptr beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
beidou_b3i_telemetry_decoder_gs_sptr
|
||||
beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite,
|
||||
bool dump);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a block that decodes the BeiDou DNAV data.
|
||||
*
|
||||
*/
|
||||
class beidou_b3i_telemetry_decoder_gs : public gr::block
|
||||
{
|
||||
class beidou_b3i_telemetry_decoder_gs : public gr::block {
|
||||
public:
|
||||
~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
|
||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||
void set_channel(int channel); //!< Set receiver's channel
|
||||
~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
|
||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||
void set_channel(int channel); //!< Set receiver's channel
|
||||
|
||||
/*!
|
||||
* \brief This is where all signal processing takes place
|
||||
*/
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||
/*!
|
||||
* \brief This is where all signal processing takes place
|
||||
*/
|
||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
private:
|
||||
friend beidou_b3i_telemetry_decoder_gs_sptr
|
||||
beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
friend beidou_b3i_telemetry_decoder_gs_sptr
|
||||
beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite,
|
||||
bool dump);
|
||||
beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
|
||||
void decode_subframe(double *symbols);
|
||||
void decode_word(int32_t word_counter, const double *enc_word_symbols, int32_t* dec_word_symbols);
|
||||
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
|
||||
void decode_subframe(double *symbols);
|
||||
void decode_word(int32_t word_counter, const double *enc_word_symbols,
|
||||
int32_t *dec_word_symbols);
|
||||
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
|
||||
|
||||
// Preamble decoding
|
||||
int32_t *d_preamble_samples;
|
||||
int32_t *d_secondary_code_symbols;
|
||||
uint32_t d_samples_per_symbol;
|
||||
int32_t d_symbols_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
int32_t d_preamble_period_samples;
|
||||
double *d_subframe_symbols;
|
||||
uint32_t d_required_symbols;
|
||||
|
||||
// Preamble decoding
|
||||
int32_t *d_preamble_samples;
|
||||
int32_t *d_secondary_code_symbols;
|
||||
uint32_t d_samples_per_symbol;
|
||||
int32_t d_symbols_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
int32_t d_preamble_period_samples;
|
||||
double *d_subframe_symbols;
|
||||
uint32_t d_required_symbols;
|
||||
// Storage for incoming data
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
|
||||
// Storage for incoming data
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
// Variables for internal functionality
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc)
|
||||
// indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_stat; // Status of decoder
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
bool flag_SOW_set; // Indicates when time of week is set
|
||||
|
||||
// Variables for internal functionality
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_stat; // Status of decoder
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
bool flag_SOW_set; // Indicates when time of week is set
|
||||
//!< Navigation Message variable
|
||||
Beidou_Dnav_Navigation_Message d_nav;
|
||||
|
||||
//!< Navigation Message variable
|
||||
Beidou_Dnav_Navigation_Message d_nav;
|
||||
//!< Values to populate gnss synchronization structure
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
bool Flag_valid_word;
|
||||
|
||||
//!< Values to populate gnss synchronization structure
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
bool Flag_valid_word;
|
||||
|
||||
//!< Satellite Information and logging capacity
|
||||
Gnss_Satellite d_satellite;
|
||||
int32_t d_channel;
|
||||
bool d_dump;
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
//!< Satellite Information and logging capacity
|
||||
Gnss_Satellite d_satellite;
|
||||
int32_t d_channel;
|
||||
bool d_dump;
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user