GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
channel_fsm.h
Go to the documentation of this file.
1 /*!
2  * \file channel_fsm.h
3  * \brief Interface of the State Machine for channel
4  * \authors Javier Arribas, 2019. javiarribas@gmail.com
5  * Antonio Ramos, 2017. antonio.ramos(at)cttc.es
6  * Luis Esteve, 2011. luis(at)epsilon-formacion.com
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 #ifndef GNSS_SDR_CHANNEL_FSM_H
20 #define GNSS_SDR_CHANNEL_FSM_H
21 
22 #include "acquisition_interface.h"
23 #include "concurrent_queue.h"
25 #include "tracking_interface.h"
26 #include <pmt/pmt.h>
27 #include <cstdint>
28 #include <memory>
29 #include <mutex>
30 
31 /** \addtogroup Channel
32  * \{ */
33 /** \addtogroup Channel_libs channel_libs
34  * Library with utilities for a GNSS Channel.
35  * \{ */
36 
37 
38 /*!
39  * \brief This class implements a State Machine for channel
40  */
42 {
43 public:
44  ChannelFsm();
45  virtual ~ChannelFsm() = default;
46  explicit ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition);
47 
48  void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
49  void set_tracking(std::shared_ptr<TrackingInterface> tracking);
50  void set_telemetry(std::shared_ptr<TelemetryDecoderInterface> telemetry);
51  void set_queue(Concurrent_Queue<pmt::pmt_t>* queue);
52  void set_channel(uint32_t channel);
53  void start_acquisition();
54 
55  // FSM EVENTS
56  bool Event_start_acquisition();
57  bool Event_start_acquisition_fpga();
58  bool Event_stop_channel();
59  bool Event_failed_tracking_standby();
60  virtual bool Event_valid_acquisition();
61  virtual bool Event_failed_acquisition_repeat();
62  virtual bool Event_failed_acquisition_no_repeat();
63 
64 private:
65  void start_tracking();
66  void stop_acquisition();
67  void stop_tracking();
68  void request_satellite();
69  void notify_stop_tracking();
70 
71  std::shared_ptr<AcquisitionInterface> acq_;
72  std::shared_ptr<TrackingInterface> trk_;
73  std::shared_ptr<TelemetryDecoderInterface> nav_;
74 
75  std::mutex mx_;
76 
78 
79  uint32_t channel_;
80  uint32_t state_;
81 };
82 
83 
84 /** \} */
85 /** \} */
86 #endif // GNSS_SDR_CHANNEL_FSM_H
Interface of a thread-safe std::queue.
This class represents an interface to a telemetry decoder block.
This class implements a State Machine for channel.
Definition: channel_fsm.h:41
Header file of the interface to an acquisition GNSS block.
This class represents an interface to a tracking block.