1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-17 15:24:56 +00:00

Merge branch 'acebrianjuan-telecommand_fix' into next

This commit is contained in:
Carles Fernandez 2019-05-08 14:53:14 +02:00
commit 64968fc5f4

View File

@ -175,9 +175,11 @@ std::string TcpCmdInterface::hotstart(const std::vector<std::string> &commandLin
std::string response; std::string response;
if (commandLine.size() > 5) if (commandLine.size() > 5)
{ {
std::string tmp_str;
// Read commandline time parameter // Read commandline time parameter
struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr};
if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) tmp_str = commandLine.at(1) + commandLine.at(2);
if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{ {
response = "ERROR: time parameter malformed\n"; response = "ERROR: time parameter malformed\n";
return response; return response;
@ -224,7 +226,7 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
// Read commandline time parameter // Read commandline time parameter
struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr}; struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr};
tmp_str = commandLine.at(1) + commandLine.at(2); tmp_str = commandLine.at(1) + commandLine.at(2);
if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{ {
response = "ERROR: time parameter malformed\n"; response = "ERROR: time parameter malformed\n";
return response; return response;
@ -235,6 +237,7 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
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());
if (std::isnan(rx_latitude_) || std::isnan(rx_longitude_) || std::isnan(rx_altitude_)) if (std::isnan(rx_latitude_) || std::isnan(rx_longitude_) || std::isnan(rx_altitude_))
{ {
response = "ERROR: position malformed\n"; response = "ERROR: position malformed\n";