1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-12 11:10:33 +00:00

Merge remote-tracking branch 'carlesfernandez/castle055-ft/ion-metadata-standard-signal-source' into ft/ion-metadata-standard-signal-source

This commit is contained in:
Victor Castillo 2024-08-19 13:21:52 +02:00
commit f7cd58a5a5
No known key found for this signature in database
GPG Key ID: 8EF1FC8B7182F608
17 changed files with 226 additions and 117 deletions

View File

@ -28,7 +28,7 @@ jobs:
libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev \
python3-mako liborc-0.4-dev
- name: configure
run: cd build && cmake -GNinja ..
run: cd build && cmake -GNinja -DENABLE_ION=ON ..
- name: build
run: cd build && ninja
- name: check
@ -60,7 +60,7 @@ jobs:
brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf
pip3 install mako
- name: configure
run: cd build && cmake -GNinja ..
run: cd build && cmake -GNinja -DENABLE_ION=ON ..
- name: build
run: cd build && ninja
- name: check
@ -92,7 +92,7 @@ jobs:
brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf
pip3 install mako
- name: configure
run: cd build && cmake -GXcode ..
run: cd build && cmake -GXcode -DENABLE_ION=ON ..
- name: build
run: cd build && xcodebuild -configuration Release
- name: check

View File

@ -64,6 +64,7 @@ Marc Sales marcsales92@gmail.com Contributor
Piyush Gupta piyush04111999@gmail.com Contributor
Rodrigo Muñoz rodrigo.munoz@proteinlab.cl Contributor
Stefan van der Linden spvdlinden@gmail.com Contributor
Victor Castillo-Agüero victorcastilloaguero@gmail.com Contributor
Will Silberman wsilberm@google.com Contributor
Carlos Paniego carpanie@hotmail.com Artwork

View File

@ -34,6 +34,11 @@ authors:
email: mara.branzanti@gmail.com
family-names: Branzanti
given-names: Mara
- alias: castle055
affiliation: "Instituto Nacional de Técnica Aeroespacial"
email: victorcastilloaguero@gmail.com
family-names: "Castillo-Agüero"
given-names: Victor
- alias: acebrianjuan
email: acebrianjuan@gmail.com
family-names: "Cebrián-Juan"

View File

