Remove warnings

This commit is contained in:
Carles Fernandez 2018-11-20 22:01:48 +01:00
parent f8f235f7dd
commit df0021cfb0
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
1 changed files with 26 additions and 15 deletions

View File

@ -39,16 +39,21 @@ void TcpCmdInterface::set_pvt(std::shared_ptr<PvtInterface> PVT_sptr)
{ {
PVT_sptr_ = PVT_sptr; PVT_sptr_ = PVT_sptr;
} }
time_t TcpCmdInterface::get_utc_time() time_t TcpCmdInterface::get_utc_time()
{ {
return receiver_utc_time_; return receiver_utc_time_;
} }
arma::vec TcpCmdInterface::get_LLH() arma::vec TcpCmdInterface::get_LLH()
{ {
return arma::vec{rx_latitude_, rx_longitude_, rx_altitude_}; return arma::vec{rx_latitude_, rx_longitude_, rx_altitude_};
} }
std::string TcpCmdInterface::reset(const std::vector<std::string> &commandLine)
std::string TcpCmdInterface::reset(const std::vector<std::string> &commandLine __attribute__((unused)))
{ {
std::string response; std::string response;
std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory()); std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory());
@ -65,7 +70,8 @@ std::string TcpCmdInterface::reset(const std::vector<std::string> &commandLine)
return response; return response;
} }
std::string TcpCmdInterface::standby(const std::vector<std::string> &commandLine)
std::string TcpCmdInterface::standby(const std::vector<std::string> &commandLine __attribute__((unused)))
{ {
std::string response; std::string response;
std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory()); std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory());
@ -81,7 +87,8 @@ std::string TcpCmdInterface::standby(const std::vector<std::string> &commandLine
return response; return response;
} }
std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine)
std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine __attribute__((unused)))
{ {
std::stringstream str_stream; std::stringstream str_stream;
//todo: implement the receiver status report //todo: implement the receiver status report
@ -130,18 +137,18 @@ std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine)
return str_stream.str(); return str_stream.str();
} }
std::string TcpCmdInterface::hotstart(const std::vector<std::string> &commandLine) std::string TcpCmdInterface::hotstart(const std::vector<std::string> &commandLine)
{ {
std::string response; std::string response;
if (commandLine.size() > 5) if (commandLine.size() > 5)
{ {
//read commandline time parameter // Read commandline time parameter
struct tm tm; struct tm tm;
strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm); strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm);
receiver_utc_time_ = timegm(&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_latitude_ = std::stod(commandLine.at(3).c_str());
rx_longitude_ = std::stod(commandLine.at(4).c_str()); rx_longitude_ = std::stod(commandLine.at(4).c_str());
rx_altitude_ = std::stod(commandLine.at(5).c_str()); rx_altitude_ = std::stod(commandLine.at(5).c_str());
@ -166,24 +173,25 @@ std::string TcpCmdInterface::hotstart(const std::vector<std::string> &commandLin
} }
else 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; return response;
} }
std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLine) std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLine)
{ {
std::string response; std::string response;
if (commandLine.size() > 5) if (commandLine.size() > 5)
{ {
std::string tmp_str; std::string tmp_str;
//read commandline time parameter // Read commandline time parameter
struct tm tm; struct tm tm;
tmp_str = commandLine.at(1) + commandLine.at(2); tmp_str = commandLine.at(1) + commandLine.at(2);
strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm); strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm);
receiver_utc_time_ = timegm(&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_latitude_ = std::stod(commandLine.at(3).c_str());
rx_longitude_ = std::stod(commandLine.at(4).c_str()); rx_longitude_ = std::stod(commandLine.at(4).c_str());
rx_altitude_ = std::stod(commandLine.at(5).c_str()); rx_altitude_ = std::stod(commandLine.at(5).c_str());
@ -196,7 +204,7 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory()); std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory());
if (control_queue_ != nullptr) 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"; response = "OK\n";
} }
else else
@ -213,13 +221,13 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
} }
std::string TcpCmdInterface::coldstart(const std::vector<std::string> &commandLine) std::string TcpCmdInterface::coldstart(const std::vector<std::string> &commandLine __attribute__((unused)))
{ {
std::string response; std::string response;
std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory()); std::unique_ptr<ControlMessageFactory> cmf(new ControlMessageFactory());
if (control_queue_ != nullptr) 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"; response = "OK\n";
} }
else else
@ -229,7 +237,8 @@ std::string TcpCmdInterface::coldstart(const std::vector<std::string> &commandLi
return response; return response;
} }
std::string TcpCmdInterface::set_ch_satellite(const std::vector<std::string> &commandLine)
std::string TcpCmdInterface::set_ch_satellite(const std::vector<std::string> &commandLine __attribute__((unused)))
{ {
std::string response; std::string response;
//todo: implement the set satellite command //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; control_queue_ = control_queue;
} }
void TcpCmdInterface::run_cmd_server(int tcp_port) void TcpCmdInterface::run_cmd_server(int tcp_port)
{ {
// Get the port from the parameters // 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) if (cmd_vector.at(0).compare("exit") == 0)
{ {
error = boost::asio::error::eof; error = boost::asio::error::eof;
//send cmd response // send cmd response
socket.write_some(boost::asio::buffer("OK\n"), not_throw); socket.write_some(boost::asio::buffer("OK\n"), not_throw);
} }
else else
@ -337,7 +348,7 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
response = "ERROR: empty command\n"; response = "ERROR: empty command\n";
} }
//send cmd response // send cmd response
socket.write_some(boost::asio::buffer(response), not_throw); socket.write_some(boost::asio::buffer(response), not_throw);
if (not_throw) if (not_throw)
{ {