GNSS-SDR  0.0.14
An Open Source GNSS Software Defined Receiver
gps_l1_ca_telemetry_decoder_gs.h
Go to the documentation of this file.
1 /*!
2  * \file gps_l1_ca_telemetry_decoder_gs.h
3  * \brief Interface of a NAV message demodulator block based on
4  * Kay Borre book MATLAB-based GPS receiver
5  * \author Javier Arribas, 2011. jarribas(at)cttc.es
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_GPS_L1_CA_TELEMETRY_DECODER_GS_H
18 #define GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
19 
20 #include "GPS_L1_CA.h"
21 #include "gnss_block_interface.h"
22 #include "gnss_satellite.h"
23 #include "gnss_synchro.h"
24 #include "gps_navigation_message.h"
25 #include "tlm_conf.h"
26 #include <boost/circular_buffer.hpp>
27 #include <gnuradio/block.h> // for block
28 #include <gnuradio/types.h> // for gr_vector_const_void_star
29 #include <array> // for array
30 #include <cstdint> // for int32_t
31 #include <fstream> // for ofstream
32 #include <string> // for string
33 
34 /** \addtogroup Telemetry_Decoder
35  * \{ */
36 /** \addtogroup Telemetry_Decoder_gnuradio_blocks telemetry_decoder_gr_blocks
37  * GNU Radio blocks for the demodulation of GNSS navigation messages.
38  * \{ */
39 
40 
42 
43 using gps_l1_ca_telemetry_decoder_gs_sptr = gnss_shared_ptr<gps_l1_ca_telemetry_decoder_gs>;
44 
45 gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_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 NAV data defined in IS-GPS-200K
51  */
52 class gps_l1_ca_telemetry_decoder_gs : public gr::block
53 {
54 public:
56  void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
57  void set_channel(int channel); //!< Set receiver's channel
58  void reset();
59 
60  /*!
61  * \brief This is where all signal processing takes place
62  */
63  int general_work(int noutput_items, gr_vector_int &ninput_items,
64  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
65 
66 private:
67  friend gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
68  const Gnss_Satellite &satellite,
69  const Tlm_Conf &conf);
70 
71  gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
72 
73  bool gps_word_parityCheck(uint32_t gpsword);
74  bool decode_subframe();
75 
77  Gnss_Satellite d_satellite;
78 
79  std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
80 
81  std::string d_dump_filename;
82  std::ofstream d_dump_file;
83 
84  boost::circular_buffer<float> d_symbol_history;
85 
86  uint64_t d_sample_counter;
87  uint64_t d_preamble_index;
88  uint64_t d_last_valid_preamble;
89 
90  int32_t d_bits_per_preamble;
91  int32_t d_samples_per_preamble;
92  int32_t d_preamble_period_symbols;
93  int32_t d_CRC_error_counter;
94  int32_t d_channel;
95 
96  uint32_t d_required_symbols;
97  uint32_t d_frame_length_symbols;
98  uint32_t d_prev_GPS_frame_4bytes;
99  uint32_t d_max_symbols_without_valid_frame;
100  uint32_t d_stat;
101  uint32_t d_TOW_at_Preamble_ms;
102  uint32_t d_TOW_at_current_symbol_ms;
103 
104  bool d_flag_frame_sync;
105  bool d_flag_parity;
106  bool d_flag_preamble;
107  bool d_sent_tlm_failed_msg;
108  bool d_flag_PLL_180_deg_phase_locked;
109  bool d_flag_TOW_set;
110  bool d_dump;
111  bool d_dump_mat;
112  bool d_remove_dat;
113 };
114 
115 
116 /** \} */
117 /** \} */
118 #endif // GNSS_SDR_GPS_L1_CA_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.
Defines system parameters for GPS L1 C/A signal and NAV data.
void set_channel(int channel)
Set receiver&#39;s channel.
Class that contains all the configuration parameters for generic telemetry decoder block...
This class implements a block that decodes the NAV data defined in IS-GPS-200K.
This interface represents a GNSS block.
Interface of the Gnss_Satellite class.
This class represents a GNSS satellite.
Interface of a GPS NAV Data message decoder.
This class decodes a GPS NAV Data message as described in IS-GPS-200K.
void set_satellite(const Gnss_Satellite &satellite)
Set satellite PRN.
Interface of the Gnss_Synchro class.