1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00
This commit is contained in:
Carles Fernandez 2022-08-29 13:53:46 +02:00
commit e7cfa66962
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
61 changed files with 781 additions and 814 deletions

View File

@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako
run: sudo apt-get update && sudo apt-get install ninja-build libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev libboost-serialization-dev liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev python3-mako liborc-0.4-dev
- name: configure
run: cd build && cmake -GNinja ..
- name: build

View File

@ -48,6 +48,8 @@ option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Tele
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
option(ENABLE_ZMQ "Enable GNU Radio ZeroMQ Messaging, requires gr-zeromq" OFF)
# Performance analysis tools
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
@ -596,7 +598,7 @@ set_package_properties(VOLK PROPERTIES
################################################################################
# GNU Radio - https://www.gnuradio.org
################################################################################
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
list(APPEND GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
find_package(UHD)
set_package_properties(UHD PROPERTIES
PURPOSE "Used for communication with front-ends of the USRP family."
@ -606,10 +608,14 @@ if(ENABLE_UHD)
if(NOT UHD_FOUND)
set(ENABLE_UHD OFF)
else()
set(GR_REQUIRED_COMPONENTS ${GR_REQUIRED_COMPONENTS} UHD)
list(APPEND GR_REQUIRED_COMPONENTS UHD)
endif()
endif()
if(ENABLE_ZMQ)
list(APPEND GR_REQUIRED_COMPONENTS ZEROMQ)
endif()
find_package(GNURADIO)
set_package_properties(GNURADIO PROPERTIES
PURPOSE "Implements flowgraph scheduler, provides some processing blocks and classes to create new ones."
@ -622,45 +628,6 @@ endif()
################################################################################
# Log4cpp - http://log4cpp.sourceforge.net/
################################################################################
if(GNURADIO_USES_LOG4CPP)
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif()
################################################################################
# spdlog - https://github.com/gabime/spdlog
################################################################################
if(GNURADIO_USES_SPDLOG)
find_package(SPDLOG REQUIRED)
set_package_properties(SPDLOG PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif()
################################################################################
# fmt - https://github.com/fmtlib/fmt
################################################################################
if(GNURADIO_USES_SPDLOG)
find_package(FMT REQUIRED)
set_package_properties(FMT PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
endif()
################################################################################
# Detect availability of std::filesystem and set C++ standard accordingly
################################################################################
@ -3401,6 +3368,7 @@ add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source
add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.")
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_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

@ -1,76 +0,0 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
# Locate header
find_path(FMT_INCLUDE_DIR fmt/core.h
HINTS ${FMT_ROOT_DIR}/include
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
# Locate library
find_library(FMT_LIBRARY NAMES fmt
HINTS ${FMT_ROOT_DIR}/lib ${FMT_ROOT_DIR}/lib64
PATHS
/usr/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/local/lib
/usr/local/lib64
/opt/local/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FMT DEFAULT_MSG FMT_INCLUDE_DIR FMT_LIBRARY)
set_package_properties(FMT PROPERTIES
URL "https://github.com/fmtlib/fmt"
DESCRIPTION "An open-source formatting library"
)
# Add imported target.
if(FMT_FOUND)
set(FMT_INCLUDE_DIRS "${FMT_INCLUDE_DIR}")
if(NOT TARGET fmt::fmt)
add_library(fmt::fmt UNKNOWN IMPORTED)
set_target_properties(fmt::fmt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIRS}"
)
set_property(TARGET fmt::fmt APPEND PROPERTY
IMPORTED_LOCATION "${FMT_LIBRARY}"
)
endif()
endif()

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-FileCopyrightText: 2011-2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
########################################################################
@ -20,7 +20,7 @@ include(FindPackageHandleStandardArgs)
# if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list
if(NOT GR_REQUIRED_COMPONENTS)
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
endif()
# Allows us to use all .cmake files in this directory
@ -193,6 +193,7 @@ gr_module(TRELLIS gnuradio-trellis gnuradio/trellis/api.h gnuradio-trellis)
gr_module(UHD gnuradio-uhd gnuradio/uhd/api.h gnuradio-uhd)
gr_module(VOCODER gnuradio-vocoder gnuradio/vocoder/api.h gnuradio-vocoder)
gr_module(WAVELET gnuradio-wavelet gnuradio/wavelet/api.h gnuradio-wavelet)
gr_module(ZEROMQ gnuradio-zeromq gnuradio/zeromq/api.h gnuradio-zeromq)
list(REMOVE_DUPLICATES GNURADIO_ALL_INCLUDE_DIRS)
@ -410,10 +411,28 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS)
endif()
endforeach()
if(${_uses_log4cpp})
set(GNURADIO_USES_LOG4CPP TRUE)
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
if(CMAKE_VERSION VERSION_GREATER 3.13)
target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp)
else()
set(LOG4CPP_WITH_OLD_CMAKE TRUE)
endif()
endif()
if(${_uses_spdlog})
find_package(spdlog REQUIRED CONFIG)
set_package_properties(spdlog PROPERTIES
URL "https://github.com/gabime/spdlog"
DESCRIPTION "Very fast, header-only/compiled, C++ logging library (found: v${spdlog_VERSION})"
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
set(GNURADIO_USES_SPDLOG TRUE)
target_link_libraries(Gnuradio::runtime INTERFACE spdlog::spdlog)
target_link_libraries(Gnuradio::blocks INTERFACE spdlog::spdlog)
endif()
endif()
endif()

View File

@ -1,84 +0,0 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
# Locate header
find_path(SPDLOG_INCLUDE_DIR spdlog/spdlog.h
HINTS ${SPDLOG_ROOT_DIR}/include
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
# Locate library
find_library(SPDLOG_LIBRARY NAMES spdlog spdlogd
HINTS ${SPDLOG_ROOT_DIR}/lib ${SPDLOG_ROOT_DIR}/lib64
PATHS
/usr/lib
/usr/lib64
/usr/lib/x86_64-linux-gnu
/usr/lib/i386-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/aarch64-linux-gnu
/usr/lib/mipsel-linux-gnu
/usr/lib/mips-linux-gnu
/usr/lib/mips64el-linux-gnuabi64
/usr/lib/powerpc-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/powerpc64le-linux-gnu
/usr/lib/powerpc-linux-gnuspe
/usr/lib/hppa-linux-gnu
/usr/lib/s390x-linux-gnu
/usr/lib/i386-gnu
/usr/lib/hppa-linux-gnu
/usr/lib/x86_64-kfreebsd-gnu
/usr/lib/i386-kfreebsd-gnu
/usr/lib/m68k-linux-gnu
/usr/lib/sh4-linux-gnu
/usr/lib/sparc64-linux-gnu
/usr/lib/x86_64-linux-gnux32
/usr/lib/alpha-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/local/lib
/usr/local/lib64
/opt/local/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SPDLOG DEFAULT_MSG SPDLOG_INCLUDE_DIR SPDLOG_LIBRARY)
set_package_properties(SPDLOG PROPERTIES
URL "https://github.com/gabime/spdlog"
DESCRIPTION "Very fast, header-only/compiled, C++ logging library"
)
# Add imported target.
if(SPDLOG_FOUND)
set(SPDLOG_INCLUDE_DIRS "${SPDLOG_INCLUDE_DIR}")
if(NOT TARGET spdlog::spdlog)
add_library(spdlog::spdlog UNKNOWN IMPORTED)
set_target_properties(spdlog::spdlog PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIRS}"
)
set_property(TARGET spdlog::spdlog APPEND PROPERTY
IMPORTED_LOCATION "${SPDLOG_LIBRARY}"
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.11.0)
target_compile_definitions(spdlog::spdlog INTERFACE -DSPDLOG_FMT_EXTERNAL=1)
else()
set_property(TARGET spdlog::spdlog APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS SPDLOG_FMT_EXTERNAL=1
)
endif()
endif()

View File

@ -36,6 +36,8 @@ All notable changes to GNSS-SDR will be documented in this file.
and IGM05 (SSR Code Bias). Please note that the content of the HAS messages is
**not** applied to the computed PVT solution. In the Galileo E6B-only
receiver, HAS messages are decoded and reported.
- Added a `ZMQ_Signal_Source` for working with streams of samples published via
[ZeroMQ](https://zeromq.org/).
### Improvements in Maintainability:
@ -60,6 +62,7 @@ All notable changes to GNSS-SDR will be documented in this file.
- The configuration options at building time `-DENABLE_OWN_GLOG`,
`-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON`
and `OFF` without the need to start from an empty buiding folder.
- Improved CMake handling of the spdlog library used by GNU Radio >= 3.10.
### Improvements in Usability:
@ -75,6 +78,9 @@ All notable changes to GNSS-SDR will be documented in this file.
`Osmosdr_Signal_Source` implementation of a `SignalSource`.
- The `Osmosdr_Signal_Source` implementation learned a new parameter `if_bw` to
manually set the bandwidth of the bandpass filter on the radio frontend.
- The `UHD_Signal_Source` learned two new optional parameters
`device_recv_frame_size` and `device_num_recv_frames` for overriding
[transport layer defaults](https://files.ettus.com/manual/page_transport.html).
- The new configuration parameter `Channels_XX.RF_channel_ID` allows to specify
the signal source per channel group.
- Allowed the CMake project to be a sub-project.

View File

@ -32,19 +32,18 @@ target_include_directories(pvt_adapters
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(USE_OLD_BOOST_MATH_COMMON_FACTOR)
if((NOT (CMAKE_VERSION VERSION_LESS "3.1")) AND NOT (CMAKE_CXX_STANDARD VERSION_LESS 17))
target_compile_definitions(pvt_adapters
PRIVATE
-DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(pvt_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
-DUSE_STD_COMMON_FACTOR=1
)
else()
if(USE_OLD_BOOST_MATH_COMMON_FACTOR)
target_compile_definitions(pvt_adapters
PRIVATE
-DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1
)
endif()
endif()
if(ENABLE_CLANG_TIDY)

View File

@ -28,6 +28,10 @@
#include "rtklib_rtkpos.h" // for rtkfree, rtkinit
#include <glog/logging.h> // for LOG
#include <iostream> // for std::cout
#if USE_STD_COMMON_FACTOR
#include <numeric>
namespace bc = std;
#else
#if USE_OLD_BOOST_MATH_COMMON_FACTOR
#include <boost/math/common_factor_rt.hpp>
namespace bc = boost::math;
@ -35,6 +39,7 @@ namespace bc = boost::math;
#include <boost/integer/common_factor_rt.hpp>
namespace bc = boost::integer;
#endif
#endif
using namespace std::string_literals;

View File

@ -74,11 +74,18 @@ if(ENABLE_CLANG_TIDY)
endif()
endif()
if(USE_OLD_BOOST_MATH_COMMON_FACTOR)
if((NOT (CMAKE_VERSION VERSION_LESS "3.1")) AND NOT (CMAKE_CXX_STANDARD VERSION_LESS 17))
target_compile_definitions(pvt_gr_blocks
PRIVATE
-DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1
-DUSE_STD_COMMON_FACTOR=1
)
else()
if(USE_OLD_BOOST_MATH_COMMON_FACTOR)
target_compile_definitions(pvt_gr_blocks
PRIVATE
-DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1
)
endif()
endif()
if(USE_BOOST_BIND_PLACEHOLDERS)

View File

@ -86,6 +86,10 @@
#include <boost/bind/bind.hpp>
#endif
#if USE_STD_COMMON_FACTOR
#include <numeric>
namespace bc = std;
#else
#if USE_OLD_BOOST_MATH_COMMON_FACTOR
#include <boost/math/common_factor_rt.hpp>
namespace bc = boost::math;
@ -93,6 +97,7 @@ namespace bc = boost::math;
#include <boost/integer/common_factor_rt.hpp>
namespace bc = boost::integer;
#endif
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>

View File

@ -24,6 +24,7 @@
#include <cstdlib> // for mkstemp
#include <ctime> // for tm
#include <exception> // for exception
#include <iomanip> // for std::setprecision
#include <iostream> // for cout, cerr
#include <sstream>
#include <sys/stat.h> // for S_IXUSR | S_IRWXG | S_IRWXO

View File

@ -1873,8 +1873,8 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl
{
} // Avoid compiler warning
glonass_gnav_eph.d_P_1 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 2)));
glonass_gnav_eph.d_P_1 = (glonass_gnav_eph.d_P_1 + 1) * 15;
uint32_t P_1_tmp = Rtcm::bin_to_uint(message_bin.substr(index, 2));
glonass_gnav_eph.d_P_1 = (P_1_tmp == 0) ? 0. : (P_1_tmp + 1) * 15;
index += 2;
glonass_gnav_eph.d_t_k += static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 5))) * 3600;
@ -5102,8 +5102,9 @@ int32_t Rtcm::set_DF105(uint32_t glonass_gnav_alm_health_ind)
int32_t Rtcm::set_DF106(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{
// Convert the value from (15, 30, 45, 60) to (00, 01, 10, 11)
const auto P_1 = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_P_1 / 15.0 - 1.0));
// Convert the value from (0, 30, 45, 60) to (00, 01, 10, 11)
uint32_t P_1_tmp = std::round(glonass_gnav_eph.d_P_1 / 15.);
uint32_t P_1 = (P_1_tmp == 0) ? 0 : P_1_tmp - 1;
DF106 = std::bitset<2>(P_1);
return 0;
}

View File

@ -40,6 +40,8 @@ Channel::Channel(const ConfigurationInterface* configuration,
role_(role),
channel_(channel)
{
glonass_extend_correlation_ms_ = configuration->property("Tracking_1G.extend_correlation_ms", 0) + configuration->property("Tracking_2G.extend_correlation_ms", 0);
channel_fsm_ = std::make_shared<ChannelFsm>();
flag_enable_fpga_ = configuration->property("GNSS-SDR.enable_FPGA", false);
@ -128,7 +130,7 @@ void Channel::connect(gr::top_block_sptr top_block)
// Message ports
top_block->msg_connect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk"));
if ((trk_->get_right_block()->name() == "glonass_l1_ca_dll_pll_c_aid_tracking_cc") || (trk_->get_right_block()->name() == "glonass_l2_ca_dll_pll_c_aid_tracking_cc"))
if (glonass_dll_pll_c_aid_tracking_check())
{
top_block->msg_connect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples"));
}
@ -162,7 +164,7 @@ void Channel::disconnect(gr::top_block_sptr top_block)
nav_->disconnect(top_block);
top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk"));
if ((trk_->get_right_block()->name() == "glonass_l1_ca_dll_pll_c_aid_tracking_cc") || (trk_->get_right_block()->name() == "glonass_l2_ca_dll_pll_c_aid_tracking_cc"))
if (glonass_dll_pll_c_aid_tracking_check())
{
top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("preamble_timestamp_samples"), trk_->get_right_block(), pmt::mp("preamble_timestamp_samples"));
}
@ -270,3 +272,28 @@ void Channel::start_acquisition()
}
DLOG(INFO) << "Channel start_acquisition()";
}
bool Channel::glonass_dll_pll_c_aid_tracking_check()
{
if (glonass_extend_correlation_ms_)
{
const pmt::pmt_t nav_ports_out = nav_->get_left_block()->message_ports_out();
const pmt::pmt_t trk_ports_in = trk_->get_right_block()->message_ports_in();
const pmt::pmt_t symbol = pmt::mp("preamble_timestamp_samples");
for (unsigned k = 0; k < pmt::length(nav_ports_out); k++)
{
if (pmt::vector_ref(nav_ports_out, k) == symbol)
{
for (unsigned j = 0; j < pmt::length(trk_ports_in); j++)
{
if (pmt::vector_ref(trk_ports_in, j) == symbol)
{
return true;
}
}
return false;
}
}
}
return false;
}

View File

@ -96,6 +96,7 @@ public:
inline std::shared_ptr<TelemetryDecoderInterface> telemetry() const { return nav_; }
private:
bool glonass_dll_pll_c_aid_tracking_check();
std::shared_ptr<ChannelFsm> channel_fsm_;
std::shared_ptr<AcquisitionInterface> acq_;
std::shared_ptr<TrackingInterface> trk_;
@ -106,6 +107,7 @@ private:
std::string role_;
std::mutex mx_;
uint32_t channel_;
int glonass_extend_correlation_ms_;
bool connected_;
bool repeat_;
bool flag_enable_fpga_;

View File

@ -54,14 +54,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(channel_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_GENERIC_LAMBDAS)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)

