GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
channel.h
Go to the documentation of this file.
1 /*!
2  * \file channel.h
3  * \brief Interface of a GNSS channel.
4  * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
5  * Luis Esteve, 2011. luis(at)epsilon-formacion.com
6  *
7  * It holds blocks for acquisition, tracking,
8  * navigation data extraction and pseudorange calculation.
9  *
10  * -----------------------------------------------------------------------------
11  *
12  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
13  * This file is part of GNSS-SDR.
14  *
15  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_CHANNEL_H
22 #define GNSS_SDR_CHANNEL_H
23 
24 #include "channel_fsm.h"
25 #include "channel_interface.h"
27 #include "concurrent_queue.h"
28 #include "gnss_signal.h"
29 #include "gnss_synchro.h"
30 #include <gnuradio/block.h>
31 #include <pmt/pmt.h>
32 #include <cstddef>
33 #include <cstdint>
34 #include <memory>
35 #include <mutex>
36 #include <string>
37 
38 /** \addtogroup Channel
39  * Classes containing a GNSS channel.
40  * \{ */
41 /** \addtogroup Channel_adapters channel_adapters
42  * Classes that wrap an AcquisitionInterface,
43  * a TrackingInterface and a TelemetryDecoderInterface, and handles
44  * their interaction.
45  * \{ */
46 
47 
50 class TrackingInterface;
52 
53 
54 /*!
55  * \brief This class represents a GNSS channel. It wraps an AcquisitionInterface,
56  * a TrackingInterface and a TelemetryDecoderInterface, and handles
57  * their interaction through a Finite State Machine
58  *
59  */
60 class Channel : public ChannelInterface
61 {
62 public:
63  //! Constructor
64  Channel(const ConfigurationInterface* configuration,
65  uint32_t channel,
66  std::shared_ptr<AcquisitionInterface> acq,
67  std::shared_ptr<TrackingInterface> trk,
68  std::shared_ptr<TelemetryDecoderInterface> nav,
69  const std::string& role,
70  const std::string& signal_str,
72 
73  ~Channel() = default; //!< Destructor
74 
75  void connect(gr::top_block_sptr top_block) override; //!< Connects the tracking block to the top_block and to the telemetry
76  void disconnect(gr::top_block_sptr top_block) override;
77  gr::basic_block_sptr get_left_block() override;
78  gr::basic_block_sptr get_left_block_trk() override; //!< Gets the GNU Radio tracking block input pointer
79  gr::basic_block_sptr get_right_block_trk() override; //!< Gets the GNU Radio tracking block output pointer
80  gr::basic_block_sptr get_left_block_acq() override; //!< Gets the GNU Radio acquisition block input pointer
81  gr::basic_block_sptr get_right_block_acq() override; //!< Gets the GNU Radio acquisition block output pointer
82  gr::basic_block_sptr get_right_block() override; //!< Gets the GNU Radio channel block output pointer
83 
84  inline std::string role() override { return role_; }
85  inline std::string implementation() override { return std::string("Channel"); } //!< Returns "Channel"
86  inline size_t item_size() override { return 2 * sizeof(float); }
87  Gnss_Signal get_signal() override;
88  void start_acquisition() override; //!< Start the State Machine
89  void stop_channel() override; //!< Stop the State Machine
90  void set_signal(const Gnss_Signal& gnss_signal_) override; //!< Sets the channel GNSS signal
91 
92  void assist_acquisition_doppler(double Carrier_Doppler_hz) override;
93 
94  inline std::shared_ptr<AcquisitionInterface> acquisition() const { return acq_; }
95  inline std::shared_ptr<TrackingInterface> tracking() const { return trk_; }
96  inline std::shared_ptr<TelemetryDecoderInterface> telemetry() const { return nav_; }
97 
98 private:
99  bool glonass_dll_pll_c_aid_tracking_check() const;
100  std::shared_ptr<ChannelFsm> channel_fsm_;
101  std::shared_ptr<AcquisitionInterface> acq_;
102  std::shared_ptr<TrackingInterface> trk_;
103  std::shared_ptr<TelemetryDecoderInterface> nav_;
104  channel_msg_receiver_cc_sptr channel_msg_rx_;
105  Gnss_Synchro gnss_synchro_{};
106  Gnss_Signal gnss_signal_;
107  std::string role_;
108  std::mutex mx_;
109  uint32_t channel_;
110  int glonass_extend_correlation_ms_;
111  bool connected_;
112  bool repeat_;
113  bool flag_enable_fpga_;
114 };
115 
116 
117 /** \} */
118 /** \} */
119 #endif // GNSS_SDR_CHANNEL_H
gr::basic_block_sptr get_left_block_trk() override
Gets the GNU Radio tracking block input pointer.
Interface of a thread-safe std::queue.
Channel(const ConfigurationInterface *configuration, uint32_t channel, std::shared_ptr< AcquisitionInterface > acq, std::shared_ptr< TrackingInterface > trk, std::shared_ptr< TelemetryDecoderInterface > nav, const std::string &role, const std::string &signal_str, Concurrent_Queue< pmt::pmt_t > *queue)
Constructor.
void set_signal(const Gnss_Signal &gnss_signal_) override
Sets the channel GNSS signal.
gr::basic_block_sptr get_right_block_acq() override
Gets the GNU Radio acquisition block output pointer.
gr::basic_block_sptr get_left_block_acq() override
Gets the GNU Radio acquisition block input pointer.
void connect(gr::top_block_sptr top_block) override
Connects the tracking block to the top_block and to the telemetry.
This class represents an interface to a channel GNSS block.
Interface of the State Machine for channel.
This class represents a GNSS channel. It wraps an AcquisitionInterface, a TrackingInterface and a Tel...
Definition: channel.h:60
This abstract class represents an interface to an acquisition GNSS block.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
Implementation of the Gnss_Signal class.
GNU Radio block that receives asynchronous channel messages from acquisition and tracking blocks...
This abstract class represents an interface to configuration parameters.
gr::basic_block_sptr get_right_block_trk() override
Gets the GNU Radio tracking block output pointer.
This abstract class represents an interface to a channel GNSS block.
This abstract class represents an interface to a navigation GNSS block.
gr::basic_block_sptr get_right_block() override
Gets the GNU Radio channel block output pointer.
This class represents a GNSS signal.
Definition: gnss_signal.h:37
std::string implementation() override
Returns "Channel".
Definition: channel.h:85
void start_acquisition() override
Start the State Machine.
This abstract class represents an interface to a tracking block.
~Channel()=default
Destructor.
void stop_channel() override
Stop the State Machine.
Interface of the Gnss_Synchro class.