GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
galileo_e6_has_msg_receiver.h
Go to the documentation of this file.
1 /*!
2  * \file galileo_e6_has_msg_receiver.h
3  * \brief GNU Radio block that processes Galileo HAS message pages received from
4  * Galileo E6B telemetry blocks. After successful decoding, sends the content to
5  * the PVT block.
6  * \author Carles Fernandez-Prades, 2021. cfernandez(at)cttc.es
7  * \author Javier Arribas, 2021. jarribas(at)cttc.es
8  *
9  * -----------------------------------------------------------------------------
10  *
11  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12  * This file is part of GNSS-SDR.
13  *
14  * Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H
21 #define GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H
22 
23 #include "Galileo_CNAV.h" // for GALILEO_CNAV_* constants
24 #include "galileo_has_data.h" // for Galileo_HAS_data
25 #include "gnss_block_interface.h" // for gnss_shared_ptr
26 #include "nav_message_packet.h" // for Nav_Message_Packet
27 #include <gnuradio/block.h> // for gr::block
28 #include <pmt/pmt.h> // for pmt::pmt_t
29 #include <bitset>
30 #include <cstdint>
31 #include <memory> // for std::unique_ptr
32 #include <string>
33 #include <utility> // std::pair
34 #include <vector>
35 
36 /** \addtogroup Core
37  * \{ */
38 /** \addtogroup Core_Receiver_Library
39  * \{ */
40 
41 class Galileo_HAS_page;
42 class ReedSolomon;
44 
45 using galileo_e6_has_msg_receiver_sptr = gnss_shared_ptr<galileo_e6_has_msg_receiver>;
46 
47 galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make();
48 
49 /*!
50  * \brief GNU Radio block that receives asynchronous Galileo HAS message pages
51  * from the telemetry blocks, stores them in memory, and decodes HAS messages
52  * when enough data have been received.
53  * The decoded HAS message is sent to the PVT block.
54  */
55 class galileo_e6_has_msg_receiver : public gr::block
56 {
57 public:
58  ~galileo_e6_has_msg_receiver() = default; //!< Default destructor
59  void set_enable_navdata_monitor(bool enable);
60  std::shared_ptr<Galileo_HAS_data> process_test_page(const pmt::pmt_t& msg); //!< For testing purposes only
61 
62 private:
63  friend galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make();
65 
66  void msg_handler_galileo_e6_has(const pmt::pmt_t& msg);
67  void process_HAS_page(const Galileo_HAS_page& has_page);
68  void read_MT1_header(const std::string& message_header);
69  void read_MT1_body(const std::string& message_body);
70  void delete_outdated_data(const Galileo_HAS_page& has_page);
71 
72  int decode_message_type1(uint8_t message_id, uint8_t message_size);
73 
74  uint16_t read_has_message_header_parameter_uint16(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const;
75  uint8_t read_has_message_header_parameter_uint8(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const;
76  bool read_has_message_header_parameter_bool(const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS>& bits, const std::pair<int32_t, int32_t>& parameter) const;
77 
78  uint64_t read_has_message_body_uint64(const std::string& bits) const;
79  uint16_t read_has_message_body_uint16(const std::string& bits) const;
80  int16_t read_has_message_body_int16(const std::string& bits) const;
81  uint8_t read_has_message_body_uint8(const std::string& bits) const;
82 
83  template <class T>
84  std::string debug_print_vector(const std::string& title, const std::vector<T>& vec) const; // only for debug purposes
85 
86  template <class T>
87  std::string debug_print_matrix(const std::string& title, const std::vector<std::vector<T>>& mat) const; // only for debug purposes
88 
89  std::unique_ptr<ReedSolomon> d_rs;
90  Galileo_HAS_data d_HAS_data{};
91  Nav_Message_Packet d_nav_msg_packet;
92 
93  // Store decoding matrices and received PIDs
94  std::vector<std::vector<uint64_t>> d_received_timestamps;
95  std::vector<std::vector<std::vector<uint8_t>>> d_C_matrix;
96  std::vector<std::vector<uint8_t>> d_M_matrix;
97  std::vector<std::vector<uint8_t>> d_received_pids;
98  std::vector<uint64_t> d_printed_timestamps;
99  std::vector<bool> d_printed_mids;
100 
101  // Store masks
102  std::vector<int> d_nsat_in_mask_id;
103  std::vector<std::vector<uint8_t>> d_gnss_id_in_mask;
104  std::vector<std::vector<uint64_t>> d_satellite_mask;
105  std::vector<std::vector<uint16_t>> d_signal_mask;
106  std::vector<std::vector<bool>> d_cell_mask_availability_flag;
107  std::vector<std::vector<std::vector<std::vector<bool>>>> d_cell_mask;
108  std::vector<uint8_t> d_nsys_in_mask;
109  std::vector<std::vector<uint8_t>> d_nav_message_mask;
110 
111  uint8_t d_current_has_status{};
112  uint8_t d_current_message_id{};
113  bool d_new_message{};
114  bool d_enable_navdata_monitor{};
115 };
116 
117 
118 /** \} */
119 /** \} */
120 #endif // GNSS_SDR_GALILEO_E6_HAS_MSG_RECEIVER_H
std::shared_ptr< Galileo_HAS_data > process_test_page(const pmt::pmt_t &msg)
For testing purposes only.
Class implementing a Reed-Solomon encoder and decoder RS(255,K,d) where k=255-nroots is the informati...
Definition: reed_solomon.h:40
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...
This interface represents a GNSS block.
Galileo CNAV mesage constants. Data from: Galileo High Accuracy Service Signal-In-Space Interface Con...
GNU Radio block that receives asynchronous Galileo HAS message pages from the telemetry blocks...
This class is a storage for Galileo HAS message page, as defined in Galileo High Accuracy Service Sig...
Class for Galileo HAS message type 1 data storage.
~galileo_e6_has_msg_receiver()=default
Default destructor.