View File

@ -42,14 +42,6 @@ target_link_libraries(conditioner_adapters
Glog::glog
)
if(GNURADIO_USES_SPDLOG)
target_link_libraries(conditioner_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(conditioner_adapters
PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -55,14 +55,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(data_type_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
set_property(TARGET data_type_gr_blocks
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -48,26 +48,18 @@ target_link_libraries(input_filter_gr_blocks
Volk::volk
)
if(LOG4CPP_FOUND)
target_link_libraries(input_filter_gr_blocks
PRIVATE
Log4cpp::log4cpp
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(input_filter_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(input_filter_gr_blocks
PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces
)
if(LOG4CPP_WITH_OLD_CMAKE)
target_link_libraries(input_filter_gr_blocks
PRIVATE
Log4cpp::log4cpp
)
endif()
if(GNURADIO_USES_STD_POINTERS)
target_compile_definitions(input_filter_gr_blocks
PUBLIC -DGNURADIO_USES_STD_POINTERS=1

View File

@ -119,14 +119,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(algorithms_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(FILESYSTEM_FOUND)
target_compile_definitions(algorithms_libs PUBLIC -DHAS_STD_FILESYSTEM=1)
if(find_experimental)

View File

@ -68,12 +68,23 @@ endif()
target_link_libraries(algorithms_libs_rtklib
PRIVATE
core_system_parameters
algorithms_libs
Gflags::gflags
Glog::glog
LAPACK::LAPACK
BLAS::BLAS
)
if(FILESYSTEM_FOUND)
target_compile_definitions(algorithms_libs_rtklib PUBLIC -DHAS_STD_FILESYSTEM=1)
if(find_experimental)
target_compile_definitions(algorithms_libs_rtklib PUBLIC -DHAS_STD_FILESYSTEM_EXPERIMENTAL=1)
endif()
target_link_libraries(algorithms_libs_rtklib PUBLIC std::filesystem)
else()
target_link_libraries(algorithms_libs_rtklib PUBLIC Boost::filesystem Boost::system)
endif()
set_property(TARGET algorithms_libs_rtklib
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -1108,28 +1108,28 @@ typedef struct
} serial_t;
typedef struct
{ /* file control type */
FILE *fp; /* file pointer */
FILE *fp_tag; /* file pointer of tag file */
FILE *fp_tmp; /* temporary file pointer for swap */
FILE *fp_tag_tmp; /* temporary file pointer of tag file for swap */
char path[MAXSTRPATH]; /* file path */
char openpath[MAXSTRPATH]; /* open file path */
int mode; /* file mode */
int timetag; /* time tag flag (0:off,1:on) */
int repmode; /* replay mode (0:master,1:slave) */
int offset; /* time offset (ms) for slave */
gtime_t time; /* start time */
gtime_t wtime; /* write time */
unsigned int tick; /* start tick */
unsigned int tick_f; /* start tick in file */
unsigned int fpos; /* current file position */
double start; /* start offset (s) */
double speed; /* replay speed (time factor) */
double swapintv; /* swap interval (hr) (0: no swap) */
lock_t lock; /* lock flag */
} file_t;
struct file_t
{ /* file control type */
FILE *fp = nullptr; /* file pointer */
FILE *fp_tag = nullptr; /* file pointer of tag file */
FILE *fp_tmp = nullptr; /* temporary file pointer for swap */
FILE *fp_tag_tmp = nullptr; /* temporary file pointer of tag file for swap */
std::string path; /* file path */
std::string openpath; /* open file path */
int mode = 0; /* file mode */
int timetag; /* time tag flag (0:off,1:on) */
int repmode = 0; /* replay mode (0:master,1:slave) */
int offset = 0; /* time offset (ms) for slave */
gtime_t time = {}; /* start time */
gtime_t wtime = {}; /* write time */
unsigned int tick = 0; /* start tick */
unsigned int tick_f = 0; /* start tick in file */
unsigned int fpos = 0; /* current file position */
double start = 0; /* start offset (s) */
double speed = 0; /* replay speed (time factor) */
double swapintv = 0; /* swap interval (hr) (0: no swap) */
lock_t lock; /* lock flag */
};
typedef struct

View File

@ -720,7 +720,6 @@ int raim_fde(const obsd_t *obs, int n, const double *rs,
obsd_t *obs_e;
sol_t sol_e = {{0, 0}, {}, {}, {}, '0', '0', '0', 0.0, 0.0, 0.0};
char tstr[32];
char name[16];
char msg_e[128];
double *rs_e;
double *dts_e;
@ -819,8 +818,8 @@ int raim_fde(const obsd_t *obs, int n, const double *rs,
if (stat)
{
time2str(obs[0].time, tstr, 2);
satno2id(sat, name);
trace(2, "%s: %s excluded by raim\n", tstr + 11, name);
auto name = satno2id(sat);
trace(2, "%s: %s excluded by raim\n", tstr + 11, name.data());
}
free(obs_e);
free(rs_e);

View File

@ -747,7 +747,6 @@ void pppoutsolstat(rtk_t *rtk, int level, FILE *fp)
int j;
int week;
int nfreq = 1;
char id[32];
if (level <= 0 || !fp)
{
@ -804,11 +803,11 @@ void pppoutsolstat(rtk_t *rtk, int level, FILE *fp)
{
continue;
}
satno2id(i + 1, id);
auto id = satno2id(i + 1);
for (j = 0; j < nfreq; j++)
{
fprintf(fp, "$SAT,%d,%.3f,%s,%d,%.1f,%.1f,%.4f,%.4f,%d,%.0f,%d,%d,%d,%d,%d,%d\n",
week, tow, id, j + 1, ssat->azel[0] * R2D, ssat->azel[1] * R2D,
week, tow, id.data(), j + 1, ssat->azel[0] * R2D, ssat->azel[1] * R2D,
ssat->resp[j], ssat->resc[j], ssat->vsat[j], ssat->snr[j] * 0.25,
ssat->fix[j], ssat->slip[j] & 3, ssat->lock[j], ssat->outc[j],
ssat->slipc[j], ssat->rejc[j]);

View File

@ -35,7 +35,7 @@
#include <cassert>
#include <cstring>
#include <dirent.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <sys/stat.h>
@ -43,7 +43,6 @@
#include <sys/types.h>
#include <vector>
const double GPST0[] = {1980, 1, 6, 0, 0, 0}; /* gps time reference */
const double GST0[] = {1999, 8, 22, 0, 0, 0}; /* galileo system time reference */
const double BDT0[] = {2006, 1, 1, 0, 0, 0}; /* beidou time reference */
@ -460,37 +459,50 @@ int satid2no(const char *id)
* char *id O satellite id (Gnn,Rnn,Enn,Jnn,Cnn,Inn or nnn)
* return : none
*-----------------------------------------------------------------------------*/
void satno2id(int sat, char *id)
std::string satno2id(int sat)
{
std::ostringstream ss;
ss << std::setfill('0'); // all PRNs are 0-filled
std::string prefix;
int width = 2;
int prn;
char id_aux[16];
switch (satsys(sat, &prn))
{
case SYS_GPS:
std::snprintf(id, sizeof(id_aux), "G%02d", prn - MINPRNGPS + 1);
return;
prefix = "G";
prn = prn - MINPRNGPS + 1;
break;
case SYS_GLO:
snprintf(id, sizeof(id_aux), "R%02d", prn - MINPRNGLO + 1);
return;
prefix = "R";
prn = prn - MINPRNGLO + 1;
break;
case SYS_GAL:
std::snprintf(id, sizeof(id_aux), "E%02d", prn - MINPRNGAL + 1);
return;
prefix = "E";
prn = prn - MINPRNGAL + 1;
break;
case SYS_QZS:
std::snprintf(id, sizeof(id_aux), "J%02d", prn - MINPRNQZS + 1);
return;
prefix = "J";
prn = prn - MINPRNQZS + 1;
break;
case SYS_BDS:
std::snprintf(id, sizeof(id_aux), "C%02d", prn - MINPRNBDS + 1);
return;
prefix = "C";
prn = prn - MINPRNBDS + 1;
break;
case SYS_IRN:
std::snprintf(id, sizeof(id_aux), "I%02d", prn - MINPRNIRN + 1);
return;
prefix = "I";
prn = prn - MINPRNIRN + 1;
break;
case SYS_LEO:
std::snprintf(id, sizeof(id_aux), "L%02d", prn - MINPRNLEO + 1);
return;
prefix = "L";
prn = prn - MINPRNLEO + 1;
break;
case SYS_SBS:
std::snprintf(id, sizeof(id_aux), "%03d", prn);
return;
width = 3;
break;
}
ss << prefix << std::setw(width) << prn;
return ss.str();
}
@ -2833,9 +2845,9 @@ int readantex(const char *file, pcvs_t *pcvs)
if (strstr(buff + 60, "TYPE / SERIAL NO"))
{
strncpy(pcv.type, buff, 20);
strncpy(pcv.type, buff, 20); // MAXANT (64)
pcv.type[20] = '\0';
strncpy(pcv.code, buff + 20, 20);
strncpy(pcv.code, buff + 20, 20); // MAXANT (64)
pcv.code[20] = '\0';
if (!strncmp(pcv.code + 3, " ", 8))
{
@ -3090,9 +3102,9 @@ void readpos(const char *file, const char *rcv, double *pos)
{
continue;
}
// strncpy(stas[np], str, 15); This line triggers a warning. Replaced by:
memcpy(stas[np], str, 15 * sizeof(stas[np][0]));
stas[np++][15] = '\0';
auto sta = stas[np++]; // NOLINT(readability-qualified-auto)
std::strncpy(sta, str, 16);
sta[15] = '\0';
}
fclose(fp);
len = static_cast<int>(strlen(rcv));
@ -3700,7 +3712,6 @@ int savenav(const char *file, const nav_t *nav)
{
FILE *fp;
int i;
char id[32];
trace(3, "savenav: file=%s\n", file);
@ -3715,12 +3726,12 @@ int savenav(const char *file, const nav_t *nav)
{
continue;
}
satno2id(nav->eph[i].sat, id);
auto id = satno2id(nav->eph[i].sat);
fprintf(fp,
"%s,%d,%d,%d,%d,%d,%d,%d,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
"%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
"%.14E,%.14E,%.14E,%.14E,%.14E,%d,%d\n",
id, nav->eph[i].iode, nav->eph[i].iodc, nav->eph[i].sva,
id.data(), nav->eph[i].iode, nav->eph[i].iodc, nav->eph[i].sva,
nav->eph[i].svh, static_cast<int>(nav->eph[i].toe.time),
static_cast<int>(nav->eph[i].toc.time), static_cast<int>(nav->eph[i].ttr.time),
nav->eph[i].A, nav->eph[i].e, nav->eph[i].i0, nav->eph[i].OMG0,
@ -3736,11 +3747,11 @@ int savenav(const char *file, const nav_t *nav)
{
continue;
}
satno2id(nav->geph[i].sat, id);
auto id = satno2id(nav->geph[i].sat);
fprintf(fp,
"%s,%d,%d,%d,%d,%d,%d,%d,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
"%.14E,%.14E,%.14E,%.14E,%.14E,%.14E\n",
id, nav->geph[i].iode, nav->geph[i].frq, nav->geph[i].svh,
id.data(), nav->geph[i].iode, nav->geph[i].frq, nav->geph[i].svh,
nav->geph[i].sva, nav->geph[i].age, static_cast<int>(nav->geph[i].toe.time),
static_cast<int>(nav->geph[i].tof.time),
nav->geph[i].pos[0], nav->geph[i].pos[1], nav->geph[i].pos[2],
@ -3841,7 +3852,7 @@ void freenav(nav_t *nav, int opt)
// #ifdef TRACE
//
FILE *fp_trace = nullptr; /* file pointer of trace */
char file_trace[1024]; /* trace file */
std::string file_trace; /* trace file */
static int level_trace = 0; /* level of trace */
unsigned int tick_trace = 0; /* tick time at traceopen (ms) */
gtime_t time_trace = {0, 0.0}; /* time at traceopen */
@ -3850,7 +3861,7 @@ pthread_mutex_t lock_trace; /* lock for trace */
void traceswap()
{
gtime_t time = utc2gpst(timeget());
char path[1024];
std::string path;
rtk_lock(&lock_trace);
@ -3872,7 +3883,7 @@ void traceswap()
fclose(fp_trace);
}
if (!(fp_trace = fopen(path, "we")))
if (!(fp_trace = fopen(path.data(), "we")))
{
fp_trace = stderr;
}
@ -3883,22 +3894,15 @@ void traceswap()
void traceopen(const char *file)
{
gtime_t time = utc2gpst(timeget());
char path[1024];
std::string path;
reppath(file, path, time, "", "");
if (!*path || !(fp_trace = fopen(path, "we")))
if (path.empty() or (fp_trace = fopen(path.data(), "we")) == nullptr)
{
fp_trace = stderr;
}
if (strlen(file) < 1025)
{
std::strncpy(file_trace, file, 1024);
file_trace[1023] = '\0';
}
else
{
trace(1, "file array is too long");
}
file_trace = file;
tick_trace = tickget();
time_trace = time;
initlock(&lock_trace);
@ -3912,7 +3916,7 @@ void traceclose()
fclose(fp_trace);
}
fp_trace = nullptr;
file_trace[0] = '\0';
file_trace.clear();
}
@ -3967,9 +3971,9 @@ void traceobs(int level __attribute__((unused)), const obsd_t *obs __attribute__
// if (!fp_trace||level>level_trace) return;
// for (i=0;i<n;i++) {
// time2str(obs[i].time,str,3);
// satno2id(obs[i].sat,id);
// auto id = satno2id(obs[i].sat);
// fprintf(fp_trace," (%2d) %s %-3s rcv%d %13.3f %13.3f %13.3f %13.3f %d %d %d %d %3.1f %3.1f\n",
// i+1,str,id,obs[i].rcv,obs[i].L[0],obs[i].L[1],obs[i].P[0],
// i+1,str,id.data(),obs[i].rcv,obs[i].L[0],obs[i].L[1],obs[i].P[0],
// obs[i].P[1],obs[i].LLI[0],obs[i].LLI[1],obs[i].code[0],
// obs[i].code[1],obs[i].SNR[0]*0.25,obs[i].SNR[1]*0.25);
// }
@ -3985,9 +3989,9 @@ void traceobs(int level __attribute__((unused)), const obsd_t *obs __attribute__
// for (i=0;i<nav->n;i++) {
// time2str(nav->eph[i].toe,s1,0);
// time2str(nav->eph[i].ttr,s2,0);
// satno2id(nav->eph[i].sat,id);
// auto id = satno2id(nav->eph[i].sat);
// fprintf(fp_trace,"(%3d) %-3s : %s %s %3d %3d %02x\n",i+1,
// id,s1,s2,nav->eph[i].iode,nav->eph[i].iodc,nav->eph[i].svh);
// id.data(),s1,s2,nav->eph[i].iode,nav->eph[i].iodc,nav->eph[i].svh);
// }
// fprintf(fp_trace,"(ion) %9.4e %9.4e %9.4e %9.4e\n",nav->ion_gps[0],
// nav->ion_gps[1],nav->ion_gps[2],nav->ion_gps[3]);
@ -4005,9 +4009,9 @@ void traceobs(int level __attribute__((unused)), const obsd_t *obs __attribute__
// for (i=0;i<nav->ng;i++) {
// time2str(nav->geph[i].toe,s1,0);
// time2str(nav->geph[i].tof,s2,0);
// satno2id(nav->geph[i].sat,id);
// auto id = satno2id(nav->geph[i].sat);
// fprintf(fp_trace,"(%3d) %-3s : %s %s %2d %2d %8.3f\n",i+1,
// id,s1,s2,nav->geph[i].frq,nav->geph[i].svh,nav->geph[i].taun*1e6);
// id.data(),s1,s2,nav->geph[i].frq,nav->geph[i].svh,nav->geph[i].taun*1e6);
// }
// }
// extern void tracehnav(int level, const nav_t *nav)
@ -4019,14 +4023,14 @@ void traceobs(int level __attribute__((unused)), const obsd_t *obs __attribute__
// for (i=0;i<nav->ns;i++) {
// time2str(nav->seph[i].t0,s1,0);
// time2str(nav->seph[i].tof,s2,0);
// satno2id(nav->seph[i].sat,id);
// auto id = satno2id(nav->seph[i].sat);
// fprintf(fp_trace,"(%3d) %-3s : %s %s %2d %2d\n",i+1,
// id,s1,s2,nav->seph[i].svh,nav->seph[i].sva);
// id.data(),s1,s2,nav->seph[i].svh,nav->seph[i].sva);
// }
// }
// extern void tracepeph(int level, const nav_t *nav)
// {
// char s[64],id[16];
// char s[64];
// int i,j;
//
// if (!fp_trace||level>level_trace) return;
@ -4034,9 +4038,9 @@ void traceobs(int level __attribute__((unused)), const obsd_t *obs __attribute__
// for (i=0;i<nav->ne;i++) {
// time2str(nav->peph[i].time,s,0);
// for (j=0;j<MAXSAT;j++) {
// satno2id(j+1,id);
// auto id = satno2id(j+1);
// fprintf(fp_trace,"%-3s %d %-3s %13.3f %13.3f %13.3f %13.3f %6.3f %6.3f %6.3f %6.3f\n",
// s,nav->peph[i].index,id,
// s,nav->peph[i].index,id.data(),
// nav->peph[i].pos[j][0],nav->peph[i].pos[j][1],
// nav->peph[i].pos[j][2],nav->peph[i].pos[j][3]*1e9,
// nav->peph[i].std[j][0],nav->peph[i].std[j][1],
@ -4046,7 +4050,7 @@ void traceobs(int level __attribute__((unused)), const obsd_t *obs __attribute__
// }
// extern void tracepclk(int level, const nav_t *nav)
// {
// char s[64],id[16];
// char s[64];
// int i,j;
//
// if (!fp_trace||level>level_trace) return;
@ -4054,9 +4058,9 @@ void traceobs(int level __attribute__((unused)), const obsd_t *obs __attribute__
// for (i=0;i<nav->nc;i++) {
// time2str(nav->pclk[i].time,s,0);
// for (j=0;j<MAXSAT;j++) {
// satno2id(j+1,id);
// auto id = satno2id(j+1);
// fprintf(fp_trace,"%-3s %d %-3s %13.3f %6.3f\n",
// s,nav->pclk[i].index,id,
// s,nav->pclk[i].index,id.data(),
// nav->pclk[i].clk[j][0]*1e9,nav->pclk[i].std[j][0]*1e9);
// }
// }
@ -4114,69 +4118,31 @@ int execcmd(const char *cmd)
* return : none
* notes : not recursive. only one level
*-----------------------------------------------------------------------------*/
void createdir(const char *path)
void createdir(fs::path const &path)
{
char buff[1024];
char *p;
// tracet(3, "createdir: path=%s\n", path);
errorlib::error_code ec;
if (strlen(path) < 1025)
auto created = fs::create_directory(path, ec);
if (not created)
{
std::strncpy(buff, path, 1024);
buff[1023] = '\0';
}
else
{
trace(1, "path is too long");
}
if (!(p = strrchr(buff, FILEPATHSEP)))
{
return;
}
*p = '\0';
if (mkdir(buff, 0777) != 0)
{
trace(1, "Error creating folder");
trace(1, "Error creating folder: %s", path.c_str());
}
}
/* replace string ------------------------------------------------------------*/
int repstr(char *str, const char *pat, const char *rep)
int repstr(std::string &str, std::string const &pat, std::string const &rep)
{
int len = static_cast<int>(strlen(pat));
char buff[1024];
char *p;
char *q;
char *r;
int replaced = 0;
for (p = str, r = buff; *p; p = q + len)
auto pos = str.find(pat);
if (pos != std::string::npos)
{
if (!(q = strstr(p, pat)))
{
break;
}
strncpy(r, p, q - p);
r += q - p;
r += std::snprintf(r, sizeof(buff), "%s", rep);
}
if (p <= str)
{
return 0;
str.replace(pos, pat.length(), rep);
replaced = 1;
}
if (strlen(p) < 1025)
{
std::strncpy(r, p, 1024);
r[1023] = '\0';
}
else
{
trace(1, "pat array is too long");
}
std::strncpy(str, buff, 1024);
return 1;
return replaced;
}
@ -4208,23 +4174,19 @@ int repstr(char *str, const char *pat, const char *rep)
* %r -> rrrr : rover id
* %b -> bbbb : base station id
*-----------------------------------------------------------------------------*/
int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
int reppath(std::string const &path, std::string &rpath, gtime_t time, const char *rov,
const char *base)
{
double ep[6];
double ep0[6] = {2000, 1, 1, 0, 0, 0};
int week;
int dow;
int doy;
int stat = 0;
char rep[64];
std::strncpy(rpath, path, 1024);
rpath = path;
// synctactic sugar; implements C++23 std::string::contains()
auto patFind = [](std::string const &s, std::string const &pat) -> bool {
auto pos = s.find(pat);
return pos != s.npos;
};
if (!strstr(rpath, "%"))
{
return 0;
}
if (*rov)
{
stat |= repstr(rpath, "%r", rov);
@ -4235,10 +4197,17 @@ int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
}
if (time.time != 0)
{
char rep[64]; // scratch space for replacement string
double ep[6];
time2epoch(time, ep);
ep0[0] = ep[0];
dow = static_cast<int>(floor(time2gpst(time, &week) / 86400.0));
doy = static_cast<int>(floor(timediff(time, epoch2time(ep0)) / 86400.0)) + 1;
int week = 0;
auto dow = static_cast<int>(floor(time2gpst(time, &week) / 86400.0));
double ep0[6] = {ep[0], 1, 1, 0, 0, 0};
auto doy = static_cast<int>(floor(timediff(time, epoch2time(ep0)) / 86400.0)) + 1;
std::snprintf(rep, sizeof(rep), "%02d", (static_cast<int>(ep[3]) / 3) * 3);
stat |= repstr(rpath, "%ha", rep);
std::snprintf(rep, sizeof(rep), "%02d", (static_cast<int>(ep[3]) / 6) * 6);
@ -4270,78 +4239,18 @@ int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
std::snprintf(rep, sizeof(rep), "%02d", (static_cast<int>(ep[4]) / 15) * 15);
stat |= repstr(rpath, "%t", rep);
}
else if (strstr(rpath, "%ha") || strstr(rpath, "%hb") || strstr(rpath, "%hc") ||
strstr(rpath, "%Y") || strstr(rpath, "%y") || strstr(rpath, "%m") ||
strstr(rpath, "%d") || strstr(rpath, "%h") || strstr(rpath, "%M") ||
strstr(rpath, "%S") || strstr(rpath, "%n") || strstr(rpath, "%W") ||
strstr(rpath, "%D") || strstr(rpath, "%H") || strstr(rpath, "%t"))
else if (patFind(rpath, "%ha") || patFind(rpath, "%hb") || patFind(rpath, "%hc") ||
patFind(rpath, "%Y") || patFind(rpath, "%y") || patFind(rpath, "%m") ||
patFind(rpath, "%d") || patFind(rpath, "%h") || patFind(rpath, "%M") ||
patFind(rpath, "%S") || patFind(rpath, "%n") || patFind(rpath, "%W") ||
patFind(rpath, "%D") || patFind(rpath, "%H") || patFind(rpath, "%t"))
{
return -1; /* no valid time */
stat = -1; /* no valid time */
}
return stat;
}
/* replace keywords in file path and generate multiple paths -------------------
* replace keywords in file path with date, time, rover and base station id
* generate multiple keywords-replaced paths
* args : char *path I file path (see below)
* char *rpath[] O file paths in which keywords replaced
* int nmax I max number of output file paths
* gtime_t ts I time start (gpst)
* gtime_t te I time end (gpst)
* char *rov I rover id string ("": not replaced)
* char *base I base station id string ("": not replaced)
* return : number of replaced file paths
* notes : see reppath() for replacements of keywords.
* minimum interval of time replaced is 900s.
*-----------------------------------------------------------------------------*/
int reppaths(const char *path, char *rpath[], int nmax, gtime_t ts,
gtime_t te, const char *rov, const char *base)
{
gtime_t time;
double tow;
double tint = 86400.0;
int i;
int n = 0;
int week;
trace(3, "reppaths: path =%s nmax=%d rov=%s base=%s\n", path, nmax, rov, base);
if (ts.time == 0 || te.time == 0 || timediff(ts, te) > 0.0)
{
return 0;
}
if (strstr(path, "%S") || strstr(path, "%M") || strstr(path, "%t"))
{
tint = 900.0;
}
else if (strstr(path, "%h") || strstr(path, "%H"))
{
tint = 3600.0;
}
tow = time2gpst(ts, &week);
time = gpst2time(week, floor(tow / tint) * tint);
while (timediff(time, te) <= 0.0 && n < nmax)
{
reppath(path, rpath[n], time, rov, base);
if (n == 0 || strcmp(rpath[n], rpath[n - 1]) != 0)
{
n++;
}
time = timeadd(time, tint);
}
for (i = 0; i < n; i++)
{
trace(3, "reppaths: rpath=%s\n", rpath[i]);
}
return n;
}
/* satellite carrier wave length -----------------------------------------------
* get satellite carrier wave lengths
* args : int sat I satellite number

View File

@ -62,6 +62,24 @@
#include <cstddef>
#include <string>
#if HAS_STD_FILESYSTEM
#include <system_error>
namespace errorlib = std;
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#include <filesystem>
namespace fs = std::filesystem;
#endif
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
/* coordinate rotation matrix ------------------------------------------------*/
#define Rx(t, X) \
@ -102,7 +120,7 @@ void fatalerr(const char *format, ...);
int satno(int sys, int prn);
int satsys(int sat, int *prn);
int satid2no(const char *id);
void satno2id(int sat, char *id);
std::string satno2id(int sat);
int satexclude(int sat, int svh, const prcopt_t *opt);
int testsnr(int base, int freq, double el, double snr, const snrmask_t *mask);
unsigned char obs2code(const char *obs, int *freq);
@ -229,12 +247,9 @@ void traceobs(int level, const obsd_t *obs, int n);
// void traceb (int level, const unsigned char *p, int n);
int execcmd(const char *cmd);
void createdir(const char *path);
int repstr(char *str, const char *pat, const char *rep);
int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
void createdir(fs::path const &path);
int reppath(std::string const &path, std::string &rpath, gtime_t time, const char *rov,
const char *base);
int reppaths(const char *path, char *rpath[], int nmax, gtime_t ts,
gtime_t te, const char *rov, const char *base);
double satwavelen(int sat, int frq, const nav_t *nav);
double geodist(const double *rs, const double *rr, double *e);
double satazel(const double *pos, const double *e, double *azel);

View File

@ -37,6 +37,7 @@
#include "rtklib_tides.h"
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
static int resamb_WLNL(rtk_t *rtk __attribute((unused)), const obsd_t *obs __attribute((unused)), const int *sat __attribute((unused)),
@ -124,7 +125,7 @@ static gtime_t time_stat = {0, 0}; /* rtk status file time */
int rtkopenstat(const char *file, int level)
{
gtime_t time = utc2gpst(timeget());
char path[1024];
std::string path;
trace(3, "rtkopenstat: file=%s level=%d\n", file, level);
@ -135,9 +136,9 @@ int rtkopenstat(const char *file, int level)
reppath(file, path, time, "", "");
if (!(fp_stat = fopen(path, "we")))
if (!(fp_stat = fopen(path.data(), "we")))
{
trace(1, "rtkopenstat: file open error path=%s\n", path);
trace(1, "rtkopenstat: file open error path=%s\n", path.data());
return 0;
}
if (strlen(file) < 1025)
@ -191,7 +192,6 @@ void rtkoutstat(rtk_t *rtk, char *buff __attribute__((unused)))
int est;
int nfreq;
int nf = NF_RTK(&rtk->opt);
char id[32];
if (statlevel <= 0 || !fp_stat)
{
@ -264,11 +264,11 @@ void rtkoutstat(rtk_t *rtk, char *buff __attribute__((unused)))
{
continue;
}
satno2id(i + 1, id);
auto id = satno2id(i + 1);
j = II_RTK(i + 1, &rtk->opt);
xa[0] = j < rtk->na ? rtk->xa[j] : 0.0;
fprintf(fp_stat, "$ION,%d,%.3f,%d,%s,%.1f,%.1f,%.4f,%.4f\n", week, tow, rtk->sol.stat,
id, ssat->azel[0] * R2D, ssat->azel[1] * R2D, rtk->x[j], xa[0]);
id.data(), ssat->azel[0] * R2D, ssat->azel[1] * R2D, rtk->x[j], xa[0]);
}
}
/* tropospheric parameters */
@ -306,11 +306,11 @@ void rtkoutstat(rtk_t *rtk, char *buff __attribute__((unused)))
{
continue;
}
satno2id(i + 1, id);
auto id = satno2id(i + 1);
for (j = 0; j < nfreq; j++)
{
fprintf(fp_stat, "$SAT,%d,%.3f,%s,%d,%.1f,%.1f,%.4f,%.4f,%d,%.0f,%d,%d,%d,%d,%d,%d\n",
week, tow, id, j + 1, ssat->azel[0] * R2D, ssat->azel[1] * R2D,
week, tow, id.data(), j + 1, ssat->azel[0] * R2D, ssat->azel[1] * R2D,
ssat->resp[j], ssat->resc[j], ssat->vsat[j], ssat->snr[j] * 0.25,
ssat->fix[j], ssat->slip[j] & 3, ssat->lock[j], ssat->outc[j],
ssat->slipc[j], ssat->rejc[j]);
@ -323,7 +323,7 @@ void rtkoutstat(rtk_t *rtk, char *buff __attribute__((unused)))
void swapsolstat()
{
gtime_t time = utc2gpst(timeget());
char path[1024];
std::string path;
if (static_cast<int>(time2gpst(time, nullptr) / INT_SWAP_STAT) ==
static_cast<int>(time2gpst(time_stat, nullptr) / INT_SWAP_STAT))
@ -341,12 +341,12 @@ void swapsolstat()
fclose(fp_stat);
}
if (!(fp_stat = fopen(path, "we")))
if (!(fp_stat = fopen(path.data(), "we")))
{
trace(2, "swapsolstat: file open error path=%s\n", path);
trace(2, "swapsolstat: file open error path=%s\n", path.data());
return;
}
trace(3, "swapsolstat: path=%s\n", path);
trace(3, "swapsolstat: path=%s\n", path.data());
}
@ -367,7 +367,6 @@ void outsolstat(rtk_t *rtk)
int est;
int nfreq;
int nf = NF_RTK(&rtk->opt);
char id[32];
if (statlevel <= 0 || !fp_stat)
{
@ -440,11 +439,11 @@ void outsolstat(rtk_t *rtk)
{
continue;
}
satno2id(i + 1, id);
auto id = satno2id(i + 1);
j = II_RTK(i + 1, &rtk->opt);
xa[0] = j < rtk->na ? rtk->xa[j] : 0.0;
fprintf(fp_stat, "$ION,%d,%.3f,%d,%s,%.1f,%.1f,%.4f,%.4f\n", week, tow, rtk->sol.stat,
id, ssat->azel[0] * R2D, ssat->azel[1] * R2D, rtk->x[j], xa[0]);
id.data(), ssat->azel[0] * R2D, ssat->azel[1] * R2D, rtk->x[j], xa[0]);
}
}
/* tropospheric parameters */
@ -482,11 +481,11 @@ void outsolstat(rtk_t *rtk)
{
continue;
}
satno2id(i + 1, id);
auto id = satno2id(i + 1);
for (j = 0; j < nfreq; j++)
{
fprintf(fp_stat, "$SAT,%d,%.3f,%s,%d,%.1f,%.1f,%.4f,%.4f,%d,%.0f,%d,%d,%d,%d,%d,%d\n",
week, tow, id, j + 1, ssat->azel[0] * R2D, ssat->azel[1] * R2D,
week, tow, id.data(), j + 1, ssat->azel[0] * R2D, ssat->azel[1] * R2D,
ssat->resp[j], ssat->resc[j], ssat->vsat[j], ssat->snr[j] * 0.25,
ssat->fix[j], ssat->slip[j] & 3, ssat->lock[j], ssat->outc[j],
ssat->slipc[j], ssat->rejc[j]);

View File

@ -31,6 +31,8 @@
*/
#include "rtklib_stream.h"
#include "gnss_sdr_make_unique.h" // for std::make:unique in C++11
#include "gnss_sdr_string_literals.h" // for std::string_literals
#include "rtklib_rtkcmn.h"
#include "rtklib_solution.h"
#include <arpa/inet.h>
@ -38,9 +40,13 @@
#include <cerrno>
#include <cinttypes>
#include <cstring>
#include <deque>
#include <fcntl.h>
#include <memory>
#include <netdb.h>
#include <netinet/tcp.h>
#include <regex>
#include <sstream>
#include <string>
#include <sys/socket.h>
#include <sys/stat.h>
@ -48,6 +54,7 @@
#include <termios.h>
#include <unistd.h>
using namespace std::string_literals;
/* global options ------------------------------------------------------------*/
@ -118,7 +125,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
}
parity = static_cast<char>(toupper(static_cast<int>(parity)));
std::string s_aux = "/dev/" + std::string(port);
std::string s_aux = "/dev/"s + std::string(port);
s_aux.resize(128, '\0');
int n = s_aux.length();
for (i = 0; i < n; i++)
@ -228,18 +235,17 @@ int stateserial(serial_t *serial)
int openfile_(file_t *file, gtime_t time, char *msg)
{
FILE *fp;
char *rw;
char tagpath[MAXSTRPATH + 4] = "";
char tagh[TIMETAGH_LEN + 1] = "";
tracet(3, "openfile_: path=%s time=%s\n", file->path, time_str(time, 0));
tracet(3, "openfile_: path=%s time=%s\n", file->path.data(), time_str(time, 0));
file->time = utc2gpst(timeget());
file->tick = file->tick_f = tickget();
file->fpos = 0;
/* use stdin or stdout if file path is null */
if (!*file->path)
/* use stdin or stdout if file path is empty */
if (file->path.empty())
{
file->fp = file->mode & STR_MODE_R ? stdin : stdout;
return 1;
@ -250,37 +256,39 @@ int openfile_(file_t *file, gtime_t time, char *msg)
/* create directory */
if ((file->mode & STR_MODE_W) && !(file->mode & STR_MODE_R))
{
createdir(file->openpath);
createdir(file->openpath.data());
}
char const *mode;
if (file->mode & STR_MODE_R)
{
rw = const_cast<char *>("rb");
mode = "rb";
}
else
{
rw = const_cast<char *>("wb");
mode = "wb";
}
if (!(file->fp = fopen(file->openpath, rw)))
if (!(file->fp = fopen(file->openpath.data(), mode)))
{
std::snprintf(msg, MAXSTRMSG, "file open error");
tracet(1, "openfile: %s\n", msg);
return 0;
}
tracet(4, "openfile_: open file %s (%s)\n", file->openpath, rw);
tracet(4, "openfile_: open file %s (%s)\n", file->openpath.data(), mode);
std::snprintf(tagpath, MAXSTRPATH + 4, "%s.tag", file->openpath);
std::snprintf(tagpath, MAXSTRPATH + 4, "%s.tag", file->openpath.data());
if (file->timetag)
{ /* output/sync time-tag */
if (!(file->fp_tag = fopen(tagpath, rw)))
if (!(file->fp_tag = fopen(tagpath, mode)))
{
std::snprintf(msg, MAXSTRMSG, "tag open error");
tracet(1, "openfile: %s\n", msg);
fclose(file->fp);
return 0;
}
tracet(4, "openfile_: open tag file %s (%s)\n", tagpath, rw);
tracet(4, "openfile_: open tag file %s (%s)\n", tagpath, mode);
if (file->mode & STR_MODE_R)
{
@ -326,131 +334,132 @@ int openfile_(file_t *file, gtime_t time, char *msg)
/* close file ----------------------------------------------------------------*/
void closefile_(file_t *file)
{
tracet(3, "closefile_: path=%s\n", file->path);
tracet(3, "closefile_: path=%s\n", file->path.data());
if (file->fp)
{
fclose(file->fp);
file->fp = nullptr;
}
if (file->fp_tag)
{
fclose(file->fp_tag);
file->fp_tag = nullptr;
}
if (file->fp_tmp)
{
fclose(file->fp_tmp);
file->fp_tmp = nullptr;
}
if (file->fp_tag_tmp)
{
fclose(file->fp_tag_tmp);
file->fp_tag_tmp = nullptr;
}
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr;
}
/* open file (path=filepath[::T[::+<off>][::x<speed>]][::S=swapintv]) --------*/
file_t *openfile(const char *path, int mode, char *msg)
file_t *openfile(std::string const &path, int mode, char *msg)
{
file_t *file;
gtime_t time;
gtime_t time0 = {0, 0.0};
double speed = 0.0;
double start = 0.0;
double swapintv = 0.0;
char *p;
int timetag = 0;
tracet(3, "openfile: path=%s mode=%d\n", path.data(), mode);
tracet(3, "openfile: path=%s mode=%d\n", path, mode);
if (!(mode & (STR_MODE_R | STR_MODE_W)))
if ((mode & (STR_MODE_R | STR_MODE_W)) == 0)
{
return nullptr;
}
// Split the string by regular expression (in this case, the trivial "::" string)
std::regex re("::");
auto first = std::sregex_token_iterator(path.begin(), path.end(), re, -1);
auto last = std::sregex_token_iterator();
std::deque<std::string> tokens(first, last);
auto file = std::make_unique<file_t>();
file->mode = mode;
file->path = tokens.front(); // first token is the path
tokens.pop_front();
/* file options */
for (p = const_cast<char *>(path); (p = strstr(p, "::")); p += 2)
{ /* file options */
if (*(p + 2) == 'T')
{
timetag = 1;
}
else if (*(p + 2) == '+')
{
sscanf(p + 2, "+%lf", &start);
}
else if (*(p + 2) == 'x')
{
sscanf(p + 2, "x%lf", &speed);
}
else if (*(p + 2) == 'S')
{
sscanf(p + 2, "S=%lf", &swapintv);
}
}
if (start <= 0.0)
while (not tokens.empty())
{
start = 0.0;
}
if (swapintv <= 0.0)
{
swapintv = 0.0;
auto tag = tokens.front();
tokens.pop_front();
// edge case that may not be possible, but I don't want to test for right now
if (tag.empty()) continue; // NOLINT(readability-braces-around-statements)
if (tag == "T")
{
file->timetag = 1;
}
else if (tag[0] == '+')
{
double start = 0.0;
std::istringstream ss(tag);
ss.ignore(1, '+') >> start;
// do we care if there are extra characters?
if (start < 0)
{
start = 0;
}
file->start = start;
}
else if (tag[0] == 'x')
{
double speed = 0.0;
std::istringstream ss(tag);
ss.ignore(1, 'x') >> speed;
// do we care if there are extra characters?
file->speed = speed;
}
else if (tag[0] == 'S')
{
double swapintv = 0.0;
std::istringstream ss(tag);
ss.ignore(1, 'S').ignore(1, '=') >> swapintv;
// do we care if there are extra characters?
if (swapintv < 0) swapintv = 0; // NOLINT(readability-braces-around-statements)
file->swapintv = swapintv;
}
else
{
// unexpected value ... not previously handled
}
}
if (!(file = static_cast<file_t *>(malloc(sizeof(file_t)))))
{
return nullptr;
}
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr;
if (strlen(path) < MAXSTRPATH)
{
std::strncpy(file->path, path, MAXSTRPATH);
file->path[MAXSTRPATH - 1] = '\0';
}
if ((p = strstr(file->path, "::")))
{
*p = '\0';
}
file->openpath[0] = '\0';
file->mode = mode;
file->timetag = timetag;
file->repmode = 0;
file->offset = 0;
file->time = file->wtime = time0;
file->tick = file->tick_f = file->fpos = 0;
file->start = start;
file->speed = speed;
file->swapintv = swapintv;
initlock(&file->lock);
time = utc2gpst(timeget());
auto time = utc2gpst(timeget());
/* open new file */
if (!openfile_(file, time, msg))
if (!openfile_(file.get(), time, msg))
{
free(file);
return nullptr;
file.reset();
}
return file;
return file.release(); // ownership belongs to the caller now
}
/* close file ----------------------------------------------------------------*/
void closefile(file_t *file)
{
if (!file)
if (file)
{
return;
std::unique_ptr<file_t> fileH(file);
tracet(3, "closefile: fp=%p \n", fileH->fp);
closefile_(fileH.get());
}
tracet(3, "closefile: fp=%p \n", file->fp);
closefile_(file);
free(file);
}
/* open new swap file --------------------------------------------------------*/
void swapfile(file_t *file, gtime_t time, char *msg)
{
char openpath[MAXSTRPATH];
std::string openpath;
tracet(3, "swapfile: fp=%p \n time=%s\n", file->fp, time_str(time, 0));
@ -463,9 +472,9 @@ void swapfile(file_t *file, gtime_t time, char *msg)
/* check path of new swap file */
reppath(file->path, openpath, time, "", "");
if (!strcmp(openpath, file->openpath))
if (openpath == file->openpath)
{
tracet(2, "swapfile: no need to swap %s\n", openpath);
tracet(2, "swapfile: no need to swap %s\n", openpath.data());
return;
}
/* save file pointer to temporary pointer */
@ -1739,7 +1748,7 @@ ntrip_t *openntrip(const char *path, int type, char *msg)
/* ntrip access via proxy server */
if (*proxyaddr)
{
std::string s_aux = "http://" + std::string(tpath);
std::string s_aux = "http://"s + std::string(tpath);
int n = s_aux.length();
if (n < 256)
{
@ -1924,19 +1933,6 @@ gtime_t nextdltime(const int *topts, int stat)
void *ftpthread(void *arg)
{
auto *ftp = static_cast<ftp_t *>(arg);
FILE *fp;
gtime_t time;
char remote[1024];
char local[1024];
char tmpfile[1024];
char errfile[1024];
char *p;
char cmd[2048];
char env[1024] = "";
char opt[1024];
char *proxyopt = const_cast<char *>("");
char *proto;
int ret;
tracet(3, "ftpthread:\n");
@ -1948,152 +1944,117 @@ void *ftpthread(void *arg)
return nullptr;
}
/* replace keyword in file path and local path */
time = timeadd(utc2gpst(timeget()), ftp->topts[0]);
auto time = timeadd(utc2gpst(timeget()), ftp->topts[0]);
std::string remote;
reppath(ftp->file, remote, time, "", "");
auto remotePath = fs::path(remote);
if ((p = strrchr(remote, '/')))
{
p++;
}
else
{
p = remote;
}
std::string s_aux = std::string(localdir) + std::to_string(FILEPATHSEP) + std::string(p);
int n = s_aux.length();
if (n < 1024)
{
for (int i = 0; i < n; i++)
{
local[i] = s_aux[i];
}
}
auto local = fs::path(localdir);
local /= remotePath.filename();
std::string s_aux2 = std::string(local) + ".err";
n = s_aux2.length();
if (n < 1024)
{
for (int i = 0; i < n; i++)
{
errfile[i] = s_aux2[i];
}
}
auto errfile = fs::path(local);
errfile.replace_extension("err");
/* if local file exist, skip download */
std::strncpy(tmpfile, local, 1024);
tmpfile[1023] = '\0';
if ((p = strrchr(tmpfile, '.')) &&
(!strcmp(p, ".z") || !strcmp(p, ".gz") || !strcmp(p, ".zip") ||
!strcmp(p, ".Z") || !strcmp(p, ".GZ") || !strcmp(p, ".ZIP")))
auto tmpfile = local;
for (auto ext : {".z", ".gz", ".zip", ".Z", ".GZ", ".ZIP"}) // NOLINT(readability-qualified-auto): auto decoration is less readable
{
*p = '\0';
if (tmpfile.extension() == ext)
{
tmpfile.replace_extension("");
break;
}
}
if ((fp = fopen(tmpfile, "rbe")))
if (fs::exists(tmpfile))
{
fclose(fp);
std::strncpy(ftp->local, tmpfile, 1024);
std::strncpy(ftp->local, tmpfile.c_str(), 1024);
ftp->local[1023] = '\0';
tracet(3, "ftpthread: file exists %s\n", ftp->local);
ftp->state = 2;
return nullptr;
}
std::string env;
/* proxy settings for wget (ref [2]) */
auto proxyopt = std::string();
if (*proxyaddr)
{
proto = ftp->proto ? const_cast<char *>("http") : const_cast<char *>("ftp");
std::snprintf(env, sizeof(env), "set %s_proxy=http://%s & ", proto, proxyaddr);
proxyopt = const_cast<char *>("--proxy=on ");
auto proto = "ftp"s;
if (ftp->proto) proto = "http"s; // NOLINT(readability-braces-around-statements): adding braces reduces readability
env = "set "s + proto + "_proxy=http://"s + std::string(proxyaddr) + " % ";
proxyopt = "--proxy=on ";
}
/* download command (ref [2]) */
auto cmd_str = std::string();
if (ftp->proto == 0)
{ /* ftp */
s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) +
" --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) +
" -O \"" + std::string(local) + "\"";
int k = s_aux.length();
if (k < 1024)
{
for (int i = 0; i < k; i++)
{
opt[i] = s_aux[i];
}
}
auto opt_str = "--ftp-user="s + std::string(ftp->user) + " --ftp-password="s + std::string(ftp->passwd) +
" --glob=off --passive-ftp "s + proxyopt + "s-t 1 -T "s + std::to_string(FTP_TIMEOUT) +
R"( -O ")" + local.native() + R"(")"s;
s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
k = s_aux2.length();
for (int i = 0; (i < k) && (i < 1024); i++)
{
cmd[i] = s_aux2[i];
}
// TODO: this uses shell syntax; consider escaping paths
cmd_str = env + std::string(FTP_CMD) + " "s + opt_str + " "s +
R"("ftp://)"s + std::string(ftp->addr) + "/"s + remotePath.native() + R"(" 2> ")"s + errfile.native() + "\"\n"s;
}
else
{ /* http */
s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\"";
int l = s_aux.length();
for (int i = 0; (i < l) && (i < 1024); i++)
{
opt[i] = s_aux[i];
}
auto opt_str = proxyopt + " -t 1 -T "s + std::to_string(FTP_TIMEOUT) + " -O \""s + local.native() + "\""s;
s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
l = s_aux2.length();
for (int i = 0; (i < l) && (i < 1024); i++)
{
cmd[i] = s_aux2[i];
}
cmd_str = env + std::string(FTP_CMD) + " "s + opt_str + " "s +
R"("http://)"s + std::string(ftp->addr) + "/"s + remotePath.native() + R"(" 2> ")"s + errfile.native() + "\"\n";
}
/* execute download command */
if ((ret = execcmd(cmd)))
errorlib::error_code ec; // prevent exceptions
auto ret = execcmd(cmd_str.c_str());
if ((ret != 0))
{
if (remove(local) != 0)
if (fs::remove(local, ec) == false)
{
trace(1, "Error removing file");
trace(1, "Error removing file %s", local.c_str());
}
tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret);
tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd_str.data(), ret);
ftp->error = ret;
ftp->state = 3;
return nullptr;
}
if (remove(errfile) != 0)
if (fs::remove(errfile, ec) == false)
{
trace(1, "Error removing file");
trace(1, "Error removing file %s", errfile.c_str());
}
/* uncompress downloaded file */
if ((p = strrchr(local, '.')) &&
(!strcmp(p, ".z") || !strcmp(p, ".gz") || !strcmp(p, ".zip") ||
!strcmp(p, ".Z") || !strcmp(p, ".GZ") || !strcmp(p, ".ZIP")))
for (auto ext : {".z", ".gz", ".zip", ".Z", ".GZ", ".ZIP"}) // NOLINT(readability-qualified-auto): auto decoration is less readable
{
if (rtk_uncompress(local, tmpfile))
if (local.extension() == ext)
{
if (remove(local) != 0)
char tmpfile_arg[1024];
ret = rtk_uncompress(local.c_str(), tmpfile_arg);
if (ret != 0) // success
{
trace(1, "Error removing file");
if (fs::remove(local, ec) == false)
{
trace(1, "Error removing file %s", local.c_str());
}
local = tmpfile_arg;
}
if (strlen(tmpfile) < 1024)
else
{
std::strncpy(local, tmpfile, 1024);
local[1023] = '\0';
tracet(1, "file uncompact error: %s\n", local.c_str());
ftp->error = 12;
ftp->state = 3;
return nullptr;
}
}
else
{
tracet(1, "file uncompact error: %s\n", local);
ftp->error = 12;
ftp->state = 3;
return nullptr;
break;
}
}
if (strlen(local) < 1024)
{
std::strncpy(ftp->local, local, 1024);
ftp->local[1023] = '\0';
}
std::strncpy(ftp->local, local.c_str(), 1024);
ftp->local[1023] = '\0';
ftp->state = 2; /* ftp completed */
tracet(3, "ftpthread: complete cmd=%s\n", cmd);
tracet(3, "ftpthread: complete cmd=%s\n", cmd_str.data());
return nullptr;
}
@ -2115,7 +2076,7 @@ ftp_t *openftp(const char *path, int type, char *msg)
ftp->state = 0;
ftp->proto = type;
ftp->error = 0;
ftp->thread = 0; // NOLINT
ftp->thread = pthread_t();
ftp->local[0] = '\0';
/* decode ftp path */

View File

@ -37,14 +37,6 @@ target_link_libraries(obs_gr_blocks
Gnuradio::pmt
)
if(GNURADIO_USES_SPDLOG)
target_link_libraries(obs_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(obs_gr_blocks
PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -50,14 +50,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(NOT GNURADIO_USES_LOG4CPP)
target_link_libraries(resampler_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(resampler_gr_blocks
PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -44,14 +44,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_generator_adapters
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(signal_generator_adapters

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
@ -84,6 +84,11 @@ if(ENABLE_UHD)
set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} uhd_signal_source.h)
endif()
if(ENABLE_ZMQ)
list(APPEND OPT_DRIVER_SOURCES zmq_signal_source.cc)
list(APPEND OPT_DRIVER_HEADERS zmq_signal_source.h)
endif()
set(SIGNAL_SOURCE_ADAPTER_SOURCES
signal_source_base.cc
@ -192,6 +197,13 @@ if(ENABLE_UHD)
)
endif()
if(ENABLE_ZMQ)
target_link_libraries(signal_source_adapters
PUBLIC
Gnuradio::zeromq
)
endif()
if(ENABLE_OSMOSDR AND GROSMOSDR_FOUND)
target_link_libraries(signal_source_adapters
PUBLIC

View File

@ -9,7 +9,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -37,6 +37,12 @@ size_t SignalSourceBase::getRfChannels() const
return rfChannels_;
}
gr::basic_block_sptr SignalSourceBase::get_left_block()
{
LOG(WARNING) << "Trying to get signal source left block.";
return {};
}
SignalSourceBase::SignalSourceBase(ConfigurationInterface const* configuration, std::string role, std::string impl)
: role_(std::move(role)), implementation_(std::move(impl))
{
@ -44,3 +50,52 @@ SignalSourceBase::SignalSourceBase(ConfigurationInterface const* configuration,
// depending on the order of initialization, assign rfChannels_ in the body
rfChannels_ = configuration->property(role_ + ".RF_channels"s, uint64_t(1U));
}
size_t SignalSourceBase::decode_item_type(std::string const& item_type, bool* is_interleaved, bool throw_on_error)
{
size_t item_size = 0;
// The default is for samples not to be interleaved
if (is_interleaved) *is_interleaved = false; // NOLINT
if (item_type == "gr_complex"s)
{
item_size = sizeof(gr_complex);
}
else if (item_type == "float"s)
{
item_size = sizeof(float);
}
else if (item_type == "short"s)
{
item_size = sizeof(int16_t);
}
else if (item_type == "ishort"s)
{
item_size = sizeof(int16_t);
if (is_interleaved) *is_interleaved = true; // NOLINT
}
else if (item_type == "byte"s)
{
item_size = sizeof(int8_t);
}
else if (item_type == "ibyte"s)
{
item_size = sizeof(int8_t);
if (is_interleaved) *is_interleaved = true; // NOLINT
}
else
{
if (throw_on_error)
{
throw std::invalid_argument(item_type + " is not a recognized item type"s);
}
else
{
LOG(WARNING) << item_type
<< " unrecognized item type. Using gr_complex.";
item_size = sizeof(gr_complex);
}
}
return item_size;
}

View File

@ -9,7 +9,7 @@
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -32,11 +32,21 @@ public:
std::string implementation() final;
size_t getRfChannels() const override;
gr::basic_block_sptr get_left_block() override; // non-sensical; implement once
protected:
//! Constructor
SignalSourceBase(ConfigurationInterface const* configuration, std::string role, std::string impl);
//! utility for decoding passed ".item_type" values
//! @param[in] item_type - user provided string, should be one of the known types
//! @param[out] is_interleaved - if non-null, the pointed to memory is updated with
//! whether the data is interleaved I/Q (e.g., ishort)
//! @param[in] throw_on_error - if true, throw an exception if the string does not
//! represent a known type
//! @return the size in bytes of the passed type
size_t decode_item_type(std::string const& item_type, bool* is_interleaved = nullptr, bool throw_on_error = false);
private:
std::string const role_;
std::string const implementation_;

View File

@ -65,6 +65,20 @@ UhdSignalSource::UhdSignalSource(const ConfigurationInterface* configuration,
sample_rate_ = configuration->property(role + ".sampling_frequency", 4.0e6);
item_type_ = configuration->property(role + ".item_type", default_item_type);
// UHD TRANSPORT PARAMETERS
// option to manually set device "num_recv_frames"
std::string device_num_recv_frames = configuration->property(role + ".device_num_recv_frames", empty);
if (empty != device_num_recv_frames) // if not empty
{
dev_addr["num_recv_frames"] = device_num_recv_frames;
}
// option to manually set device "recv_frame_size"
std::string device_recv_frame_size = configuration->property(role + ".device_recv_frame_size", empty);
if (empty != device_recv_frame_size) // if not empty
{
dev_addr["recv_frame_size"] = device_recv_frame_size;
}
if (RF_channels_ == 1)
{
// Single RF channel UHD operation (backward compatible config file format)

View File

@ -0,0 +1,82 @@
/*!
* \file zmq_signal_source.cc
* \brief Signal source which reads from ZeroMQ.
* \author Jim Melton, 2022. jim.melton(at)sncorp.com
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "zmq_signal_source.h"
#include "configuration_interface.h"
#include "gnss_sdr_string_literals.h"
#include <glog/logging.h>
#include <vector>
using namespace std::string_literals;
ZmqSignalSource::ZmqSignalSource(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int /* in_stream [[maybe_unused]] */,
unsigned int /* out_stream [[maybe_unused]] */,
Concurrent_Queue<pmt::pmt_t>* /* queue [[maybe_unused]] */)
: SignalSourceBase(configuration, role, "ZMQ_Signal_Source"s),
d_item_size(decode_item_type(configuration->property(role + ".item_type"s, "gr_complex"s), nullptr, true)),
d_dump_filename(configuration->property(role + ".dump_filename"s, "data/zmq_dump.dat"s)),
d_dump(configuration->property(role + ".dump"s, false))
{
auto vlen = configuration->property(role + ".vlen"s, 1);
auto pass_tags = configuration->property(role + ".pass_tags"s, false);
auto timeout_ms = configuration->property(role + ".timeout_ms"s, 100);
auto hwm = configuration->property(role + ".hwm"s, -1);
auto property = role + ".endpoint"s;
auto endpoint = configuration->property(property, ""s);
std::vector<char> address(endpoint.c_str(), endpoint.c_str() + endpoint.size() + 1);
if (!endpoint.empty())
{
LOG(INFO) << "Connecting to ZMQ pub at " << endpoint;
d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, address.data(), timeout_ms, pass_tags, hwm);
}
else
{
std::cerr << "For ZMQ_Signal_Source " << property << " must be defined" << std::endl;
throw std::invalid_argument(property + ": undefined");
}
}
auto ZmqSignalSource::item_size() -> size_t { return d_item_size; }
auto ZmqSignalSource::connect(gr::top_block_sptr top_block) -> void
{
if (d_dump)
{
d_dump_sink = gr::blocks::file_sink::make(item_size(), d_dump_filename.data());
top_block->connect(d_source_block, 0, d_dump_sink, 0);
}
}
auto ZmqSignalSource::disconnect(gr::top_block_sptr top_block) -> void
{
if (d_dump)
{
top_block->disconnect(d_dump_sink);
}
}
auto ZmqSignalSource::get_right_block() -> gr::basic_block_sptr
{
return d_source_block;
}

View File

@ -0,0 +1,78 @@
/*!
* \file zmq_signal_source.h
* \brief Signal source which reads from ZeroMQ.
* \author Jim Melton, 2022. jim.melton(at)sncorp.com
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_ZMQ_SIGNAL_SOURCE_H
#define GNSS_SDR_ZMQ_SIGNAL_SOURCE_H
#include "signal_source_base.h"
//
#include "concurrent_queue.h"
#include <gnuradio/blocks/file_sink.h> // for dump
#include <gnuradio/zeromq/sub_source.h>
#include <pmt/pmt.h>
#include <string>
/** \addtogroup Signal_Source
* \{ */
/** \addtogroup Signal_Source_adapters
* \{ */
//! This class supports the following properties:
//!
//! .endpoint - the ZMQ endpoint to be connected to
//! .vlen - vector length of the input items (default 1, one item)
//! this must match the size of the publisher!
//! .pass_tags - boolean flag if tags should be propagated (default false)
//! .timeout_ms - receive timeout, in milliseconds (default 100)
//! .hwm - ZMQ high water mark (default -1, ZMQ default)
//!
//! .item_type - data type of the samples (default "gr_complex")
//!
//! (probably should be abstracted to the base class)
//!
//! .dump - whether to archive input data
//! .dump_filename - if dumping, path to file for output
//!
class ZmqSignalSource : public SignalSourceBase
{
public:
ZmqSignalSource(const ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_stream,
unsigned int out_stream,
Concurrent_Queue<pmt::pmt_t>* queue);
~ZmqSignalSource() = default;
size_t item_size() override;
auto connect(gr::top_block_sptr top_block) -> void override;
auto disconnect(gr::top_block_sptr top_block) -> void override;
auto get_right_block() -> gr::basic_block_sptr override;
private:
gr::zeromq::sub_source::sptr d_source_block;
gr::blocks::file_sink::sptr d_dump_sink;
size_t d_item_size;
std::string d_dump_filename;
bool d_dump;
};
/** \} */
/** \} */
#endif

View File

@ -80,14 +80,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_source_libs
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
target_link_libraries(signal_source_libs
PUBLIC

View File

@ -69,14 +69,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(telemetry_decoder_gr_blocks
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
target_include_directories(telemetry_decoder_gr_blocks
PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces

View File

@ -85,7 +85,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(const p
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
if (d_enable_extended_integration == false) // avoid re-setting preamble indicator
{
d_preamble_timestamp_s = pmt::to_double(msg);
d_preamble_timestamp_samples = pmt::to_double(msg);
d_enable_extended_integration = true;
d_preamble_synchronized = false;
}
@ -134,10 +134,10 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
d_pll_to_dll_assist_secs_Ti(0.0),
d_carr_phase_error_secs_Ti(0.0),
d_code_error_chips_Ti(0.0),
d_preamble_timestamp_s(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_preamble_timestamp_samples(0.0),
d_code_error_filt_chips_s(0.0),
d_code_error_filt_chips_Ti(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_correlation_length_samples(static_cast<int32_t>(d_vector_length)),
d_sample_counter(0ULL),
d_acq_sample_stamp(0),
@ -154,8 +154,8 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
d_dump(dump)
{
// Telemetry bit synchronization message port input
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
this->message_port_register_in(pmt::mp("preamble_timestamp_samples"));
this->set_msg_handler(pmt::mp("preamble_timestamp_samples"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else
@ -209,7 +209,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
const double acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
// Doppler effect
// Fd=(C/(C+Vr))*F
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
d_glonass_freq_ch = GLONASS_L1_CA_FREQ_HZ + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
// new chip and prn sequence periods based on acq Doppler
d_code_freq_chips = radial_velocity * GLONASS_L1_CA_CODE_RATE_CPS;
@ -273,8 +273,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
// enable tracking
d_pull_in = true;
d_enable_tracking = true;
d_enable_extended_integration = true;
d_preamble_synchronized = true;
d_enable_extended_integration = false;
d_preamble_synchronized = false;
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
<< " Code Phase correction [samples]=" << delay_correction_samples
@ -604,7 +604,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
bool enable_dll_pll;
if (d_enable_extended_integration == true)
{
int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples) / static_cast<double>(d_fs_in) - d_preamble_timestamp_s));
int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples - d_preamble_timestamp_samples) / static_cast<double>(d_fs_in)));
if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0)
{
// compute coherent integration and enable tracking loop
@ -631,6 +631,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
}
// UPDATE INTEGRATION TIME
CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_extend_correlation_ms) * GLONASS_L1_CA_CODE_PERIOD_S;
d_code_loop_filter.set_pdi(static_cast<float>(CURRENT_INTEGRATION_TIME_S));
enable_dll_pll = true;
}
else

View File

@ -170,10 +170,10 @@ private:
double d_pll_to_dll_assist_secs_Ti;
double d_carr_phase_error_secs_Ti;
double d_code_error_chips_Ti;
double d_preamble_timestamp_s;
int32_t d_extend_correlation_ms;
double d_preamble_timestamp_samples;
double d_code_error_filt_chips_s;
double d_code_error_filt_chips_Ti;
int32_t d_extend_correlation_ms;
// Integration period in samples
int32_t d_correlation_length_samples;

View File

@ -83,7 +83,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(const p
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN);
if (d_enable_extended_integration == false) // avoid re-setting preamble indicator
{
d_preamble_timestamp_s = pmt::to_double(msg);
d_preamble_timestamp_samples = pmt::to_double(msg);
d_enable_extended_integration = true;
d_preamble_synchronized = false;
}
@ -132,10 +132,10 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
d_pll_to_dll_assist_secs_Ti(0.0),
d_carr_phase_error_secs_Ti(0.0),
d_code_error_chips_Ti(0.0),
d_preamble_timestamp_s(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_preamble_timestamp_samples(0.0),
d_code_error_filt_chips_s(0.0),
d_code_error_filt_chips_Ti(0.0),
d_extend_correlation_ms(extend_correlation_ms),
d_correlation_length_samples(static_cast<int32_t>(d_vector_length)),
d_sample_counter(0ULL),
d_acq_sample_stamp(0),
@ -152,8 +152,8 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
d_dump(dump)
{
// Telemetry bit synchronization message port input
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
this->message_port_register_in(pmt::mp("preamble_timestamp_samples"));
this->set_msg_handler(pmt::mp("preamble_timestamp_samples"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else
@ -206,7 +206,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
const double acq_trk_diff_seconds = static_cast<double>(acq_trk_diff_samples) / static_cast<double>(d_fs_in);
// Doppler effect
// Fd=(C/(C+Vr))*F
d_glonass_freq_ch = GLONASS_L2_CA_FREQ_HZ + (GLONASS_L2_CA_FREQ_HZ * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
d_glonass_freq_ch = GLONASS_L2_CA_FREQ_HZ + (DFRQ2_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN));
const double radial_velocity = (d_glonass_freq_ch + d_acq_carrier_doppler_hz) / d_glonass_freq_ch;
// new chip and prn sequence periods based on acq Doppler
d_code_freq_chips = radial_velocity * GLONASS_L2_CA_CODE_RATE_CPS;
@ -269,8 +269,8 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
// enable tracking
d_pull_in = true;
d_enable_tracking = true;
d_enable_extended_integration = true;
d_preamble_synchronized = true;
d_enable_extended_integration = false;
d_preamble_synchronized = false;
d_acc_carrier_phase_initialized = false;
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
@ -601,7 +601,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
bool enable_dll_pll;
if (d_enable_extended_integration == true)
{
const int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples) / static_cast<double>(d_fs_in) - d_preamble_timestamp_s));
const int64_t symbol_diff = round(1000.0 * ((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples - d_preamble_timestamp_samples) / static_cast<double>(d_fs_in)));
if (symbol_diff > 0 and symbol_diff % d_extend_correlation_ms == 0)
{
// compute coherent integration and enable tracking loop
@ -663,6 +663,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
// perform basic (1ms) correlation
// UPDATE INTEGRATION TIME
CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_correlation_length_samples) / static_cast<double>(d_fs_in);
d_code_loop_filter.set_pdi(static_cast<float>(CURRENT_INTEGRATION_TIME_S));
enable_dll_pll = true;
}
}

View File

@ -165,10 +165,10 @@ private:
double d_pll_to_dll_assist_secs_Ti;
double d_carr_phase_error_secs_Ti;
double d_code_error_chips_Ti;
double d_preamble_timestamp_s;
int32_t d_extend_correlation_ms;
double d_preamble_timestamp_samples;
double d_code_error_filt_chips_s;
double d_code_error_filt_chips_Ti;
int32_t d_extend_correlation_ms;
// Integration period in samples
int32_t d_correlation_length_samples;

View File

@ -429,7 +429,7 @@ bool Gnss_Sdr_Supl_Client::load_gal_ephemeris_xml(const std::string& file_name)
}
bool save_gal_ephemeris_map_xml(const std::string& file_name, std::map<int, Galileo_Ephemeris> eph_map)
bool Gnss_Sdr_Supl_Client::save_gal_ephemeris_map_xml(const std::string& file_name, std::map<int, Galileo_Ephemeris> eph_map)
{
if (eph_map.empty() == false)
{
@ -476,7 +476,7 @@ bool Gnss_Sdr_Supl_Client::load_cnav_ephemeris_xml(const std::string& file_name)
}
bool save_cnav_ephemeris_map_xml(const std::string& file_name, std::map<int, Gps_CNAV_Ephemeris> eph_map)
bool Gnss_Sdr_Supl_Client::save_cnav_ephemeris_map_xml(const std::string& file_name, std::map<int, Gps_CNAV_Ephemeris> eph_map)
{
if (eph_map.empty() == false)
{
@ -510,9 +510,9 @@ bool Gnss_Sdr_Supl_Client::load_gnav_ephemeris_xml(const std::string& file_name)
{
ifs.open(file_name.c_str(), std::ifstream::binary | std::ifstream::in);
boost::archive::xml_iarchive xml(ifs);
gps_cnav_ephemeris_map.clear();
glonass_gnav_ephemeris_map.clear();
xml >> boost::serialization::make_nvp("GNSS-SDR_gnav_ephemeris_map", this->glonass_gnav_ephemeris_map);
LOG(INFO) << "Loaded GLONASS ephemeris map data with " << this->gps_cnav_ephemeris_map.size() << " satellites";
LOG(INFO) << "Loaded GLONASS ephemeris map data with " << this->glonass_gnav_ephemeris_map.size() << " satellites";
}
catch (std::exception& e)
{
@ -523,7 +523,7 @@ bool Gnss_Sdr_Supl_Client::load_gnav_ephemeris_xml(const std::string& file_name)
}
bool save_gnav_ephemeris_map_xml(const std::string& file_name, std::map<int, Glonass_Gnav_Ephemeris> eph_map)
bool Gnss_Sdr_Supl_Client::save_gnav_ephemeris_map_xml(const std::string& file_name, std::map<int, Glonass_Gnav_Ephemeris> eph_map)
{
if (eph_map.empty() == false)
{

View File

@ -122,7 +122,7 @@ public:
/*!
* \brief Save GPS CNAV ephemeris map to XML file.
*/
bool save_cnav_ephemeris_map_xml(const std::string file_name,
bool save_cnav_ephemeris_map_xml(const std::string& file_name,
std::map<int, Gps_CNAV_Ephemeris> eph_map);
/*!
@ -133,7 +133,7 @@ public:
/*!
* \brief Save Galileo ephemeris map to XML file.
*/
bool save_gal_ephemeris_map_xml(const std::string file_name,
bool save_gal_ephemeris_map_xml(const std::string& file_name,
std::map<int, Galileo_Ephemeris> eph_map);
/*!
@ -144,7 +144,7 @@ public:
/*!
* \brief Save GLONASS GNAV ephemeris map to XML file.
*/
bool save_gnav_ephemeris_map_xml(const std::string file_name,
bool save_gnav_ephemeris_map_xml(const std::string& file_name,
std::map<int, Glonass_Gnav_Ephemeris> eph_map);
/*!

View File

@ -65,6 +65,15 @@ target_include_directories(core_libs_supl
${CMAKE_CURRENT_SOURCE_DIR}/types
)
# This is ancient and unmaintained code. As the project migrates to modern
# compilers, non-standards-conforming constructs will be flagged as errors. This
# should be upgraded, but until then, allow non-standards-conforming constructs
if(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
set_target_properties(core_libs_supl
PROPERTIES C_EXTENSIONS ON
)
endif()
set_property(TARGET core_libs_supl
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

View File

@ -73,14 +73,6 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(GNURADIO_USES_SPDLOG)
target_link_libraries(core_monitor
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_BOOST_ASIO_IO_CONTEXT)
target_compile_definitions(core_monitor
PUBLIC

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
@ -112,6 +112,10 @@ if(ENABLE_ARRAY)
target_compile_definitions(core_receiver PRIVATE -DRAW_ARRAY_DRIVER=1)
endif()
if(ENABLE_ZMQ)
target_compile_definitions(core_receiver PRIVATE -DZEROMQ_DRIVER=1)
endif()
if(ENABLE_FLEXIBAND)
target_compile_definitions(core_receiver PRIVATE -DFLEXIBAND_DRIVER=1)
endif()

View File

@ -16,7 +16,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-2022 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
@ -171,6 +171,10 @@
#include "flexiband_signal_source.h"
#endif
#if ZEROMQ_DRIVER
#include "zmq_signal_source.h"
#endif
#if CUDA_GPU_ACCEL
#include "gps_l1_ca_dll_pll_tracking_gpu.h"
#endif
@ -799,6 +803,16 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
}
#endif
#if ZEROMQ_DRIVER
else if (implementation == "ZMQ_Signal_Source")
{
std::unique_ptr<GNSSBlockInterface> block_ = std::make_unique<ZmqSignalSource>(configuration, role, in_streams,
out_streams, queue);
block = std::move(block_);
}
#endif
// DATA TYPE ADAPTER -----------------------------------------------------------
else if (implementation == "Byte_To_Short")
{

View File

@ -235,6 +235,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
{
int32_t J = 0;
d_frame_ID = 0U;
uint64_t P_1_tmp = 0;
// Unpack bytes to bits
const std::bitset<GLONASS_GNAV_STRING_BITS> string_bits(frame_string);
@ -252,7 +253,8 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame
{
case 1:
// --- It is string 1 -----------------------------------------------
gnav_ephemeris.d_P_1 = (static_cast<double>(read_navigation_unsigned(string_bits, P1)) + 1) * 15;
P_1_tmp = read_navigation_unsigned(string_bits, P1);
gnav_ephemeris.d_P_1 = (P_1_tmp == 0) ? 0. : (P_1_tmp + 1) * 15;
gnav_ephemeris.d_t_k = static_cast<double>(read_navigation_unsigned(string_bits, T_K_HR)) * 3600 +
static_cast<double>(read_navigation_unsigned(string_bits, T_K_MIN)) * 60 +
static_cast<double>(read_navigation_unsigned(string_bits, T_K_SEC)) * 30;

View File

@ -46,6 +46,7 @@
#include <chrono>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <thread>

View File

@ -53,14 +53,6 @@ target_include_directories(signal_processing_testing_lib
${GNSSSDR_SOURCE_DIR}/src/tests/common-files
)
if(GNURADIO_USES_SPDLOG)
target_link_libraries(signal_processing_testing_lib
PUBLIC
fmt::fmt
spdlog::spdlog
)
endif()
if(USE_GENERIC_LAMBDAS)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)

View File

@ -63,6 +63,7 @@
#include <chrono>
#include <cmath>
#include <exception>
#include <iomanip>
#include <unistd.h>
#include <utility>
#if GNSSTK_USES_GPSTK_NAMESPACE

View File

@ -62,6 +62,7 @@
#include <chrono>
#include <cmath>
#include <exception>
#include <iomanip>
#include <pthread.h>
#include <unistd.h>
#include <utility>

View File

@ -274,13 +274,13 @@ TEST(RtcmTest, MT1020)
Glonass_Gnav_Utc_Model gnav_utc_model_read = Glonass_Gnav_Utc_Model();
// Perform data read and print of special values types
gnav_ephemeris.d_P_1 = 15;
gnav_ephemeris.d_P_1 = 0.;
// Bit distribution per fields
gnav_ephemeris.d_t_k = 7560;
gnav_ephemeris.d_t_k = 7560.;
// Glonass signed values
gnav_ephemeris.d_VXn = -0.490900039672852;
// Bit distribution per fields dependent on other factors
gnav_ephemeris.d_t_b = 8100;
gnav_ephemeris.d_t_b = 8100.;
// Binary flag representation
gnav_ephemeris.d_P_3 = true;

View File

@ -22,6 +22,7 @@
#include <gnuradio/top_block.h>
#include <chrono>
#include <exception>
#include <iomanip>
#include <string>
#include <unistd.h>
#include <utility>

View File

@ -39,6 +39,7 @@
#include <matio.h>
#include <pmt/pmt.h>
#include <chrono>
#include <iomanip>
#include <unistd.h>
#include <utility>
#include <vector>

View File

@ -42,6 +42,7 @@
#include <chrono>
#include <cstdio> // FPGA read input file
#include <fcntl.h>
#include <iomanip>
#include <iostream>
#include <unistd.h>
#include <utility>

View File

@ -38,6 +38,7 @@
#include <gtest/gtest.h>
#include <pmt/pmt.h>
#include <chrono>
#include <iomanip>
#include <unistd.h>
#include <utility>
#include <vector>

View File

@ -76,10 +76,10 @@ TEST(GlonassGnavNavigationMessageTest, String1Decoder)
Glonass_Gnav_Ephemeris gnav_ephemeris;
// Fill out ephemeris values for truth
gnav_ephemeris.d_P_1 = 15;
gnav_ephemeris.d_t_k = 7560;
gnav_ephemeris.d_P_1 = 0.;
gnav_ephemeris.d_t_k = 7560.;
gnav_ephemeris.d_VXn = -0.490900039672852;
gnav_ephemeris.d_AXn = 0;
gnav_ephemeris.d_AXn = 0.;
gnav_ephemeris.d_Xn = -11025.6669921875;
// Call target test method

View File

@ -60,6 +60,7 @@
#include <cstdlib>
#include <ctime> // for ctime
#include <exception>
#include <iomanip> // for std::setiosflags, std::setprecision
#include <iostream>
#include <map>
#include <memory>

View File

@ -13,10 +13,10 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND
if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK)
include(GNUInstallDirs)
if(GNSSTK_USES_GPSTK_NAMESPACE)
set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include)
else()
set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include)
endif()
endif()