GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
glonass_l2_ca_telemetry_decoder_gs.h
Go to the documentation of this file.
1 /*!
2  * \file glonass_l2_ca_telemetry_decoder_gs.h
3  * \brief Implementation of a GLONASS L2 C/A NAV data decoder block
4  * \author Damian Miralles, 2018. dmiralles2009(at)gmail.com
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 #ifndef GNSS_SDR_GLONASS_L2_CA_TELEMETRY_DECODER_GS_H
18 #define GNSS_SDR_GLONASS_L2_CA_TELEMETRY_DECODER_GS_H
19 
20 
21 #include "GLONASS_L1_L2_CA.h"
23 #include "gnss_block_interface.h"
24 #include "gnss_satellite.h"
25 #include "gnss_synchro.h"
26 #include "tlm_conf.h"
27 #include <boost/circular_buffer.hpp>
28 #include <gnuradio/block.h>
29 #include <gnuradio/types.h> // for gr_vector_const_void_star
30 #include <array>
31 #include <cstdint>
32 #include <fstream>
33 #include <string>
34 
35 /** \addtogroup Telemetry_Decoder
36  * \{ */
37 /** \addtogroup Telemetry_Decoder_gnuradio_blocks
38  * \{ */
39 
40 
42 
43 using glonass_l2_ca_telemetry_decoder_gs_sptr = gnss_shared_ptr<glonass_l2_ca_telemetry_decoder_gs>;
44 
45 glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(
46  const Gnss_Satellite &satellite,
47  const Tlm_Conf &conf);
48 
49 /*!
50 * \brief This class implements a block that decodes the GNAV data defined in GLONASS ICD v5.1
51 * \see <a href="http://russianspacesystems.ru/wp-content/uploads/2016/08/ICD_GLONASS_eng_v5.1.pdf">GLONASS ICD</a>
52 *
53 */
54 class glonass_l2_ca_telemetry_decoder_gs : public gr::block
55 {
56 public:
57  ~glonass_l2_ca_telemetry_decoder_gs(); //!< Class destructor
58  void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
59  void set_channel(int32_t channel); //!< Set receiver's channel
60  inline void reset()
61  {
62  return;
63  }
64  /*!
65  * \brief This is where all signal processing takes place
66  */
67  int general_work(int noutput_items, gr_vector_int &ninput_items,
68  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
69 
70 private:
71  friend glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(
72  const Gnss_Satellite &satellite,
73  const Tlm_Conf &conf);
74 
75  glonass_l2_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
76 
77  const std::array<uint16_t, GLONASS_GNAV_PREAMBLE_LENGTH_BITS> d_preambles_bits{GLONASS_GNAV_PREAMBLE};
78 
79  const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
80 
81  void decode_string(const double *symbols, int32_t frame_length);
82 
83  // Storage for incoming data
84  boost::circular_buffer<Gnss_Synchro> d_symbol_history;
85 
86  std::array<int32_t, GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS> d_preambles_symbols{};
87 
88  // Navigation Message variable
90 
91  Gnss_Satellite d_satellite;
92 
93  std::string d_dump_filename;
94  std::ofstream d_dump_file;
95 
96  double d_preamble_time_samples;
97  double delta_t; // GPS-GLONASS time offset
98  double d_TOW_at_current_symbol;
99 
100  uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
101  uint64_t d_preamble_index; // Index of sample number where preamble was found
102  uint32_t d_stat; // Status of decoder
103 
104  int32_t d_CRC_error_counter; // Number of failed CRC operations
105  int32_t d_channel;
106 
107  bool Flag_valid_word;
108  bool d_flag_frame_sync; // Indicate when a frame sync is achieved
109  bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
110  bool d_flag_preamble; // Flag indicating when preamble was found
111  bool flag_TOW_set; // Indicates when time of week is set
112  bool d_dump;
113  bool d_dump_mat;
114  bool d_remove_dat;
115 };
116 
117 
118 /** \} */
119 /** \} */
120 #endif // GNSS_SDR_GLONASS_L2_CA_TELEMETRY_DECODER_GS_H
Defines system parameters for GLONASS L1 C/A signal and NAV data.
Class that contains all the configuration parameters for generic telemetry decoder block...
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
This is where all signal processing takes place.
This interface represents a GNSS block.
void set_channel(int32_t channel)
Set receiver&#39;s channel.
Interface of the Gnss_Satellite class.
This class represents a GNSS satellite.
Interface of a GLONASS GNAV Data message decoder as described in GLONASS ICD (Edition 5...
~glonass_l2_ca_telemetry_decoder_gs()
Class destructor.
void set_satellite(const Gnss_Satellite &satellite)
Set satellite PRN.
This class decodes a GLONASS GNAV Data message as described in GLONASS ICD (Edition 5...
This class implements a block that decodes the GNAV data defined in GLONASS ICD v5.1.
Interface of the Gnss_Synchro class.