From 19dca8742728bdbda232fca4ed09c66b9119b579 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 28 Oct 2018 02:02:28 +0200 Subject: [PATCH] Warn if output files cannot be written. --- src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc | 11 +++++------ src/algorithms/PVT/libs/geojson_printer.cc | 1 + src/algorithms/PVT/libs/gpx_printer.cc | 1 + src/algorithms/PVT/libs/kml_printer.cc | 1 + src/algorithms/PVT/libs/nmea_printer.cc | 4 ++++ src/algorithms/PVT/libs/rinex_printer.cc | 7 +++++++ src/algorithms/PVT/libs/rtcm_printer.cc | 4 ++++ 7 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index 8bb5df354..3e604cd90 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -594,16 +594,16 @@ rtklib_pvt_cc::~rtklib_pvt_cc() } // Save GPS CNAV iono parameters - file_name = xml_base_path + "gps_iono.xml"; - if (d_ls_pvt->gps_iono.valid == true) + file_name = xml_base_path + "gps_cnav_iono.xml"; + if (d_ls_pvt->gps_cnav_iono.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_iono_model", d_ls_pvt->gps_iono); - LOG(INFO) << "Saved GPS ionospheric model parameters"; + xml << boost::serialization::make_nvp("GNSS-SDR_cnav_iono_model", d_ls_pvt->gps_cnav_iono); + LOG(INFO) << "Saved GPS CNAV ionospheric model parameters"; } catch (std::exception& e) { @@ -612,10 +612,9 @@ rtklib_pvt_cc::~rtklib_pvt_cc() } else { - LOG(INFO) << "Failed to save GPS ionospheric model parameters, not valid data"; + LOG(INFO) << "Failed to save GPS CNAV ionospheric model parameters, not valid data"; } - // Save Galileo iono parameters file_name = xml_base_path + "gal_iono.xml"; if (d_ls_pvt->galileo_iono.ai0_5 != 0.0) diff --git a/src/algorithms/PVT/libs/geojson_printer.cc b/src/algorithms/PVT/libs/geojson_printer.cc index 335f5b54a..b79a4edae 100644 --- a/src/algorithms/PVT/libs/geojson_printer.cc +++ b/src/algorithms/PVT/libs/geojson_printer.cc @@ -159,6 +159,7 @@ bool GeoJSON_Printer::set_headers(std::string filename, bool time_tag_name) } else { + std::cout << "File " << filename_ << " cannot be saved. Wrong permissions?" << std::endl; return false; } } diff --git a/src/algorithms/PVT/libs/gpx_printer.cc b/src/algorithms/PVT/libs/gpx_printer.cc index 3918c5702..f0b4b3ff3 100644 --- a/src/algorithms/PVT/libs/gpx_printer.cc +++ b/src/algorithms/PVT/libs/gpx_printer.cc @@ -149,6 +149,7 @@ bool Gpx_Printer::set_headers(std::string filename, bool time_tag_name) } else { + std::cout << "File " << gpx_filename << " cannot be saved. Wrong permissions?" << std::endl; return false; } } diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index 018c533b0..4ebfcb970 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -161,6 +161,7 @@ bool Kml_Printer::set_headers(std::string filename, bool time_tag_name) } else { + std::cout << "File " << kml_filename << " cannot be saved. Wrong permissions?" << std::endl; return false; } } diff --git a/src/algorithms/PVT/libs/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc index 8c6d4311a..1337526b9 100644 --- a/src/algorithms/PVT/libs/nmea_printer.cc +++ b/src/algorithms/PVT/libs/nmea_printer.cc @@ -92,6 +92,10 @@ Nmea_Printer::Nmea_Printer(std::string filename, bool flag_nmea_output_file, boo { DLOG(INFO) << "NMEA printer writing on " << nmea_filename.c_str(); } + else + { + std::cout << "File " << nmea_filename << " cannot be saved. Wrong permissions?" << std::endl; + } } nmea_devname = nmea_dump_devname; diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 9ac71aa2d..8aec5b3de 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -97,6 +97,13 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path) Rinex_Printer::navMixFile.open(navMixfilename, std::ios::out | std::ios::in | std::ios::app); Rinex_Printer::navGloFile.open(navGlofilename, std::ios::out | std::ios::in | std::ios::app); + if (!Rinex_Printer::navFile.is_open() or !Rinex_Printer::obsFile.is_open() or + !Rinex_Printer::sbsFile.is_open() or !Rinex_Printer::navGalFile.is_open() or + !Rinex_Printer::navMixFile.is_open() or !Rinex_Printer::navGloFile.is_open()) + { + std::cout << "RINEX files cannot be saved. Wrong permissions?" << std::endl; + } + // RINEX v3.02 codes satelliteSystem["GPS"] = "G"; satelliteSystem["GLONASS"] = "R"; diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index 7dd2d12de..400132e0c 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -135,6 +135,10 @@ Rtcm_Printer::Rtcm_Printer(std::string filename, bool flag_rtcm_file_dump, bool { DLOG(INFO) << "RTCM printer writing on " << rtcm_filename.c_str(); } + else + { + std::cout << "File " << rtcm_filename << "cannot be saved. Wrong permissions?" << std::endl; + } } rtcm_devname = rtcm_dump_devname;