2018-10-21 17:33:02 +00:00
|
|
|
/*!
|
|
|
|
* \file tcp_cmd_interface.h
|
|
|
|
*
|
2018-12-11 09:36:15 +00:00
|
|
|
* \brief Class that implements a TCP/IP telecommand command line interface
|
2018-10-21 17:33:02 +00:00
|
|
|
* for GNSS-SDR
|
|
|
|
* \author Javier Arribas jarribas (at) cttc.es
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-10-21 17:33:02 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2018-10-21 17:33:02 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-10-21 17:33:02 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-10-21 17:33:02 +00:00
|
|
|
*/
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_TCP_CMD_INTERFACE_H
|
|
|
|
#define GNSS_SDR_TCP_CMD_INTERFACE_H
|
2018-10-21 17:33:02 +00:00
|
|
|
|
2019-03-05 18:31:41 +00:00
|
|
|
|
2019-07-16 15:41:12 +00:00
|
|
|
#include "concurrent_queue.h"
|
|
|
|
#include <pmt/pmt.h>
|
2019-07-21 10:55:59 +00:00
|
|
|
#include <array>
|
2018-12-02 04:29:11 +00:00
|
|
|
#include <cstdint>
|
2018-11-20 20:57:59 +00:00
|
|
|
#include <ctime>
|
2018-12-02 04:29:11 +00:00
|
|
|
#include <functional>
|
2019-03-05 18:31:41 +00:00
|
|
|
#include <memory>
|
2018-12-02 04:29:11 +00:00
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Core
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Core_Receiver
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2019-03-05 18:31:41 +00:00
|
|
|
class PvtInterface;
|
2018-10-21 17:33:02 +00:00
|
|
|
|
|
|
|
class TcpCmdInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TcpCmdInterface();
|
2019-07-21 17:32:52 +00:00
|
|
|
~TcpCmdInterface() = default;
|
2018-10-21 17:33:02 +00:00
|
|
|
void run_cmd_server(int tcp_port);
|
2019-07-16 15:41:12 +00:00
|
|
|
void set_msg_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue);
|
2018-12-02 04:29:11 +00:00
|
|
|
|
2018-11-05 16:53:53 +00:00
|
|
|
/*!
|
|
|
|
* \brief gets the UTC time parsed from the last TC command issued
|
|
|
|
*/
|
2020-06-15 17:23:59 +00:00
|
|
|
time_t get_utc_time() const;
|
2018-12-02 04:29:11 +00:00
|
|
|
|
2018-11-05 16:53:53 +00:00
|
|
|
/*!
|
|
|
|
* \brief gets the Latitude, Longitude and Altitude vector from the last TC command issued
|
|
|
|
*/
|
2019-07-21 10:55:59 +00:00
|
|
|
std::array<float, 3> get_LLH() const;
|
2018-10-23 14:54:06 +00:00
|
|
|
|
2018-11-06 13:39:57 +00:00
|
|
|
void set_pvt(std::shared_ptr<PvtInterface> PVT_sptr);
|
2018-10-21 17:33:02 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::unordered_map<std::string, std::function<std::string(const std::vector<std::string> &)>>
|
2020-06-23 07:47:58 +00:00
|
|
|
functions_;
|
2018-10-23 14:54:06 +00:00
|
|
|
std::string status(const std::vector<std::string> &commandLine);
|
|
|
|
std::string reset(const std::vector<std::string> &commandLine);
|
2018-10-28 10:07:53 +00:00
|
|
|
std::string standby(const std::vector<std::string> &commandLine);
|
|
|
|
std::string hotstart(const std::vector<std::string> &commandLine);
|
2018-10-23 14:54:06 +00:00
|
|
|
std::string warmstart(const std::vector<std::string> &commandLine);
|
|
|
|
std::string coldstart(const std::vector<std::string> &commandLine);
|
|
|
|
std::string set_ch_satellite(const std::vector<std::string> &commandLine);
|
2018-10-21 17:33:02 +00:00
|
|
|
|
|
|
|
void register_functions();
|
2018-10-23 14:54:06 +00:00
|
|
|
|
2019-07-16 15:41:12 +00:00
|
|
|
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue_;
|
2020-06-23 07:47:58 +00:00
|
|
|
std::shared_ptr<PvtInterface> PVT_sptr_;
|
2018-11-05 16:53:53 +00:00
|
|
|
|
2019-07-21 10:55:59 +00:00
|
|
|
float rx_latitude_;
|
|
|
|
float rx_longitude_;
|
|
|
|
float rx_altitude_;
|
2018-11-06 13:39:57 +00:00
|
|
|
|
2020-06-23 07:47:58 +00:00
|
|
|
time_t receiver_utc_time_;
|
|
|
|
|
|
|
|
bool keep_running_;
|
2018-10-21 17:33:02 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_TCP_CMD_INTERFACE_H
|