GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
beidou_b3i_telemetry_decoder_gs.h
Go to the documentation of this file.
1 /*!
2  * \file beidou_b3i_telemetry_decoder_gs.h
3  * \brief Implementation of a BEIDOU B3I DNAV data decoder block
4  * \author Damian Miralles, 2019. 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_BEIDOU_B3I_TELEMETRY_DECODER_GS_H
18 #define GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_GS_H
19 
21 #include "gnss_block_interface.h"
22 #include "gnss_satellite.h"
23 #include "tlm_conf.h"
24 #include <boost/circular_buffer.hpp>
25 #include <gnuradio/block.h> // for block
26 #include <gnuradio/types.h> // for gr_vector_const_void_star
27 #include <array>
28 #include <cstdint>
29 #include <fstream>
30 #include <string>
31 
32 
33 /** \addtogroup Telemetry_Decoder
34  * \{ */
35 /** \addtogroup Telemetry_Decoder_gnuradio_blocks
36  * \{ */
37 
38 
40 
41 using beidou_b3i_telemetry_decoder_gs_sptr =
42  gnss_shared_ptr<beidou_b3i_telemetry_decoder_gs>;
43 
44 beidou_b3i_telemetry_decoder_gs_sptr beidou_b3i_make_telemetry_decoder_gs(
45  const Gnss_Satellite &satellite,
46  const Tlm_Conf &conf);
47 
48 /*!
49  * \brief This class implements a block that decodes the BeiDou DNAV data.
50  */
51 class beidou_b3i_telemetry_decoder_gs : public gr::block
52 {
53 public:
54  ~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
55  void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
56  void set_channel(int channel); //!< Set receiver's channel
57  void reset();
58 
59  /*!
60  * \brief This is where all signal processing takes place
61  */
62  int general_work(int noutput_items, gr_vector_int &ninput_items,
63  gr_vector_const_void_star &input_items,
64  gr_vector_void_star &output_items);
65 
66 private:
67  friend beidou_b3i_telemetry_decoder_gs_sptr beidou_b3i_make_telemetry_decoder_gs(
68  const Gnss_Satellite &satellite,
69  const Tlm_Conf &conf);
70 
71  beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
72 
73  void decode_subframe(float *symbols);
74  void decode_word(int32_t word_counter, const float *enc_word_symbols,
75  int32_t *dec_word_symbols);
76  void decode_bch15_11_01(const int32_t *bits, std::array<int32_t, 15> &decbits);
77 
78  // Preamble decoding
79  std::array<int32_t, BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS> d_preamble_samples{};
80  std::array<float, BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS> d_subframe_symbols{};
81 
82  // Storage for incoming data
83  boost::circular_buffer<float> d_symbol_history;
84 
85  // Navigation Message variable
87 
88  Gnss_Satellite d_satellite;
89 
90  std::string d_dump_filename;
91  std::ofstream d_dump_file;
92 
93  uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
94  uint64_t d_preamble_index; // Index of sample number where preamble was found
95  uint32_t d_required_symbols;
96  uint32_t d_stat; // Status of decoder
97 
98  int32_t d_channel;
99  int32_t d_CRC_error_counter; // Number of failed CRC operations
100  int32_t d_symbols_per_preamble;
101  int32_t d_samples_per_preamble;
102  int32_t d_preamble_period_samples;
103 
104  // Values to populate gnss synchronization structure
105  uint64_t d_last_valid_preamble;
106  uint32_t d_symbol_duration_ms;
107  uint32_t d_TOW_at_Preamble_ms;
108  uint32_t d_TOW_at_current_symbol_ms;
109 
110  bool flag_SOW_set; // Indicates when time of week is set
111  bool d_flag_frame_sync; // Indicate when a frame sync is achieved
112  bool d_flag_preamble; // Flag indicating when preamble was found
113  bool d_flag_valid_word;
114  bool d_sent_tlm_failed_msg;
115  bool Flag_valid_word;
116  bool d_dump;
117  bool d_dump_mat;
118  bool d_remove_dat;
119 };
120 
121 
122 /** \} */
123 /** \} */
124 #endif // GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_GS_H
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.
Interface of a BeiDou DNAV Data message decoder.
Class that contains all the configuration parameters for generic telemetry decoder block...
This class implements a block that decodes the BeiDou DNAV data.
This interface represents a GNSS block.
Interface of the Gnss_Satellite class.
This class represents a GNSS satellite.
void set_channel(int channel)
Set receiver&#39;s channel.
void set_satellite(const Gnss_Satellite &satellite)
Set satellite PRN.
This class decodes a BeiDou D1 NAV Data message.
~beidou_b3i_telemetry_decoder_gs()
Class destructor.