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