GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
tcp_cmd_interface.h
Go to the documentation of this file.
1 /*!
2  * \file tcp_cmd_interface.h
3  *
4  * \brief Class that implements a TCP/IP telecommand command line interface
5  * for GNSS-SDR
6  * \author Javier Arribas jarribas (at) cttc.es
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 #ifndef GNSS_SDR_TCP_CMD_INTERFACE_H
19 #define GNSS_SDR_TCP_CMD_INTERFACE_H
20 
21 
22 #include "concurrent_queue.h"
23 #include <pmt/pmt.h>
24 #include <array>
25 #include <cstdint>
26 #include <ctime>
27 #include <functional>
28 #include <memory>
29 #include <string>
30 #include <unordered_map>
31 #include <vector>
32 
33 /** \addtogroup Core
34  * \{ */
35 /** \addtogroup Core_Receiver
36  * \{ */
37 
38 
39 class PvtInterface;
40 
42 {
43 public:
45  ~TcpCmdInterface() = default;
46  void run_cmd_server(int tcp_port);
47  void set_msg_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue);
48 
49  /*!
50  * \brief gets the UTC time parsed from the last TC command issued
51  */
52  time_t get_utc_time() const;
53 
54  /*!
55  * \brief gets the Latitude, Longitude and Altitude vector from the last TC command issued
56  */
57  std::array<float, 3> get_LLH() const;
58 
59  void set_pvt(std::shared_ptr<PvtInterface> PVT_sptr);
60 
61 private:
62  std::unordered_map<std::string, std::function<std::string(const std::vector<std::string> &)>>
63  functions_;
64  std::string status(const std::vector<std::string> &commandLine);
65  std::string reset(const std::vector<std::string> &commandLine);
66  std::string standby(const std::vector<std::string> &commandLine);
67  std::string hotstart(const std::vector<std::string> &commandLine);
68  std::string warmstart(const std::vector<std::string> &commandLine);
69  std::string coldstart(const std::vector<std::string> &commandLine);
70  std::string set_ch_satellite(const std::vector<std::string> &commandLine);
71 
72  void register_functions();
73 
74  std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue_;
75  std::shared_ptr<PvtInterface> PVT_sptr_;
76 
77  float rx_latitude_;
78  float rx_longitude_;
79  float rx_altitude_;
80 
81  time_t receiver_utc_time_;
82 
83  bool keep_running_;
84 };
85 
86 
87 /** \} */
88 /** \} */
89 #endif // GNSS_SDR_TCP_CMD_INTERFACE_H
Interface of a thread-safe std::queue.
This class represents an interface to a PVT block.
Definition: pvt_interface.h:48
time_t get_utc_time() const
gets the UTC time parsed from the last TC command issued
std::array< float, 3 > get_LLH() const
gets the Latitude, Longitude and Altitude vector from the last TC command issued