GNSS-SDR  0.0.19
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 #include "GPS_L1_CA.h"
20 #include "gnss_block_interface.h"
21 #include "gnss_satellite.h"
22 #include "gnss_synchro.h"
23 #include "gnss_time.h" // for timetags produced by Tracking
24 #include "gps_navigation_message.h"
25 #include "nav_message_packet.h"
26 #include "tlm_conf.h"
27 #include "tlm_crc_stats.h"
28 #include <boost/circular_buffer.hpp>
29 #include <gnuradio/block.h> // for block
30 #include <gnuradio/types.h> // for gr_vector_const_void_star
31 #include <array> // for array
32 #include <cstdint> // for int32_t
33 #include <fstream> // for ofstream
34 #include <memory> // for std::unique_ptr
35 #include <string> // for string
36 
37 /** \addtogroup Telemetry_Decoder
38  * \{ */
39 /** \addtogroup Telemetry_Decoder_gnuradio_blocks telemetry_decoder_gr_blocks
40  * GNU Radio blocks for the demodulation of GNSS navigation messages.
41  * \{ */
42 
43 
45 
46 using gps_l1_ca_telemetry_decoder_gs_sptr = gnss_shared_ptr<gps_l1_ca_telemetry_decoder_gs>;
47 
48 gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs(
49  const Gnss_Satellite &satellite,
50  const Tlm_Conf &conf);
51 
52 /*!
53  * \brief This class implements a block that decodes the NAV data defined in IS-GPS-200M
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) override;
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  const Tlm_Conf &conf);
73 
74  gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf);
75 
76  void check_tlm_separation();
77  void frame_synchronization(const Gnss_Synchro &current_gs);
78  bool is_PLL_180_deg_phase_locked();
79  bool gps_word_parityCheck(uint32_t gpsword);
80  bool decode_subframe(double cn0, bool flag_invert);
81 
83  Gnss_Satellite d_satellite;
84  Nav_Message_Packet d_nav_msg_packet;
85  std::unique_ptr<Tlm_CRC_Stats> d_Tlm_CRC_Stats;
86 
87  std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
88 
89  std::string d_dump_filename;
90  std::ofstream d_dump_file;
91 
92  boost::circular_buffer<float> d_symbol_history;
93 
94  uint64_t d_sample_counter;
95  uint64_t d_preamble_index;
96  uint64_t d_last_valid_preamble;
97 
98  int32_t d_bits_per_preamble;
99  int32_t d_samples_per_preamble;
100  int32_t d_preamble_period_symbols;
101  int32_t d_CRC_error_counter;
102  int32_t d_channel;
103 
104  uint32_t d_required_symbols;
105  uint32_t d_prev_GPS_frame_4bytes;
106  uint32_t d_max_symbols_without_valid_frame;
107  uint32_t d_stat;
108  uint32_t d_TOW_at_Preamble_ms;
109  uint32_t d_TOW_at_current_symbol_ms;
110 
111  bool d_flag_frame_sync;
112  bool d_flag_preamble;
113  bool d_sent_tlm_failed_msg;
114  bool d_flag_PLL_180_deg_phase_locked;
115  bool d_flag_TOW_set;
116  bool d_dump;
117  bool d_dump_mat;
118  bool d_remove_dat;
119  bool d_enable_navdata_monitor;
120  bool d_dump_crc_stats;
121 };
122 
123 
124 /** \} */
125 /** \} */
126 #endif // GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)...
Defines system parameters for GPS L1 C/A signal and NAV data.
void set_channel(int channel)
Set receiver&#39;s channel.
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.
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-200M.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
Class that computes the telemetry CRC statistics.
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-200M.
void set_satellite(const Gnss_Satellite &satellite)
Set satellite PRN.
Interface of the Gnss_Synchro class.