GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
9  *
10  * GNSS-SDR is a software defined Global Navigation
11  * Satellite Systems receiver
12  *
13  * This file is part of GNSS-SDR.
14  *
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
21 #define GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
22 
23 #include "GPS_L1_CA.h"
24 #include "gnss_satellite.h"
25 #include "gnss_synchro.h"
26 #include "gps_navigation_message.h"
27 #include <boost/circular_buffer.hpp>
28 #include <gnuradio/block.h> // for block
29 #include <gnuradio/types.h> // for gr_vector_const_void_star
30 #include <array> // for array
31 #include <cstdint> // for int32_t
32 #include <fstream> // for ofstream
33 #include <string> // for string
34 #if GNURADIO_USES_STD_POINTERS
35 #include <memory> // for std::shared_ptr
36 #else
37 #include <boost/shared_ptr.hpp>
38 #endif
39 
41 
42 #if GNURADIO_USES_STD_POINTERS
43 using gps_l1_ca_telemetry_decoder_gs_sptr = std::shared_ptr<gps_l1_ca_telemetry_decoder_gs>;
44 #else
45 using gps_l1_ca_telemetry_decoder_gs_sptr = boost::shared_ptr<gps_l1_ca_telemetry_decoder_gs>;
46 #endif
47 
48 gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
49  const Gnss_Satellite &satellite,
50  bool dump);
51 
52 /*!
53  * \brief This class implements a block that decodes the NAV data defined in IS-GPS-200K
54  */
55 class gps_l1_ca_telemetry_decoder_gs : public gr::block
56 {
57 public:
59  void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
60  void set_channel(int channel); //!< Set receiver's channel
61  void reset();
62 
63  /*!
64  * \brief This is where all signal processing takes place
65  */
66  int general_work(int noutput_items, gr_vector_int &ninput_items,
67  gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
68 
69 private:
70  friend gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
71  const Gnss_Satellite &satellite,
72  bool dump);
73 
74  gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
75 
76  bool gps_word_parityCheck(uint32_t gpsword);
77  bool decode_subframe();
78 
80  Gnss_Satellite d_satellite;
81 
82  std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
83 
84  std::string d_dump_filename;
85  std::ofstream d_dump_file;
86 
87  boost::circular_buffer<float> d_symbol_history;
88 
89  uint64_t d_sample_counter;
90  uint64_t d_preamble_index;
91  uint64_t d_last_valid_preamble;
92 
93  int32_t d_bits_per_preamble;
94  int32_t d_samples_per_preamble;
95  int32_t d_preamble_period_symbols;
96  int32_t d_CRC_error_counter;
97  int32_t d_channel;
98 
99  uint32_t d_required_symbols;
100  uint32_t d_frame_length_symbols;
101  uint32_t d_prev_GPS_frame_4bytes;
102  uint32_t d_max_symbols_without_valid_frame;
103  uint32_t d_stat;
104  uint32_t d_TOW_at_Preamble_ms;
105  uint32_t d_TOW_at_current_symbol_ms;
106 
107  bool d_flag_frame_sync;
108  bool d_flag_parity;
109  bool d_flag_preamble;
110  bool d_sent_tlm_failed_msg;
111  bool d_flag_PLL_180_deg_phase_locked;
112  bool d_flag_TOW_set;
113  bool d_dump;
114 };
115 
116 #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.
This class implements a block that decodes the NAV data defined in IS-GPS-200K.
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.