GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
10  *
11  * GNSS-SDR is a software defined Global Navigation
12  * Satellite Systems receiver
13  *
14  * This file is part of GNSS-SDR.
15  *
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 #ifndef GNSS_SDR_TCP_CMD_INTERFACE_H
21 #define GNSS_SDR_TCP_CMD_INTERFACE_H
22 
23 
24 #include "concurrent_queue.h"
25 #include <pmt/pmt.h>
26 #include <array>
27 #include <cstdint>
28 #include <ctime>
29 #include <functional>
30 #include <memory>
31 #include <string>
32 #include <unordered_map>
33 #include <vector>
34 
35 class PvtInterface;
36 
38 {
39 public:
41  ~TcpCmdInterface() = default;
42  void run_cmd_server(int tcp_port);
43  void set_msg_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue);
44 
45  /*!
46  * \brief gets the UTC time parsed from the last TC command issued
47  */
48  time_t get_utc_time() const;
49 
50  /*!
51  * \brief gets the Latitude, Longitude and Altitude vector from the last TC command issued
52  */
53  std::array<float, 3> get_LLH() const;
54 
55  void set_pvt(std::shared_ptr<PvtInterface> PVT_sptr);
56 
57 private:
58  std::unordered_map<std::string, std::function<std::string(const std::vector<std::string> &)>>
59  functions_;
60  std::string status(const std::vector<std::string> &commandLine);
61  std::string reset(const std::vector<std::string> &commandLine);
62  std::string standby(const std::vector<std::string> &commandLine);
63  std::string hotstart(const std::vector<std::string> &commandLine);
64  std::string warmstart(const std::vector<std::string> &commandLine);
65  std::string coldstart(const std::vector<std::string> &commandLine);
66  std::string set_ch_satellite(const std::vector<std::string> &commandLine);
67 
68  void register_functions();
69 
70  std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue_;
71  std::shared_ptr<PvtInterface> PVT_sptr_;
72 
73  float rx_latitude_;
74  float rx_longitude_;
75  float rx_altitude_;
76 
77  time_t receiver_utc_time_;
78 
79  bool keep_running_;
80 };
81 
82 #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:45
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