From 9bf3f457c361c67175e4a12563d8204d9b0a3146 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 20 Aug 2024 14:54:15 +0200 Subject: [PATCH] Cleaner exit if the data file is not found --- .../signal_source/gnuradio_blocks/ion_gsms.cc | 12 +++++++++--- .../signal_source/gnuradio_blocks/ion_gsms.h | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc index 034f43379..60a08ba6c 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc @@ -18,6 +18,8 @@ #include "gnuradio/block.h" #include #include +#include +#include #if USE_GLOG_AND_GFLAGS #include @@ -25,8 +27,6 @@ #include #endif -using namespace std::string_literals; - IONGSMSFileSource::IONGSMSFileSource( const fs::path& metadata_filepath, const GnssMetadata::File& file, @@ -46,7 +46,10 @@ IONGSMSFileSource::IONGSMSFileSource( if (!file_stream_.is_open()) { - LOG(ERROR) << "ion_gsms_file_source: Unable to open the samples file: " << (data_filepath).c_str(); + LOG(WARNING) << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str(); + std::cerr << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str() << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); } // Skip offset and block header @@ -96,11 +99,13 @@ std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) return output_stream_item_sizes_[stream_index]; } + std::size_t IONGSMSFileSource::output_stream_total_sample_count(std::size_t stream_index) const { return output_stream_total_sample_counts_[stream_index]; } + gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) { int nstreams = 0; @@ -142,6 +147,7 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada item_sizes); } + int IONGSMSFileSource::work( int noutput_items, gr_vector_const_void_star& input_items __attribute__((unused)), diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h index a787344bf..c82726b85 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include