2011-10-01 18:45:20 +00:00
|
|
|
/*!
|
2015-05-21 09:29:56 +00:00
|
|
|
* \file channel_fsm.h
|
2018-01-04 09:51:47 +00:00
|
|
|
* \brief Interface of the State Machine for channel
|
2019-03-22 15:03:09 +00:00
|
|
|
* \authors Javier Arribas, 2019. javiarribas@gmail.com
|
|
|
|
* Antonio Ramos, 2017. antonio.ramos(at)cttc.es
|
2018-01-04 11:33:13 +00:00
|
|
|
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2015-01-08 18:49:59 +00:00
|
|
|
* (at your option) any later version.
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-05-13 20:49:11 +00:00
|
|
|
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
2011-10-01 18:45:20 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2015-05-21 09:29:56 +00:00
|
|
|
#ifndef GNSS_SDR_CHANNEL_FSM_H
|
|
|
|
#define GNSS_SDR_CHANNEL_FSM_H
|
2011-10-01 18:45:20 +00:00
|
|
|
|
|
|
|
#include "acquisition_interface.h"
|
2019-07-16 15:41:12 +00:00
|
|
|
#include "concurrent_queue.h"
|
2019-03-18 15:28:49 +00:00
|
|
|
#include "telemetry_decoder_interface.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "tracking_interface.h"
|
2019-07-16 15:41:12 +00:00
|
|
|
#include <pmt/pmt.h>
|
2018-08-13 08:18:05 +00:00
|
|
|
#include <cstdint>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
|
|
|
|
2014-01-12 20:07:38 +00:00
|
|
|
|
2011-10-01 18:45:20 +00:00
|
|
|
/*!
|
2018-01-04 11:16:12 +00:00
|
|
|
* \brief This class implements a State Machine for channel
|
2011-10-01 18:45:20 +00:00
|
|
|
*/
|
2018-01-04 09:51:47 +00:00
|
|
|
class ChannelFsm
|
2011-10-01 18:45:20 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-05-21 09:29:56 +00:00
|
|
|
ChannelFsm();
|
2016-05-02 15:26:32 +00:00
|
|
|
ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition);
|
2011-10-01 18:45:20 +00:00
|
|
|
|
2016-05-02 15:26:32 +00:00
|
|
|
void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
|
|
|
|
void set_tracking(std::shared_ptr<TrackingInterface> tracking);
|
2019-03-18 15:28:49 +00:00
|
|
|
void set_telemetry(std::shared_ptr<TelemetryDecoderInterface> telemetry);
|
2019-07-16 15:41:12 +00:00
|
|
|
void set_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
|
2018-08-13 08:18:05 +00:00
|
|
|
void set_channel(uint32_t channel);
|
2019-03-22 15:03:09 +00:00
|
|
|
void start_acquisition();
|
2019-03-04 07:12:50 +00:00
|
|
|
// FSM EVENTS
|
2018-01-08 09:57:01 +00:00
|
|
|
bool Event_start_acquisition();
|
2019-03-22 15:03:09 +00:00
|
|
|
bool Event_start_acquisition_fpga();
|
2018-01-08 09:57:01 +00:00
|
|
|
bool Event_valid_acquisition();
|
2018-10-28 10:07:53 +00:00
|
|
|
bool Event_stop_channel();
|
2018-01-08 09:57:01 +00:00
|
|
|
bool Event_failed_acquisition_repeat();
|
|
|
|
bool Event_failed_acquisition_no_repeat();
|
|
|
|
bool Event_failed_tracking_standby();
|
2011-10-01 18:45:20 +00:00
|
|
|
|
|
|
|
private:
|
2018-01-04 09:51:47 +00:00
|
|
|
void start_tracking();
|
2018-10-28 10:07:53 +00:00
|
|
|
void stop_acquisition();
|
|
|
|
void stop_tracking();
|
2018-01-04 09:51:47 +00:00
|
|
|
void request_satellite();
|
|
|
|
void notify_stop_tracking();
|
|
|
|
|
2016-05-02 15:26:32 +00:00
|
|
|
std::shared_ptr<AcquisitionInterface> acq_;
|
|
|
|
std::shared_ptr<TrackingInterface> trk_;
|
2019-03-18 15:28:49 +00:00
|
|
|
std::shared_ptr<TelemetryDecoderInterface> nav_;
|
2019-07-16 15:41:12 +00:00
|
|
|
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
|
2018-08-13 08:18:05 +00:00
|
|
|
uint32_t channel_;
|
|
|
|
uint32_t d_state;
|
2018-01-04 09:51:47 +00:00
|
|
|
std::mutex mx;
|
2011-10-01 18:45:20 +00:00
|
|
|
};
|
|
|
|
|
2019-03-18 15:28:49 +00:00
|
|
|
#endif // GNSS_SDR_CHANNEL_FSM_H
|