GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
11  *
12  * GNSS-SDR is a software defined Global Navigation
13  * Satellite Systems receiver
14  *
15  * This file is part of GNSS-SDR.
16  *
17  * SPDX-License-Identifier: GPL-3.0-or-later
18  *
19  * -----------------------------------------------------------------------------
20  */
21 
22 #ifndef GNSS_SDR_CHANNEL_FSM_H
23 #define GNSS_SDR_CHANNEL_FSM_H
24 
25 #include "acquisition_interface.h"
26 #include "concurrent_queue.h"
28 #include "tracking_interface.h"
29 #include <pmt/pmt.h>
30 #include <cstdint>
31 #include <memory>
32 #include <mutex>
33 
34 
35 /*!
36  * \brief This class implements a State Machine for channel
37  */
39 {
40 public:
41  ChannelFsm();
42  virtual ~ChannelFsm() = default;
43  explicit ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition);
44 
45  void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
46  void set_tracking(std::shared_ptr<TrackingInterface> tracking);
47  void set_telemetry(std::shared_ptr<TelemetryDecoderInterface> telemetry);
48  void set_queue(Concurrent_Queue<pmt::pmt_t>* queue);
49  void set_channel(uint32_t channel);
50  void start_acquisition();
51 
52  // FSM EVENTS
53  bool Event_start_acquisition();
54  bool Event_start_acquisition_fpga();
55  bool Event_stop_channel();
56  bool Event_failed_tracking_standby();
57  virtual bool Event_valid_acquisition();
58  virtual bool Event_failed_acquisition_repeat();
59  virtual bool Event_failed_acquisition_no_repeat();
60 
61 private:
62  void start_tracking();
63  void stop_acquisition();
64  void stop_tracking();
65  void request_satellite();
66  void notify_stop_tracking();
67 
68  std::shared_ptr<AcquisitionInterface> acq_;
69  std::shared_ptr<TrackingInterface> trk_;
70  std::shared_ptr<TelemetryDecoderInterface> nav_;
71 
72  std::mutex mx_;
73 
75 
76  uint32_t channel_;
77  uint32_t state_;
78 };
79 
80 #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:38
Header file of the interface to an acquisition GNSS block.
This class represents an interface to a tracking block.