@ -57,7 +57,7 @@ option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal
option(ENABLE_ZMQ "Enable GNU Radio ZeroMQ Messaging, requires gr-zeromq" ON)
option(ENABLE_ION "Enable ION GNSS-SDR Metadata Standard signal source" ON)
option(ENABLE_ION "Enable ION GNSS-SDR Metadata Standard signal source" OFF)
# Performance analysis tools
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
@ -363,7 +363,7 @@ set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14")
set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2")
set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master")
set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0")
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.5")
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.0")
set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7")
set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases)
@ -1424,20 +1424,6 @@ else()
endif()
################################################################################
# ION GNSS-SDR Metadata Standard
################################################################################
include(FetchContent)
FetchContent_Declare(
gnss_metadata_standard
GIT_REPOSITORY https://github.com/IonMetadataWorkingGroup/GNSS-Metadata-Standard
GIT_TAG master
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard
CMAKE_ARGS -DABSL_PROPAGATE_CXX_STD=ON -ABSL_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnss-metadata-standard ${ABSEIL_TOOLCHAIN_FILE}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-metadata-standard
)
FetchContent_MakeAvailable(gnss_metadata_standard)
################################################################################
# Abseil C++ - https://abseil.io/docs/cpp/
################################################################################
@ -3371,6 +3357,57 @@ if(ENABLE_AD9361 OR ENABLE_FMCOMMS2)
endif()
################################################################################
# ION GNSS-SDR Metadata Standard https://sdr.ion.org/ (OPTIONAL)
################################################################################
if(ENABLE_ION)
include(FetchContent)
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
FetchContent_Declare(
gnss_metadata_standard
GIT_REPOSITORY https://github.com/IonMetadataWorkingGroup/GNSS-Metadata-Standard
GIT_TAG origin/master
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnss-metadata-standard
BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-metadata-standard
)
FetchContent_MakeAvailable(gnss_metadata_standard)
if(NOT TARGET ION::ion)
add_library(ION::ion STATIC IMPORTED)
add_dependencies(ION::ion gnss_metadata_standard)
if(CMAKE_GENERATOR STREQUAL "Xcode")
set_target_properties(ION::ion PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION_DEBUG "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LOCATION_RELEASE "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Release/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LOCATION_RELWITHDEBINFO "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LOCATION_MINSIZEREL "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc"
)
set_property(TARGET ION::ion APPEND PROPERTY
INTERFACE_LINK_LIBRARIES
"$<$<CONFIG:Debug>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:Release>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Release/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Release/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:RelWithDebInfo>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:MinSizeRel>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:NoOptWithASM>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:Coverage>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:O2WithASM>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:O3WithASM>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
"$<$<CONFIG:ASAN>:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>"
)
else()
set_target_properties(ION::ion PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc"
INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endif()
endif()
endif()
#####################################################################
# Check signal sources related to FPGA only.
@ -3684,6 +3721,7 @@ add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source
add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.")
add_feature_info(ENABLE_ARRAY ENABLE_ARRAY "Enables Raw_Array_Signal_Source and Array_Signal_Conditioner for using CTTC's antenna array. Requires gr-dbfcttc.")
add_feature_info(ENABLE_ZMQ ENABLE_ZMQ "Enables ZMQ_Signal_Source for GNU Radio ZeroMQ messages. Requires gr-zeromq.")
add_feature_info(ENABLE_ION ENABLE_ION "Enables ION_GSMS_Signal_Source for the ION Metadata Standard.")
add_feature_info(ENABLE_GPERFTOOLS ENABLE_GPERFTOOLS "Enables performance analysis. Requires Gperftools.")
add_feature_info(ENABLE_GPROF ENABLE_GPROF "Enables performance analysis with 'gprof'.")
add_feature_info(ENABLE_CLANG_TIDY ENABLE_CLANG_TIDY "Runs clang-tidy along with the compiler. Requires Clang.")

View File

@ -41,6 +41,11 @@ All notable changes to GNSS-SDR will be documented in this file.
- `-DENABLE_DMA_PROXY`: Checks if the DMA proxy driver is installed for
controlling the DMA in the FPGA and enables its usage.
- Add the `ION_GSMS_Signal_Source`, which is able to process raw data files
described with the
[ION GNSS Software Defined Receiver Metadata Standard](https://sdr.ion.org/).
It requires the `-DENABLE_ION=ON` building configuration option.
### Improvements in Portability:
- Fix building against google-glog 0.7.x.

View File

@ -103,6 +103,11 @@ if(ENABLE_ZMQ)
list(APPEND OPT_DRIVER_HEADERS zmq_signal_source.h)
endif()
if(ENABLE_ION)
list(APPEND OPT_DRIVER_SOURCES ion_gsms_signal_source.cc)
list(APPEND OPT_DRIVER_HEADERS ion_gsms_signal_source.h)
endif()
set(SIGNAL_SOURCE_ADAPTER_SOURCES
signal_source_base.cc
file_source_base.cc
@ -119,7 +124,6 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES
two_bit_packed_file_signal_source.cc
four_bit_cpx_file_signal_source.cc
file_timestamp_signal_source.cc
ion_gsms_signal_source.cc
${OPT_DRIVER_SOURCES}
)
@ -139,7 +143,6 @@ set(SIGNAL_SOURCE_ADAPTER_HEADERS
two_bit_packed_file_signal_source.h
four_bit_cpx_file_signal_source.h
file_timestamp_signal_source.h
ion_gsms_signal_source.h
${OPT_DRIVER_HEADERS}
)
@ -171,7 +174,7 @@ target_include_directories(signal_source_adapters
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(ENABLE_FPGA OR ENABLE_AD9361)
if(ENABLE_FPGA OR ENABLE_AD9361 OR ENABLE_ION)
target_link_libraries(signal_source_adapters
PUBLIC
signal_source_libs

View File

@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -49,6 +49,7 @@ std::vector<std::string> parse_comma_list(const std::string& str)
return list;
}
IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_streams,
@ -62,10 +63,14 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura
in_streams_(in_streams),
out_streams_(out_streams)
{
if (in_streams > 0)
if (in_streams_ > 0)
{
LOG(ERROR) << "A signal source does not have an input stream";
}
if (out_streams_ <= 0)
{
LOG(ERROR) << "A signal source does not have an output stream";
}
sources_ = metadata_.make_stream_sources(configuration, role, stream_ids_);
@ -91,6 +96,7 @@ void IONGSMSSignalSource::connect(gr::top_block_sptr top_block)
}
}
void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block)
{
std::size_t cumulative_index = 0;
@ -103,6 +109,7 @@ void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block)
}
}
gr::basic_block_sptr IONGSMSSignalSource::get_left_block()
{
LOG(WARNING) << "Trying to get signal source left block.";
@ -110,11 +117,13 @@ gr::basic_block_sptr IONGSMSSignalSource::get_left_block()
return IONGSMSFileSource::sptr();
}
gr::basic_block_sptr IONGSMSSignalSource::get_right_block()
{
return get_right_block(0);
}
gr::basic_block_sptr IONGSMSSignalSource::get_right_block(int RF_channel)
{
return copy_blocks_[RF_channel];

View File

@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -22,6 +22,7 @@
#include "file_source_base.h"
#include "gnss_sdr_timestamp.h"
#include "ion_gsms.h"
#include <cstdint>
#include <string>
#include <vector>
@ -44,8 +45,6 @@ public:
~IONGSMSSignalSource() override = default;
protected:
// std::tuple<size_t, bool> itemTypeToSize() override;
// double packetsPerSample() const override;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;

View File

@ -142,6 +142,10 @@ if(ENABLE_FPGA OR ENABLE_AD9361)
)
endif()
if(ENABLE_ION)
target_link_libraries(signal_source_libs PUBLIC ION::ion algorithms_libs)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(signal_source_libs
@ -151,11 +155,6 @@ if(ENABLE_CLANG_TIDY)
endif()
endif()
if(ENABLE_ION)
target_include_directories(signal_source_libs PUBLIC ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc)
target_link_libraries(signal_source_libs PUBLIC api xml)
endif()
set_property(TARGET signal_source_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

View File

@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -17,22 +17,14 @@
#include "ion_gsms.h"
#include "gnuradio/block.h"
#include <algorithm>
#include <memory>
#include <vector>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
#else
#include <absl/log/log.h>
#include <utility>
#endif
#include <cmath>
using namespace std::string_literals;
IONGSMSFileSource::IONGSMSFileSource(
const ConfigurationInterface* configuration __attribute__((unused)),
const std::string& role __attribute__((unused)),
const std::filesystem::path& metadata_filepath,
const fs::path& metadata_filepath,
const GnssMetadata::File& file,
const GnssMetadata::Block& block,
const std::vector<std::string>& stream_ids)
@ -40,13 +32,11 @@ IONGSMSFileSource::IONGSMSFileSource(
"ion_gsms_file_source",
gr::io_signature::make(0, 0, 0),
make_output_signature(block, stream_ids)),
file_metadata_(file),
block_metadata_(block),
io_buffer_offset_(0),
maximum_item_rate_(0),
chunk_cycle_length_(0)
{
std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value();
fs::path data_filepath = metadata_filepath.parent_path() / file.Url().Value();
fd_ = std::fopen(data_filepath.c_str(), "rb");
std::size_t block_offset = file.Offset();
std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET);
@ -67,11 +57,13 @@ IONGSMSFileSource::IONGSMSFileSource(
output_stream_count_ = output_stream_offset;
}
IONGSMSFileSource::~IONGSMSFileSource()
{
std::fclose(fd_);
}
int IONGSMSFileSource::work(
int noutput_items,
gr_vector_const_void_star& input_items __attribute__((unused)),
@ -106,11 +98,13 @@ int IONGSMSFileSource::work(
return WORK_CALLED_PRODUCE;
}
std::size_t IONGSMSFileSource::output_stream_count() const
{
return output_stream_count_;
}
std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) const
{
return output_stream_item_sizes_[stream_index];

View File

@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -19,14 +19,20 @@
#include "configuration_interface.h"
#include "gnss_block_interface.h"
#include "gnss_sdr_filesystem.h"
#include "ion_gsms_chunk_data.h"
#include <gnuradio/block.h>
#include <gnuradio/sync_block.h>
#include <filesystem>
#include <cstddef>
#include <cstdio>
#include <memory>
#include <string>
#include <vector>
/** \addtogroup Signal_Source
* \{ */
/** \addtogroup Signal_Source_libs
* \{ */
class IONGSMSFileSource : public gr::sync_block
{
@ -36,7 +42,7 @@ public:
IONGSMSFileSource(
const ConfigurationInterface* configuration,
const std::string& role,
const std::filesystem::path& metadata_filepath,
const fs::path& metadata_filepath,
const GnssMetadata::File& file,
const GnssMetadata::Block& block,
const std::vector<std::string>& stream_ids);
@ -54,9 +60,6 @@ public:
private:
static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector<std::string>& stream_ids);
private:
const GnssMetadata::File& file_metadata_;
const GnssMetadata::Block& block_metadata_;
FILE* fd_;
std::vector<uint8_t> io_buffer_;
std::size_t io_buffer_offset_;
@ -70,5 +73,6 @@ private:
#include "ion_gsms_metadata_handler.h"
/** \} */
/** \} */
#endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H

View File

@ -8,31 +8,30 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "ion_gsms_chunk_data.h"
#include <bitset>
#include <string>
#include <vector>
#include <cstring>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
#else
#include <absl/log/log.h>
#endif
IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector<std::string>& stream_ids, std::size_t output_stream_offset)
: chunk_(chunk),
sizeword_(chunk_.SizeWord()),
countwords_(chunk_.CountWords())
{
with_word_type(sizeword_, [&]<typename WordType> {
buffer_ = new WordType[countwords_];
});
// Instantiate the Allocator functor
Allocator allocator(countwords_, buffer_);
// Call with_word_type with the Allocator functor
with_word_type(sizeword_, allocator);
const std::size_t total_bitsize = sizeword_ * countwords_ * 8;
std::size_t used_bitsize = 0;
@ -81,11 +80,11 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::
IONGSMSChunkData::~IONGSMSChunkData()
{
with_word_type(sizeword_, [&]<typename WordType> {
delete[] static_cast<WordType*>(buffer_);
});
Deleter deleter(static_cast<void*>(buffer_));
with_word_type(sizeword_, deleter);
}
std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offset)
{
memset(buffer_, 0, sizeword_ * countwords_);
@ -93,6 +92,7 @@ std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offs
return sizeword_ * countwords_;
}
void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, std::vector<int>& output_items)
{
switch (sizeword_)
@ -121,11 +121,13 @@ std::size_t IONGSMSChunkData::output_stream_count() const
return output_stream_count_;
}
std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) const
{
return output_stream_item_size_[stream_index];
}
std::size_t IONGSMSChunkData::output_stream_item_rate(std::size_t stream_index) const
{
return output_stream_item_rate_[stream_index];
@ -165,6 +167,7 @@ void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, std::vector<in
}
}
template <typename WT>
std::size_t IONGSMSChunkData::write_stream_samples(
IONGSMSChunkUnpackingCtx<WT>& ctx,
@ -185,24 +188,25 @@ std::size_t IONGSMSChunkData::write_stream_samples(
if (sample_bitsize <= 8)
{
write_n_samples<WT, int8_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int8_t**)(out));
write_n_samples<WT, int8_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast<int8_t**>(out));
}
else if (sample_bitsize <= 16)
{
write_n_samples<WT, int16_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int16_t**)(out));
write_n_samples<WT, int16_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast<int16_t**>(out));
}
else if (sample_bitsize <= 32)
{
write_n_samples<WT, int32_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int32_t**)(out));
write_n_samples<WT, int32_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast<int32_t**>(out));
}
else if (sample_bitsize <= 64)
{
write_n_samples<WT, int64_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int64_t**)(out));
write_n_samples<WT, int64_t>(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast<int64_t**>(out));
}
return sample_count;
}
template <typename WT, typename OT>
void IONGSMSChunkData::write_n_samples(
IONGSMSChunkUnpackingCtx<WT>& ctx,
@ -241,22 +245,23 @@ void IONGSMSChunkData::write_n_samples(
// Static utilities
void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, auto* sample, const GnssMetadata::StreamEncoding encoding)
template <typename Sample>
void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, Sample* sample, const GnssMetadata::StreamEncoding encoding)
{
using SampleType = std::remove_pointer_t<decltype(sample)>;
// using SampleType = std::remove_pointer_t<decltype(sample)>;
switch (sample_bitsize)
{
case 2:
*sample = GnssMetadata::two_bit_look_up<SampleType>[encoding][*sample];
*sample = GnssMetadata::two_bit_look_up<Sample>[encoding][*sample];
break;
case 3:
*sample = GnssMetadata::three_bit_look_up<SampleType>[encoding][*sample];
*sample = GnssMetadata::three_bit_look_up<Sample>[encoding][*sample];
break;
case 4:
*sample = GnssMetadata::four_bit_look_up<SampleType>[encoding][*sample];
*sample = GnssMetadata::four_bit_look_up<Sample>[encoding][*sample];
break;
case 5:
*sample = GnssMetadata::five_bit_look_up<SampleType>[encoding][*sample];
*sample = GnssMetadata::five_bit_look_up<Sample>[encoding][*sample];
break;
default:
// TODO - Is this an error that can happen?

View File

@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -17,20 +17,18 @@
#ifndef ION_GSM_CHUNK_DATA_H
#define ION_GSM_CHUNK_DATA_H
#include "GnssMetadata.h"
#include "ion_gsms_chunk_unpacking_ctx.h"
#include "ion_gsms_stream_encodings.h"
#include <gnuradio/block.h>
#include <GnssMetadata.h>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
#else
#include <absl/log/log.h>
#endif
inline std::size_t bits_to_item_size(const std::size_t bit_count)
inline std::size_t bits_to_item_size(std::size_t bit_count)
{
if (bit_count <= 8)
{
@ -50,11 +48,46 @@ inline std::size_t bits_to_item_size(const std::size_t bit_count)
}
// You are asking too much of this humble processor
LOG(ERROR) << "Item size too large (" << std::to_string(bit_count) << "), returning nonsense.";
std::cerr << "Item size too large (" << std::to_string(bit_count) << "), returning nonsense.\n";
return 1;
}
void with_word_type(const uint8_t word_size, auto&& callback)
// Define a functor that has a templated operator()
struct Allocator
{
size_t countwords_;
void*& buffer_; // Using void* to hold any type of pointer
Allocator(size_t countwords, void*& buffer)
: countwords_(countwords), buffer_(buffer) {}
template <typename WordType>
void operator()() const
{
buffer_ = new WordType[countwords_];
}
};
// Define a functor to delete the allocated memory
struct Deleter
{
void* buffer_;
explicit Deleter(void* buffer)
: buffer_(buffer) {}
template <typename WordType>
void operator()() const
{
delete[] static_cast<WordType*>(buffer_);
}
};
template <typename Callback>
void with_word_type(uint8_t word_size, Callback callback)
{
switch (word_size)
{
@ -71,7 +104,7 @@ void with_word_type(const uint8_t word_size, auto&& callback)
callback.template operator()<int64_t>();
break;
default:
LOG(ERROR) << "Unknown word size (" << std::to_string(word_size) << "), returning nonsense.";
std::cerr << "Unknown word size (" << std::to_string(word_size) << "), returning nonsense.\n";
break;
}
}
@ -118,9 +151,9 @@ private:
GnssMetadata::StreamEncoding stream_encoding,
OT** out);
static void decode_sample(uint8_t sample_bitsize, auto* sample, GnssMetadata::StreamEncoding encoding);
template <typename Sample>
static void decode_sample(uint8_t sample_bitsize, Sample* sample, GnssMetadata::StreamEncoding encoding);
private:
const GnssMetadata::Chunk& chunk_;
uint8_t sizeword_;
uint8_t countwords_;

View File

@ -10,7 +10,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -19,14 +19,14 @@
#ifndef ION_GSM_CHUNK_UNPACKING_CTX_H
#define ION_GSM_CHUNK_UNPACKING_CTX_H
#include "GnssMetadata.h"
#include <gnuradio/block.h>
#include <GnssMetadata.h>
#include <cstdint>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
#else
#include <absl/log/log.h>
#endif
/** \addtogroup Signal_Source
* \{ */
/** \addtogroup Signal_Source_libs
* \{ */
template <typename WT>
struct IONGSMSChunkUnpackingCtx
@ -118,7 +118,7 @@ struct IONGSMSChunkUnpackingCtx
}
template <typename OT>
void shift_sample(const uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0)
void shift_sample(uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0)
{
if (sample_bitsize % word_bitsize_ == 0)
{
@ -176,4 +176,6 @@ struct IONGSMSChunkUnpackingCtx
}
};
/** \} */
/** \} */
#endif // ION_GSM_CHUNK_UNPACKING_CTX_H

