2018-03-24 18:42:04 +00:00
|
|
|
/*!
|
2019-03-02 01:21:03 +00:00
|
|
|
* \file glonass_l2_ca_telemetry_decoder_gs.h
|
2019-03-05 21:17:09 +00:00
|
|
|
* \brief Implementation of a GLONASS L2 C/A NAV data decoder block
|
2018-03-24 18:42:04 +00:00
|
|
|
* \author Damian Miralles, 2018. dmiralles2009(at)gmail.com
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2018-03-24 18:42:04 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-03-24 18:42:04 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_GLONASS_L2_CA_TELEMETRY_DECODER_GS_H
|
|
|
|
#define GNSS_SDR_GLONASS_L2_CA_TELEMETRY_DECODER_GS_H
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "GLONASS_L1_L2_CA.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "glonass_gnav_navigation_message.h"
|
2018-03-24 18:42:04 +00:00
|
|
|
#include "gnss_satellite.h"
|
2019-03-05 22:09:02 +00:00
|
|
|
#include "gnss_synchro.h"
|
2019-02-28 12:40:09 +00:00
|
|
|
#include <boost/circular_buffer.hpp>
|
2018-03-24 18:42:04 +00:00
|
|
|
#include <gnuradio/block.h>
|
2019-03-05 21:17:09 +00:00
|
|
|
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
2019-07-19 16:23:36 +00:00
|
|
|
#include <array>
|
2019-03-05 21:17:09 +00:00
|
|
|
#include <cstdint>
|
2018-03-24 18:42:04 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include <string>
|
2020-04-02 21:59:35 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
#include <memory> // for std::shared_ptr
|
|
|
|
#else
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#endif
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2019-03-02 01:21:03 +00:00
|
|
|
class glonass_l2_ca_telemetry_decoder_gs;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2020-04-02 21:59:35 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
2020-04-02 11:23:20 +00:00
|
|
|
using glonass_l2_ca_telemetry_decoder_gs_sptr = std::shared_ptr<glonass_l2_ca_telemetry_decoder_gs>;
|
2020-04-02 21:59:35 +00:00
|
|
|
#else
|
|
|
|
using glonass_l2_ca_telemetry_decoder_gs_sptr = boost::shared_ptr<glonass_l2_ca_telemetry_decoder_gs>;
|
|
|
|
#endif
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2019-07-20 09:13:28 +00:00
|
|
|
glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(
|
|
|
|
const Gnss_Satellite &satellite,
|
|
|
|
bool dump);
|
2018-03-24 18:42:04 +00:00
|
|
|
|
|
|
|
/*!
|
2019-03-05 21:17:09 +00:00
|
|
|
* \brief This class implements a block that decodes the GNAV data defined in GLONASS ICD v5.1
|
|
|
|
* \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
|
|
|
|
*
|
|
|
|
*/
|
2019-03-02 01:21:03 +00:00
|
|
|
class glonass_l2_ca_telemetry_decoder_gs : public gr::block
|
2018-03-24 18:42:04 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-03-02 01:21:03 +00:00
|
|
|
~glonass_l2_ca_telemetry_decoder_gs(); //!< Class destructor
|
2018-03-24 18:42:04 +00:00
|
|
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
2018-08-13 11:03:01 +00:00
|
|
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
2019-03-18 15:28:49 +00:00
|
|
|
inline void reset()
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2018-03-24 18:42:04 +00:00
|
|
|
/*!
|
2019-03-05 21:17:09 +00:00
|
|
|
* \brief This is where all signal processing takes place
|
|
|
|
*/
|
2018-03-24 18:42:04 +00:00
|
|
|
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:
|
2019-07-20 09:13:28 +00:00
|
|
|
friend glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(
|
|
|
|
const Gnss_Satellite &satellite,
|
|
|
|
bool dump);
|
|
|
|
|
2019-03-02 01:21:03 +00:00
|
|
|
glonass_l2_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2019-07-19 16:23:36 +00:00
|
|
|
const std::array<uint16_t, GLONASS_GNAV_PREAMBLE_LENGTH_BITS> d_preambles_bits{GLONASS_GNAV_PREAMBLE};
|
2020-06-23 07:47:58 +00:00
|
|
|
|
2019-07-19 16:23:36 +00:00
|
|
|
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2020-06-23 07:47:58 +00:00
|
|
|
void decode_string(const double *symbols, int32_t frame_length);
|
|
|
|
|
2019-07-19 16:23:36 +00:00
|
|
|
// Storage for incoming data
|
2019-02-28 12:40:09 +00:00
|
|
|
boost::circular_buffer<Gnss_Synchro> d_symbol_history;
|
2018-03-24 18:42:04 +00:00
|
|
|
|
2020-06-23 07:47:58 +00:00
|
|
|
std::array<int32_t, GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS> d_preambles_symbols{};
|
2019-07-19 16:23:36 +00:00
|
|
|
|
|
|
|
// Navigation Message variable
|
2018-03-24 18:42:04 +00:00
|
|
|
Glonass_Gnav_Navigation_Message d_nav;
|
|
|
|
|
2020-06-23 07:47:58 +00:00
|
|
|
Gnss_Satellite d_satellite;
|
|
|
|
|
|
|
|
std::string d_dump_filename;
|
|
|
|
std::ofstream d_dump_file;
|
|
|
|
|
|
|
|
double d_preamble_time_samples;
|
|
|
|
double delta_t; // GPS-GLONASS time offset
|
2018-03-24 18:42:04 +00:00
|
|
|
double d_TOW_at_current_symbol;
|
|
|
|
|
2020-06-23 07:47:58 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
2018-08-13 11:03:01 +00:00
|
|
|
int32_t d_channel;
|
2020-06-23 07:47:58 +00:00
|
|
|
|
|
|
|
bool Flag_valid_word;
|
|
|
|
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
|
|
|
bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
|
|
|
|
bool d_flag_preamble; // Flag indicating when preamble was found
|
|
|
|
bool flag_TOW_set; // Indicates when time of week is set
|
2018-03-24 18:42:04 +00:00
|
|
|
bool d_dump;
|
|
|
|
};
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_GLONASS_L2_CA_TELEMETRY_DECODER_GS_H
|