1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-26 06:53:14 +00:00

Store AGNSS reference location and time provided by SUPL

This commit is contained in:
Carles Fernandez 2018-11-20 10:52:40 +01:00
parent ea59abee77
commit 37841bc89e
3 changed files with 16 additions and 15 deletions

View File

@ -984,7 +984,7 @@ bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
{
ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs);
xml >> boost::serialization::make_nvp("GNSS-SDR_ref_time_map", this->gps_time);
xml >> boost::serialization::make_nvp("GNSS-SDR_ref_time", this->gps_time);
LOG(INFO) << "Loaded Ref Time data";
}
catch (std::exception& e)
@ -996,17 +996,16 @@ bool gnss_sdr_supl_client::load_ref_time_xml(const std::string file_name)
}
bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, std::map<int, Agnss_Ref_Time> ref_time_map)
bool gnss_sdr_supl_client::save_ref_time_xml(const std::string file_name, Agnss_Ref_Time& ref_time)
{
if (ref_time_map.empty() == false)
if (ref_time.valid == true)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_ref_time_map", ref_time_map);
xml << boost::serialization::make_nvp("GNSS-SDR_ref_time", ref_time);
LOG(INFO) << "Saved Ref Time data";
}
catch (std::exception& e)
@ -1017,7 +1016,7 @@ bool gnss_sdr_supl_client::save_ref_time_map_xml(const std::string file_name, st
}
else
{
LOG(WARNING) << "Failed to save Ref Time, map is empty";
LOG(WARNING) << "Failed to save Ref Time";
return false;
}
return true;
@ -1031,7 +1030,7 @@ bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
{
ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs);
xml >> boost::serialization::make_nvp("GNSS-SDR_ref_location_map", this->gps_ref_loc);
xml >> boost::serialization::make_nvp("GNSS-SDR_ref_location", this->gps_ref_loc);
LOG(INFO) << "Loaded Ref Location data";
}
catch (std::exception& e)
@ -1043,16 +1042,16 @@ bool gnss_sdr_supl_client::load_ref_location_xml(const std::string file_name)
}
bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name, std::map<int, Agnss_Ref_Location> ref_location_map)
bool gnss_sdr_supl_client::save_ref_location_xml(const std::string file_name, Agnss_Ref_Location& ref_location)
{
if (ref_location_map.empty() == false)
if (ref_location.valid == true)
{
std::ofstream ofs;
try
{
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_ref_location_map", ref_location_map);
xml << boost::serialization::make_nvp("GNSS-SDR_ref_location", ref_location);
LOG(INFO) << "Saved Ref Location data";
}
catch (std::exception& e)
@ -1063,7 +1062,7 @@ bool gnss_sdr_supl_client::save_ref_location_map_xml(const std::string file_name
}
else
{
LOG(WARNING) << "Failed to save Ref Location, map is empty";
LOG(WARNING) << "Failed to save Ref Location";
return false;
}
return true;

View File

@ -256,8 +256,8 @@ public:
/*!
* \brief Save ref time map to XML file
*/
bool save_ref_time_map_xml(const std::string file_name,
std::map<int, Agnss_Ref_Time> ref_time_map);
bool save_ref_time_xml(const std::string file_name,
Agnss_Ref_Time& ref_time_map);
/*!
* \brief Read ref location from XML file
@ -267,8 +267,8 @@ public:
/*!
* \brief Save ref location map to XML file
*/
bool save_ref_location_map_xml(std::string file_name,
std::map<int, Agnss_Ref_Location> ref_location_map);
bool save_ref_location_xml(std::string file_name,
Agnss_Ref_Location& ref_location);
/*
* Prints SUPL data to std::cout. Use it for debug purposes only.

View File

@ -621,6 +621,7 @@ void ControlThread::assist_GNSS()
agnss_ref_location_ = supl_client_acquisition_.gps_ref_loc;
std::shared_ptr<Agnss_Ref_Location> tmp_obj = std::make_shared<Agnss_Ref_Location>(supl_client_acquisition_.gps_ref_loc);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
supl_client_acquisition_.save_ref_location_xml("agnss_ref_location.xml", agnss_ref_location_);
}
if (supl_client_acquisition_.gps_time.valid == true)
{
@ -628,6 +629,7 @@ void ControlThread::assist_GNSS()
agnss_ref_time_ = supl_client_acquisition_.gps_time;
std::shared_ptr<Agnss_Ref_Time> tmp_obj = std::make_shared<Agnss_Ref_Time>(supl_client_acquisition_.gps_time);
flowgraph_->send_telemetry_msg(pmt::make_any(tmp_obj));
supl_client_acquisition_.save_ref_time_xml("agnss_ref_time.xml", agnss_ref_time_);
}
}
else