mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-01 07:43:04 +00:00
Fixes for C++ standards older than 20. Avoid C++20-specific lambda templates
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
@@ -17,22 +17,14 @@
|
|||||||
#include "ion_gsms.h"
|
#include "ion_gsms.h"
|
||||||
#include "gnuradio/block.h"
|
#include "gnuradio/block.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <cmath>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#if USE_GLOG_AND_GFLAGS
|
|
||||||
#include <glog/logging.h>
|
|
||||||
#else
|
|
||||||
#include <absl/log/log.h>
|
|
||||||
#include <utility>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
IONGSMSFileSource::IONGSMSFileSource(
|
IONGSMSFileSource::IONGSMSFileSource(
|
||||||
const ConfigurationInterface* configuration __attribute__((unused)),
|
const ConfigurationInterface* configuration __attribute__((unused)),
|
||||||
const std::string& role __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::File& file,
|
||||||
const GnssMetadata::Block& block,
|
const GnssMetadata::Block& block,
|
||||||
const std::vector<std::string>& stream_ids)
|
const std::vector<std::string>& stream_ids)
|
||||||
@@ -40,13 +32,11 @@ IONGSMSFileSource::IONGSMSFileSource(
|
|||||||
"ion_gsms_file_source",
|
"ion_gsms_file_source",
|
||||||
gr::io_signature::make(0, 0, 0),
|
gr::io_signature::make(0, 0, 0),
|
||||||
make_output_signature(block, stream_ids)),
|
make_output_signature(block, stream_ids)),
|
||||||
file_metadata_(file),
|
|
||||||
block_metadata_(block),
|
|
||||||
io_buffer_offset_(0),
|
io_buffer_offset_(0),
|
||||||
maximum_item_rate_(0),
|
maximum_item_rate_(0),
|
||||||
chunk_cycle_length_(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");
|
fd_ = std::fopen(data_filepath.c_str(), "rb");
|
||||||
std::size_t block_offset = file.Offset();
|
std::size_t block_offset = file.Offset();
|
||||||
std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET);
|
std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET);
|
||||||
@@ -67,11 +57,13 @@ IONGSMSFileSource::IONGSMSFileSource(
|
|||||||
output_stream_count_ = output_stream_offset;
|
output_stream_count_ = output_stream_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IONGSMSFileSource::~IONGSMSFileSource()
|
IONGSMSFileSource::~IONGSMSFileSource()
|
||||||
{
|
{
|
||||||
std::fclose(fd_);
|
std::fclose(fd_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int IONGSMSFileSource::work(
|
int IONGSMSFileSource::work(
|
||||||
int noutput_items,
|
int noutput_items,
|
||||||
gr_vector_const_void_star& input_items __attribute__((unused)),
|
gr_vector_const_void_star& input_items __attribute__((unused)),
|
||||||
@@ -106,11 +98,13 @@ int IONGSMSFileSource::work(
|
|||||||
return WORK_CALLED_PRODUCE;
|
return WORK_CALLED_PRODUCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::size_t IONGSMSFileSource::output_stream_count() const
|
std::size_t IONGSMSFileSource::output_stream_count() const
|
||||||
{
|
{
|
||||||
return output_stream_count_;
|
return output_stream_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) const
|
std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) const
|
||||||
{
|
{
|
||||||
return output_stream_item_sizes_[stream_index];
|
return output_stream_item_sizes_[stream_index];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
@@ -19,14 +19,20 @@
|
|||||||
|
|
||||||
#include "configuration_interface.h"
|
#include "configuration_interface.h"
|
||||||
#include "gnss_block_interface.h"
|
#include "gnss_block_interface.h"
|
||||||
|
#include "gnss_sdr_filesystem.h"
|
||||||
#include "ion_gsms_chunk_data.h"
|
#include "ion_gsms_chunk_data.h"
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
#include <gnuradio/sync_block.h>
|
#include <gnuradio/sync_block.h>
|
||||||
#include <filesystem>
|
#include <cstddef>
|
||||||
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
/** \addtogroup Signal_Source
|
||||||
|
* \{ */
|
||||||
|
/** \addtogroup Signal_Source_libs
|
||||||
|
* \{ */
|
||||||
|
|
||||||
class IONGSMSFileSource : public gr::sync_block
|
class IONGSMSFileSource : public gr::sync_block
|
||||||
{
|
{
|
||||||
@@ -36,7 +42,7 @@ public:
|
|||||||
IONGSMSFileSource(
|
IONGSMSFileSource(
|
||||||
const ConfigurationInterface* configuration,
|
const ConfigurationInterface* configuration,
|
||||||
const std::string& role,
|
const std::string& role,
|
||||||
const std::filesystem::path& metadata_filepath,
|
const fs::path& metadata_filepath,
|
||||||
const GnssMetadata::File& file,
|
const GnssMetadata::File& file,
|
||||||
const GnssMetadata::Block& block,
|
const GnssMetadata::Block& block,
|
||||||
const std::vector<std::string>& stream_ids);
|
const std::vector<std::string>& stream_ids);
|
||||||
@@ -54,9 +60,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector<std::string>& stream_ids);
|
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_;
|
FILE* fd_;
|
||||||
std::vector<uint8_t> io_buffer_;
|
std::vector<uint8_t> io_buffer_;
|
||||||
std::size_t io_buffer_offset_;
|
std::size_t io_buffer_offset_;
|
||||||
@@ -70,5 +73,6 @@ private:
|
|||||||
|
|
||||||
#include "ion_gsms_metadata_handler.h"
|
#include "ion_gsms_metadata_handler.h"
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
/** \} */
|
||||||
#endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H
|
#endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H
|
||||||
|
|||||||
@@ -8,31 +8,30 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ion_gsms_chunk_data.h"
|
#include "ion_gsms_chunk_data.h"
|
||||||
#include <bitset>
|
#include <cstring>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#if USE_GLOG_AND_GFLAGS
|
#if USE_GLOG_AND_GFLAGS
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#else
|
#else
|
||||||
#include <absl/log/log.h>
|
#include <absl/log/log.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector<std::string>& stream_ids, std::size_t output_stream_offset)
|
IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector<std::string>& stream_ids, std::size_t output_stream_offset)
|
||||||
: chunk_(chunk),
|
: chunk_(chunk),
|
||||||
sizeword_(chunk_.SizeWord()),
|
sizeword_(chunk_.SizeWord()),
|
||||||
countwords_(chunk_.CountWords())
|
countwords_(chunk_.CountWords())
|
||||||
{
|
{
|
||||||
with_word_type(sizeword_, [&]<typename WordType> {
|
// Instantiate the Allocator functor
|
||||||
buffer_ = new WordType[countwords_];
|
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;
|
const std::size_t total_bitsize = sizeword_ * countwords_ * 8;
|
||||||
std::size_t used_bitsize = 0;
|
std::size_t used_bitsize = 0;
|
||||||
@@ -81,11 +80,11 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::
|
|||||||
|
|
||||||
IONGSMSChunkData::~IONGSMSChunkData()
|
IONGSMSChunkData::~IONGSMSChunkData()
|
||||||
{
|
{
|
||||||
with_word_type(sizeword_, [&]<typename WordType> {
|
Deleter deleter(static_cast<void*>(buffer_));
|
||||||
delete[] static_cast<WordType*>(buffer_);
|
with_word_type(sizeword_, deleter);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offset)
|
std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offset)
|
||||||
{
|
{
|
||||||
memset(buffer_, 0, sizeword_ * countwords_);
|
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_;
|
return sizeword_ * countwords_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, std::vector<int>& output_items)
|
void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, std::vector<int>& output_items)
|
||||||
{
|
{
|
||||||
switch (sizeword_)
|
switch (sizeword_)
|
||||||
@@ -121,11 +121,13 @@ std::size_t IONGSMSChunkData::output_stream_count() const
|
|||||||
return output_stream_count_;
|
return output_stream_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) const
|
std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) const
|
||||||
{
|
{
|
||||||
return output_stream_item_size_[stream_index];
|
return output_stream_item_size_[stream_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::size_t IONGSMSChunkData::output_stream_item_rate(std::size_t stream_index) const
|
std::size_t IONGSMSChunkData::output_stream_item_rate(std::size_t stream_index) const
|
||||||
{
|
{
|
||||||
return output_stream_item_rate_[stream_index];
|
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>
|
template <typename WT>
|
||||||
std::size_t IONGSMSChunkData::write_stream_samples(
|
std::size_t IONGSMSChunkData::write_stream_samples(
|
||||||
IONGSMSChunkUnpackingCtx<WT>& ctx,
|
IONGSMSChunkUnpackingCtx<WT>& ctx,
|
||||||
@@ -185,24 +188,25 @@ std::size_t IONGSMSChunkData::write_stream_samples(
|
|||||||
|
|
||||||
if (sample_bitsize <= 8)
|
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)
|
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)
|
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)
|
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;
|
return sample_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename WT, typename OT>
|
template <typename WT, typename OT>
|
||||||
void IONGSMSChunkData::write_n_samples(
|
void IONGSMSChunkData::write_n_samples(
|
||||||
IONGSMSChunkUnpackingCtx<WT>& ctx,
|
IONGSMSChunkUnpackingCtx<WT>& ctx,
|
||||||
@@ -241,22 +245,23 @@ void IONGSMSChunkData::write_n_samples(
|
|||||||
|
|
||||||
|
|
||||||
// Static utilities
|
// 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)
|
switch (sample_bitsize)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
*sample = GnssMetadata::two_bit_look_up<SampleType>[encoding][*sample];
|
*sample = GnssMetadata::two_bit_look_up<Sample>[encoding][*sample];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
*sample = GnssMetadata::three_bit_look_up<SampleType>[encoding][*sample];
|
*sample = GnssMetadata::three_bit_look_up<Sample>[encoding][*sample];
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
*sample = GnssMetadata::four_bit_look_up<SampleType>[encoding][*sample];
|
*sample = GnssMetadata::four_bit_look_up<Sample>[encoding][*sample];
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
*sample = GnssMetadata::five_bit_look_up<SampleType>[encoding][*sample];
|
*sample = GnssMetadata::five_bit_look_up<Sample>[encoding][*sample];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO - Is this an error that can happen?
|
// TODO - Is this an error that can happen?
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
@@ -21,16 +21,14 @@
|
|||||||
#include "ion_gsms_chunk_unpacking_ctx.h"
|
#include "ion_gsms_chunk_unpacking_ctx.h"
|
||||||
#include "ion_gsms_stream_encodings.h"
|
#include "ion_gsms_stream_encodings.h"
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#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)
|
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
|
// 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;
|
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)
|
switch (word_size)
|
||||||
{
|
{
|
||||||
@@ -71,7 +104,7 @@ void with_word_type(const uint8_t word_size, auto&& callback)
|
|||||||
callback.template operator()<int64_t>();
|
callback.template operator()<int64_t>();
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,9 +151,9 @@ private:
|
|||||||
GnssMetadata::StreamEncoding stream_encoding,
|
GnssMetadata::StreamEncoding stream_encoding,
|
||||||
OT** out);
|
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_;
|
const GnssMetadata::Chunk& chunk_;
|
||||||
uint8_t sizeword_;
|
uint8_t sizeword_;
|
||||||
uint8_t countwords_;
|
uint8_t countwords_;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
#include "GnssMetadata.h"
|
#include "GnssMetadata.h"
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#if USE_GLOG_AND_GFLAGS
|
/** \addtogroup Signal_Source
|
||||||
#include <glog/logging.h>
|
* \{ */
|
||||||
#else
|
/** \addtogroup Signal_Source_libs
|
||||||
#include <absl/log/log.h>
|
* \{ */
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename WT>
|
template <typename WT>
|
||||||
struct IONGSMSChunkUnpackingCtx
|
struct IONGSMSChunkUnpackingCtx
|
||||||
@@ -118,7 +118,7 @@ struct IONGSMSChunkUnpackingCtx
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename OT>
|
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)
|
if (sample_bitsize % word_bitsize_ == 0)
|
||||||
{
|
{
|
||||||
@@ -176,4 +176,6 @@ struct IONGSMSChunkUnpackingCtx
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
/** \} */
|
||||||
#endif // ION_GSM_CHUNK_UNPACKING_CTX_H
|
#endif // ION_GSM_CHUNK_UNPACKING_CTX_H
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ion_gsms.h"
|
#include "ion_gsms.h"
|
||||||
|
#include <cstdlib>
|
||||||
#if USE_GLOG_AND_GFLAGS
|
#if USE_GLOG_AND_GFLAGS
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#else
|
#else
|
||||||
@@ -40,16 +40,25 @@ void IONGSMSMetadataHandler::load_metadata()
|
|||||||
GnssMetadata::XmlProcessor xml_proc;
|
GnssMetadata::XmlProcessor xml_proc;
|
||||||
if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_))
|
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)
|
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)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if USE_GLOG_AND_GFLAGS
|
/** \addtogroup Signal_Source
|
||||||
#include <glog/logging.h>
|
* \{ */
|
||||||
#else
|
/** \addtogroup Signal_Source_libs
|
||||||
#include <absl/log/log.h>
|
* \{ */
|
||||||
#endif
|
|
||||||
|
|
||||||
class IONGSMSMetadataHandler
|
class IONGSMSMetadataHandler
|
||||||
{
|
{
|
||||||
@@ -35,16 +35,17 @@ public:
|
|||||||
explicit IONGSMSMetadataHandler(const std::string& metadata_filepath);
|
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;
|
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;
|
const std::string& metadata_filepath() const;
|
||||||
|
|
||||||
private: // Private methods
|
private:
|
||||||
void load_metadata();
|
void load_metadata();
|
||||||
|
|
||||||
private: // State
|
// State
|
||||||
std::string metadata_filepath_;
|
std::string metadata_filepath_;
|
||||||
GnssMetadata::Metadata metadata_;
|
GnssMetadata::Metadata metadata_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
/** \} */
|
||||||
#endif // ION_GSMS_METADATA_HANDLER_H
|
#endif // ION_GSMS_METADATA_HANDLER_H
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||||
* This file is part of GNSS-SDR.
|
* 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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
@@ -21,11 +21,10 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#if USE_GLOG_AND_GFLAGS
|
/** \addtogroup Signal_Source
|
||||||
#include <glog/logging.h>
|
* \{ */
|
||||||
#else
|
/** \addtogroup Signal_Source_libs
|
||||||
#include <absl/log/log.h>
|
* \{ */
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace GnssMetadata
|
namespace GnssMetadata
|
||||||
{
|
{
|
||||||
@@ -165,4 +164,7 @@ inline T five_bit_look_up[11][32]{
|
|||||||
|
|
||||||
} // namespace GnssMetadata
|
} // namespace GnssMetadata
|
||||||
|
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
/** \} */
|
||||||
#endif // ION_GSM_STREAM_ENCODINGS_H
|
#endif // ION_GSM_STREAM_ENCODINGS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user