View File

@ -8,14 +8,14 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "ion_gsms.h"
#include <cstdlib>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
#else
@ -40,16 +40,25 @@ void IONGSMSMetadataHandler::load_metadata()
GnssMetadata::XmlProcessor xml_proc;
if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_))
{
LOG(ERROR) << "Could not load XML metadata file:";
LOG(WARNING) << "Could not load XML metadata file " << metadata_filepath_;
std::cerr << "Could not load XML metadata file " << metadata_filepath_ << std::endl;
std::cout << "GNSS-SDR program ended.\n";
exit(1);
}
}
catch (GnssMetadata::ApiException& e)
{
LOG(ERROR) << "API Exception while loading XML metadata file: " << std::to_string(e.Error());
LOG(WARNING) << "API Exception while loading XML metadata file: " << std::to_string(e.Error());
std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << std::to_string(e.Error()) << std::endl;
std::cout << "GNSS-SDR program ended.\n";
exit(1);
}
catch (std::exception& e)
{
LOG(ERROR) << "Exception while loading XML metadata file: " << e.what();
LOG(WARNING) << "Exception while loading XML metadata file: " << e.what();
std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << e.what() << std::endl;
std::cout << "GNSS-SDR program ended.\n";
exit(1);
}
}

View File

@ -8,7 +8,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -17,17 +17,17 @@
#ifndef ION_GSMS_METADATA_HANDLER_H
#define ION_GSMS_METADATA_HANDLER_H
#include "GnssMetadata.h"
#include "configuration_interface.h"
#include <gnuradio/block.h>
#include <GnssMetadata.h>
#include <string>
#include <vector>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
#else
#include <absl/log/log.h>
#endif
/** \addtogroup Signal_Source
* \{ */
/** \addtogroup Signal_Source_libs
* \{ */
class IONGSMSMetadataHandler
{
@ -35,16 +35,17 @@ public:
explicit IONGSMSMetadataHandler(const std::string& metadata_filepath);
std::vector<IONGSMSFileSource::sptr> make_stream_sources(const ConfigurationInterface* configuration, const std::string& role, const std::vector<std::string>& stream_ids) const;
public: // Getters
const std::string& metadata_filepath() const;
private: // Private methods
private:
void load_metadata();
private: // State
// State
std::string metadata_filepath_;
GnssMetadata::Metadata metadata_;
};
/** \} */
/** \} */
#endif // ION_GSMS_METADATA_HANDLER_H

View File

@ -10,7 +10,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -21,11 +21,10 @@
#include <string>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
#else
#include <absl/log/log.h>
#endif
/** \addtogroup Signal_Source
* \{ */
/** \addtogroup Signal_Source_libs
* \{ */
namespace GnssMetadata
{
@ -165,4 +164,7 @@ inline T five_bit_look_up[11][32]{
} // namespace GnssMetadata
/** \} */
/** \} */
#endif // ION_GSM_STREAM_ENCODINGS_H