diff --git a/src/core/receiver/tcp_cmd_interface.cc b/src/core/receiver/tcp_cmd_interface.cc index 5913034b5..9d3591488 100644 --- a/src/core/receiver/tcp_cmd_interface.cc +++ b/src/core/receiver/tcp_cmd_interface.cc @@ -39,16 +39,21 @@ void TcpCmdInterface::set_pvt(std::shared_ptr PVT_sptr) { PVT_sptr_ = PVT_sptr; } + + time_t TcpCmdInterface::get_utc_time() { return receiver_utc_time_; } + arma::vec TcpCmdInterface::get_LLH() { return arma::vec{rx_latitude_, rx_longitude_, rx_altitude_}; } -std::string TcpCmdInterface::reset(const std::vector &commandLine) + + +std::string TcpCmdInterface::reset(const std::vector &commandLine __attribute__((unused))) { std::string response; std::unique_ptr cmf(new ControlMessageFactory()); @@ -65,7 +70,8 @@ std::string TcpCmdInterface::reset(const std::vector &commandLine) return response; } -std::string TcpCmdInterface::standby(const std::vector &commandLine) + +std::string TcpCmdInterface::standby(const std::vector &commandLine __attribute__((unused))) { std::string response; std::unique_ptr cmf(new ControlMessageFactory()); @@ -81,7 +87,8 @@ std::string TcpCmdInterface::standby(const std::vector &commandLine return response; } -std::string TcpCmdInterface::status(const std::vector &commandLine) + +std::string TcpCmdInterface::status(const std::vector &commandLine __attribute__((unused))) { std::stringstream str_stream; //todo: implement the receiver status report @@ -130,18 +137,18 @@ std::string TcpCmdInterface::status(const std::vector &commandLine) return str_stream.str(); } + std::string TcpCmdInterface::hotstart(const std::vector &commandLine) { std::string response; if (commandLine.size() > 5) { - //read commandline time parameter + // Read commandline time parameter struct tm tm; strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm); receiver_utc_time_ = timegm(&tm); - - //read latitude, longitude, and height + // Read latitude, longitude, and height rx_latitude_ = std::stod(commandLine.at(3).c_str()); rx_longitude_ = std::stod(commandLine.at(4).c_str()); rx_altitude_ = std::stod(commandLine.at(5).c_str()); @@ -166,24 +173,25 @@ std::string TcpCmdInterface::hotstart(const std::vector &commandLin } else { - response = "ERROR: time parameter not found, please use hotstart %d/%m/%Y %H:%M:%S\n"; + response = "ERROR: time parameter not found, please use hotstart %d/%m/%Y %H:%M:%S Lat Long H\n"; } return response; } + std::string TcpCmdInterface::warmstart(const std::vector &commandLine) { std::string response; if (commandLine.size() > 5) { std::string tmp_str; - //read commandline time parameter + // Read commandline time parameter struct tm tm; tmp_str = commandLine.at(1) + commandLine.at(2); strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm); receiver_utc_time_ = timegm(&tm); - //read latitude, longitude, and height + // Read latitude, longitude, and height rx_latitude_ = std::stod(commandLine.at(3).c_str()); rx_longitude_ = std::stod(commandLine.at(4).c_str()); rx_altitude_ = std::stod(commandLine.at(5).c_str()); @@ -196,7 +204,7 @@ std::string TcpCmdInterface::warmstart(const std::vector &commandLi std::unique_ptr cmf(new ControlMessageFactory()); if (control_queue_ != nullptr) { - control_queue_->handle(cmf->GetQueueMessage(300, 13)); //send the standby message (who=300,what=13) + control_queue_->handle(cmf->GetQueueMessage(300, 13)); // send the warmstart message (who=300,what=13) response = "OK\n"; } else @@ -213,13 +221,13 @@ std::string TcpCmdInterface::warmstart(const std::vector &commandLi } -std::string TcpCmdInterface::coldstart(const std::vector &commandLine) +std::string TcpCmdInterface::coldstart(const std::vector &commandLine __attribute__((unused))) { std::string response; std::unique_ptr cmf(new ControlMessageFactory()); if (control_queue_ != nullptr) { - control_queue_->handle(cmf->GetQueueMessage(300, 11)); //send the standby message (who=300,what=11) + control_queue_->handle(cmf->GetQueueMessage(300, 11)); // send the coldstart message (who=300,what=11) response = "OK\n"; } else @@ -229,7 +237,8 @@ std::string TcpCmdInterface::coldstart(const std::vector &commandLi return response; } -std::string TcpCmdInterface::set_ch_satellite(const std::vector &commandLine) + +std::string TcpCmdInterface::set_ch_satellite(const std::vector &commandLine __attribute__((unused))) { std::string response; //todo: implement the set satellite command @@ -266,6 +275,8 @@ void TcpCmdInterface::set_msg_queue(gr::msg_queue::sptr control_queue) { control_queue_ = control_queue; } + + void TcpCmdInterface::run_cmd_server(int tcp_port) { // Get the port from the parameters @@ -315,7 +326,7 @@ void TcpCmdInterface::run_cmd_server(int tcp_port) if (cmd_vector.at(0).compare("exit") == 0) { error = boost::asio::error::eof; - //send cmd response + // send cmd response socket.write_some(boost::asio::buffer("OK\n"), not_throw); } else @@ -337,7 +348,7 @@ void TcpCmdInterface::run_cmd_server(int tcp_port) response = "ERROR: empty command\n"; } - //send cmd response + // send cmd response socket.write_some(boost::asio::buffer(response), not_throw); if (not_throw) {