GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
galileo_telemetry_decoder_gs.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_telemetry_decoder_gs.h
3  * \brief Implementation of a Galileo unified INAV and FNAV message demodulator
4  * block
5  * \author Javier Arribas 2018. jarribas(at)cttc.es
6  *
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
11  *
12  * GNSS-SDR is a software defined Global Navigation
13  * Satellite Systems receiver
14  *
15  * This file is part of GNSS-SDR.
16  *
17  * SPDX-License-Identifier: GPL-3.0-or-later
18  *
19  * -----------------------------------------------------------------------------
20  */
21 
22 
23 #ifndef GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
24 #define GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
25 
26 
27 #include "galileo_fnav_message.h"
28 #include "galileo_inav_message.h"
29 #include "gnss_satellite.h"
30 #include <boost/circular_buffer.hpp>
31 #include <gnuradio/block.h> // for block
32 #include <gnuradio/types.h> // for gr_vector_const_void_star
33 #include <array>
34 #include <cstdint>
35 #include <fstream>
36 #include <string>
37 #include <vector>
38 #if GNURADIO_USES_STD_POINTERS
39 #include <memory> // for std::shared_ptr
40 #else
41 #include <boost/shared_ptr.hpp>
42 #endif
43 
45 
46 #if GNURADIO_USES_STD_POINTERS
47 using galileo_telemetry_decoder_gs_sptr = std::shared_ptr<galileo_telemetry_decoder_gs>;
48 #else
49 using galileo_telemetry_decoder_gs_sptr = boost::shared_ptr<galileo_telemetry_decoder_gs>;
50 #endif
51 
52 galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
53  const Gnss_Satellite &satellite,
54  int frame_type,
55  bool dump);
56 
57 /*!
58  * \brief This class implements a block that decodes the INAV and FNAV data defined in Galileo ICD
59  */
60 class galileo_telemetry_decoder_gs : public gr::block
61 {
62 public:
64  void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
65  void set_channel(int32_t channel); //!< Set receiver's channel
66  void reset();
67  int32_t flag_even_word_arrived;
68 
69  /*!
70  * \brief This is where all signal processing takes place
71  */
72  int general_work(int noutput_items, gr_vector_int &ninput_items,
73  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
74 
75 
76 private:
77  friend galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(
78  const Gnss_Satellite &satellite,
79  int frame_type,
80  bool dump);
81 
82  galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, int frame_type, bool dump);
83 
84  const int32_t d_nn = 2; // Coding rate 1/n
85  const int32_t d_KK = 7; // Constraint Length
86 
87  void viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits);
88  void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
89  void decode_INAV_word(float *page_part_symbols, int32_t frame_length);
90  void decode_FNAV_word(float *page_symbols, int32_t frame_length);
91 
92  // vars for Viterbi decoder
93  std::vector<int32_t> d_preamble_samples;
94  std::vector<float> d_page_part_symbols;
95  std::vector<int32_t> d_out0;
96  std::vector<int32_t> d_out1;
97  std::vector<int32_t> d_state0;
98  std::vector<int32_t> d_state1;
99 
100  std::string d_dump_filename;
101  std::ofstream d_dump_file;
102 
103  boost::circular_buffer<float> d_symbol_history;
104 
105  Gnss_Satellite d_satellite;
106 
107  // navigation message vars
108  Galileo_Inav_Message d_inav_nav;
109  Galileo_Fnav_Message d_fnav_nav;
110 
111  double d_delta_t; // GPS-GALILEO time offset
112 
113  uint64_t d_sample_counter;
114  uint64_t d_preamble_index;
115  uint64_t d_last_valid_preamble;
116 
117  int32_t d_mm = d_KK - 1;
118  int32_t d_codelength;
119  int32_t d_datalength;
120  int32_t d_frame_type;
121  int32_t d_bits_per_preamble;
122  int32_t d_samples_per_preamble;
123  int32_t d_preamble_period_symbols;
124  int32_t d_CRC_error_counter;
125  int32_t d_channel;
126 
127  uint32_t d_PRN_code_period_ms;
128  uint32_t d_required_symbols;
129  uint32_t d_frame_length_symbols;
130  uint32_t d_stat;
131  uint32_t d_TOW_at_Preamble_ms;
132  uint32_t d_TOW_at_current_symbol_ms;
133  uint32_t d_max_symbols_without_valid_frame;
134 
135  char d_band; // This variable will store which band we are dealing with (Galileo E1 or E5b)
136 
137  bool d_sent_tlm_failed_msg;
138  bool d_flag_frame_sync;
139  bool d_flag_PLL_180_deg_phase_locked;
140  bool d_flag_parity;
141  bool d_flag_preamble;
142  bool d_dump;
143 };
144 
145 #endif // GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
This class handles the Galileo F/NAV Data message, as described in the Galileo Open Service Signal in...
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.
void set_satellite(const Gnss_Satellite &satellite)
Set satellite PRN.
Implementation of a Galileo I/NAV Data message as described in Galileo OS SIS ICD Issue 1...
Interface of the Gnss_Satellite class.
This class handles the Galileo I/NAV Data message, as described in the Galileo Open Service Signal in...
This class represents a GNSS satellite.
Implementation of a Galileo F/NAV Data message as described in Galileo OS SIS ICD Issue 1...
void set_channel(int32_t channel)
Set receiver&#39;s channel.
This class implements a block that decodes the INAV and FNAV data defined in Galileo ICD...