1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 20:50:33 +00:00

Catch exception

This commit is contained in:
Carles Fernandez 2018-05-22 00:29:33 +02:00
parent 588edaef66
commit bdce3c20d1
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -471,38 +471,37 @@ int main(int argc, char** argv)
<< elapsed_seconds.count() << elapsed_seconds.count()
<< " [seconds]" << std::endl; << " [seconds]" << std::endl;
//6. find TOW from SUPL assistance // 6. find TOW from SUPL assistance
double current_TOW = 0; double current_TOW = 0;
if (global_gps_ephemeris_map.size() > 0) try
{ {
std::map<int, Gps_Ephemeris> Eph_map; if (global_gps_ephemeris_map.size() > 0)
try
{ {
std::map<int, Gps_Ephemeris> Eph_map;
Eph_map = global_gps_ephemeris_map.get_map_copy(); Eph_map = global_gps_ephemeris_map.get_map_copy();
current_TOW = Eph_map.begin()->second.d_TOW;
time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, (long int)current_TOW);
fprintf(stdout, "Reference Time:\n");
fprintf(stdout, " GPS Week: %d\n", Eph_map.begin()->second.i_GPS_week);
fprintf(stdout, " GPS TOW: %ld %lf\n", (long int)current_TOW, (long int)current_TOW * 0.08);
fprintf(stdout, " ~ UTC: %s", ctime(&t));
std::cout << "Current TOW obtained from SUPL assistance = " << current_TOW << std::endl;
} }
catch (const boost::exception& e) else
{ {
std::cout << "Exception in getting Global ephemeris map" << std::endl; std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!" << std::endl;
delete acquisition; delete acquisition;
delete gnss_synchro; delete gnss_synchro;
google::ShutDownCommandLineFlags(); google::ShutDownCommandLineFlags();
std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl; std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl;
return 0; return 0;
} }
current_TOW = Eph_map.begin()->second.d_TOW;
time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, (long int)current_TOW);
fprintf(stdout, "Reference Time:\n");
fprintf(stdout, " GPS Week: %d\n", Eph_map.begin()->second.i_GPS_week);
fprintf(stdout, " GPS TOW: %ld %lf\n", (long int)current_TOW, (long int)current_TOW * 0.08);
fprintf(stdout, " ~ UTC: %s", ctime(&t));
std::cout << "Current TOW obtained from SUPL assistance = " << current_TOW << std::endl;
} }
else catch (const boost::exception& e)
{ {
std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!" << std::endl; std::cout << "Exception in getting Global ephemeris map" << std::endl;
delete acquisition; delete acquisition;
delete gnss_synchro; delete gnss_synchro;
google::ShutDownCommandLineFlags(); google::ShutDownCommandLineFlags();
@ -510,7 +509,7 @@ int main(int argc, char** argv)
return 0; return 0;
} }
//Get user position from config file (or from SUPL using GSM Cell ID) // Get user position from config file (or from SUPL using GSM Cell ID)
double lat_deg = configuration->property("GNSS-SDR.init_latitude_deg", 41.0); double lat_deg = configuration->property("GNSS-SDR.init_latitude_deg", 41.0);
double lon_deg = configuration->property("GNSS-SDR.init_longitude_deg", 2.0); double lon_deg = configuration->property("GNSS-SDR.init_longitude_deg", 2.0);
double altitude_m = configuration->property("GNSS-SDR.init_altitude_m", 100); double altitude_m = configuration->property("GNSS-SDR.init_altitude_m", 100);