GNSS-SDR  0.0.21
An Open Source GNSS Software Defined Receiver
beidou_b1i_telemetry_decoder_gs.h
Go to the documentation of this file.
1 /*!
2  * \file beidou_b1i_telemetry_decoder_gs.h
3  * \brief Implementation of a BEIDOU BI1 DNAV data decoder block
4  * \details Code added as part of GSoC 2018 program.
5  * \author Damian Miralles, 2018. dmiralles2009(at)gmail.com
6  * \author Sergi Segura, 2018. sergi.segura.munoz(at)gmail.es
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 #ifndef GNSS_SDR_BEIDOU_B1I_TELEMETRY_DECODER_GS_H
20 #define GNSS_SDR_BEIDOU_B1I_TELEMETRY_DECODER_GS_H
21 
22 
24 #include "nav_message_packet.h"
26 #include "tlm_conf.h"
27 #include <boost/circular_buffer.hpp>
28 #include <gnuradio/types.h> // for gr_vector_const_void_star
29 #include <array>
30 
31 
32 /** \addtogroup Telemetry_Decoder
33  * \{ */
34 /** \addtogroup Telemetry_Decoder_gnuradio_blocks
35  * \{ */
36 
37 
39 
40 using beidou_b1i_telemetry_decoder_gs_sptr = gnss_shared_ptr<beidou_b1i_telemetry_decoder_gs>;
41 
42 beidou_b1i_telemetry_decoder_gs_sptr beidou_b1i_make_telemetry_decoder_gs(
43  const Gnss_Satellite &satellite,
44  const Tlm_Conf &conf);
45 
46 
47 /*!
48  * \brief This class implements a block that decodes the BeiDou DNAV data.
49  * \note Code added as part of GSoC 2018 program
50  */
52 {
53 public:
54  ~beidou_b1i_telemetry_decoder_gs() override; //!< Class destructor
55  void set_satellite(const Gnss_Satellite &satellite) override; //!< Set satellite PRN
56  void set_channel(int channel) override; //!< Set receiver's channel
57  void reset() override;
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, gr_vector_void_star &output_items) override;
64 
65 private:
66  friend beidou_b1i_telemetry_decoder_gs_sptr beidou_b1i_make_telemetry_decoder_gs(
67  const Gnss_Satellite &satellite,
68  const Tlm_Conf &conf);
69 
70  beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
71 
72  void decode_subframe(float *symbols, double cn0);
73  void decode_word(int32_t word_counter, const float *enc_word_symbols, int32_t *dec_word_symbols);
74  void decode_bch15_11_01(const int32_t *bits, std::array<int32_t, 15> &decbits);
75 
76  // Preamble decoding
77  std::array<int32_t, BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS> d_preamble_samples{};
78 
79  std::array<float, BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS> d_subframe_symbols{};
80 
81  // Storage for incoming data
82  boost::circular_buffer<float> d_symbol_history;
83 
84  // Navigation Message variable
86 
87  Nav_Message_Packet d_nav_msg_packet;
88  std::unique_ptr<Tlm_CRC_Stats> d_Tlm_CRC_Stats;
89 
90  // Satellite Information and logging capacity
91  Gnss_Satellite d_satellite;
92  std::string d_dump_filename;
93  std::ofstream d_dump_file;
94 
95  uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
96  uint64_t d_preamble_index; // Index of sample number where preamble was found
97 
98  int32_t d_channel;
99  int32_t d_symbols_per_preamble;
100  int32_t d_samples_per_preamble;
101  int32_t d_preamble_period_samples;
102  int32_t d_CRC_error_counter; // Number of failed CRC operations
103  uint32_t d_required_symbols;
104  uint32_t d_stat; // Status of decoder
105 
106  // Values to populate gnss synchronization structure
107  uint64_t d_last_valid_preamble;
108  uint32_t d_symbol_duration_ms;
109  uint32_t d_TOW_at_Preamble_ms;
110  uint32_t d_TOW_at_current_symbol_ms;
111 
112  bool d_flag_SOW_set; // Indicates when time of week is set
113  bool d_flag_frame_sync; // Indicate when a frame sync is achieved
114  bool d_flag_preamble; // Flag indicating when preamble was found
115 
116  bool d_flag_valid_word;
117  bool d_sent_tlm_failed_msg;
118  bool d_dump;
119  bool d_dump_mat;
120  bool d_remove_dat;
121  bool d_enable_navdata_monitor;
122  bool d_dump_crc_stats;
123  bool d_tow_to_trk;
124 };
125 
126 
127 /** \} */
128 /** \} */
129 #endif // GNSS_SDR_BEIDOU_B1I_TELEMETRY_DECODER_GS_H
Common base class for telemetry decoder GNU Radio implementations.
Interface of a BeiDou DNAV Data message decoder.
~beidou_b1i_telemetry_decoder_gs() override
Class destructor.
Class that contains all the configuration parameters for generic telemetry decoder block...
This class represents a GNSS satellite.
Base class for telemetry decoder GNU Radio blocks.
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
This is where all signal processing takes place.
void set_channel(int channel) override
Set receiver&#39;s channel.
This class decodes a BeiDou D1 NAV Data message.
void set_satellite(const Gnss_Satellite &satellite) override
Set satellite PRN.
This class implements a block that decodes the BeiDou DNAV data.