From e8a03c485531fc7ebfe0fce7d703692605734db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Cebri=C3=A1n=20Juan?= Date: Mon, 31 Aug 2020 14:12:12 +0200 Subject: [PATCH] Telecommand status: print basic channel information Available info: channel number, system, signal and PRN. Missing info: mode, telemetry status, ephemeris status, Doppler and CN0 --- src/core/receiver/control_thread.cc | 1 + src/core/receiver/gnss_flowgraph.h | 8 ++++ src/core/receiver/tcp_cmd_interface.cc | 52 ++++++++++++++++++++------ src/core/receiver/tcp_cmd_interface.h | 3 ++ 4 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 2569c69e6..ea650ecaa 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -326,6 +326,7 @@ int ControlThread::run() // start the telecommand listener thread cmd_interface_.set_pvt(flowgraph_->get_pvt()); + cmd_interface_.set_channels(flowgraph_->get_channels()); cmd_interface_thread_ = std::thread(&ControlThread::telecommand_listener, this); #ifdef ENABLE_FPGA diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index eaac8c6fb..a53565577 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -145,6 +145,14 @@ public: return std::dynamic_pointer_cast(pvt_); } + /*! + * \brief Returns a smart pointer to the Channels object + */ + std::shared_ptr>> get_channels() + { + return std::make_shared>>(channels_); + } + /*! * \brief Priorize visible satellites in the specified vector */ diff --git a/src/core/receiver/tcp_cmd_interface.cc b/src/core/receiver/tcp_cmd_interface.cc index 4278fcc6e..6cec0808e 100644 --- a/src/core/receiver/tcp_cmd_interface.cc +++ b/src/core/receiver/tcp_cmd_interface.cc @@ -19,6 +19,7 @@ */ #include "tcp_cmd_interface.h" +#include "channel.h" #include "command_event.h" #include "pvt_interface.h" #include @@ -74,6 +75,12 @@ void TcpCmdInterface::set_pvt(std::shared_ptr PVT_sptr) } +void TcpCmdInterface::set_channels(std::shared_ptr>> channels_sptr) +{ + channels_sptr_ = std::move(channels_sptr); +} + + time_t TcpCmdInterface::get_utc_time() const { return receiver_utc_time_; @@ -123,18 +130,41 @@ std::string TcpCmdInterface::standby(const std::vector &commandLine std::string TcpCmdInterface::status(const std::vector &commandLine __attribute__((unused))) { std::stringstream str_stream; - // todo: implement the receiver status report - // str_stream << "-------------------------------------------------------\n"; - // str_stream << "ch | sys | sig | mode | Tlm | Eph | Doppler | CN0 |\n"; - // str_stream << " | | | | | | [Hz] | [dB - Hz] |\n"; - // str_stream << "-------------------------------------------------------\n"; - // int n_ch = 10; - // for (int n = 0; n < n_ch; n++) - // { - // str_stream << n << "GPS | L1CA | TRK | YES | YES | 23412.4 | 44.3 |\n"; - // } - // str_stream << "--------------------------------------------------------\n"; + str_stream << "----------------------------------------------------------------------------\n"; + str_stream << "| Ch | System | Signal | PRN | Mode | Tlm | Eph | Doppler | CN0 |\n"; + str_stream << "| | | | | | | | [Hz] | [dB-Hz] |\n"; + str_stream << "----------------------------------------------------------------------------\n"; + + int n_ch = static_cast(channels_sptr_->size()); + for (int n = 0; n < n_ch; n++) + { + std::shared_ptr + ch_sptr = std::dynamic_pointer_cast(channels_sptr_->at(n)); + + str_stream << std::fixed << std::setprecision(1) + << "| " + << std::right << std::setw(3) << n + << " | " + << std::left << std::setw(7) << ch_sptr->get_signal().get_satellite().get_system() + << " | " + << std::left << std::setw(9) << ch_sptr->get_signal().get_signal_str() + << " | " + << std::right << std::setw(3) << ch_sptr->get_signal().get_satellite().get_PRN() + << " | " + << std::left << std::setw(4) << "---" + << " | " + << std::left << std::setw(3) << "---" + << " | " + << std::left << std::setw(3) << "---" + << " | " + << std::right << std::setw(9) << 23412.46 + << " | " + << std::right << std::setw(7) << 44.32 + << " |" + << "\n"; + } + str_stream << "----------------------------------------------------------------------------\n"; double longitude_deg; double latitude_deg; diff --git a/src/core/receiver/tcp_cmd_interface.h b/src/core/receiver/tcp_cmd_interface.h index a8bcc0d37..2c7499aa3 100644 --- a/src/core/receiver/tcp_cmd_interface.h +++ b/src/core/receiver/tcp_cmd_interface.h @@ -33,6 +33,7 @@ #include class PvtInterface; +class ChannelInterface; class TcpCmdInterface { @@ -53,6 +54,7 @@ public: std::array get_LLH() const; void set_pvt(std::shared_ptr PVT_sptr); + void set_channels(std::shared_ptr>> channels_sptr); private: std::unordered_map &)>> @@ -69,6 +71,7 @@ private: std::shared_ptr> control_queue_; std::shared_ptr PVT_sptr_; + std::shared_ptr>> channels_sptr_; float rx_latitude_; float rx_longitude_;