mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-09 04:06:45 +00:00
Store AGNSS reference location and time provided by SUPL
This commit is contained in:
parent
ea59abee77
commit
37841bc89e
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user