mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 20:50:33 +00:00
Merge branch 'next' of https://github.com/carlesfernandez/gnss-sdr into next
This commit is contained in:
commit
bc6a84a112
3
.clang-tidy
Normal file
3
.clang-tidy
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
Checks: '-*,boost-use-to-string,cert-dcl21-cpp,cert-dcl58-cpp,cert-env33-c,cert-err52-cpp,cert-err60-cpp,cert-flp30-c,clang-analyzer-cplusplus*,cppcoreguidelines-pro-type-static-cast-downcast,cppcoreguidelines-slicing,google-build-namespaces,google-runtime-int,google-runtime-references,llvm-header-guard,misc-misplaced-const,misc-new-delete-overloads,misc-non-copyable-objects,misc-static-assert,misc-throw-by-value-catch-by-reference,misc-uniqueptr-reset-release,modernize-deprecated-headers,modernize-loop-convert,modernize-pass-by-value,modernize-raw-string-literal,modernize-use-auto,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-move-const-arg,readability-named-parameter,readability-string-compare'
|
||||||
|
HeaderFilterRegex: '.*'
|
@ -1131,7 +1131,13 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
|
|||||||
endif()
|
endif()
|
||||||
message(FATAL_ERROR "libtool is required to build matio from source")
|
message(FATAL_ERROR "libtool is required to build matio from source")
|
||||||
endif()
|
endif()
|
||||||
if(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10")
|
if(EXISTS "/usr/bin/aclocal" OR
|
||||||
|
EXISTS "/usr/bin/aclocal-1.16" OR
|
||||||
|
EXISTS "/usr/bin/aclocal-1.15" OR
|
||||||
|
EXISTS "/usr/bin/aclocal-1.14" OR
|
||||||
|
EXISTS "/usr/bin/aclocal-1.13" OR
|
||||||
|
EXISTS "/usr/bin/aclocal-1.11" OR
|
||||||
|
EXISTS "/usr/bin/aclocal-1.10")
|
||||||
message(STATUS "Automake found.")
|
message(STATUS "Automake found.")
|
||||||
else()
|
else()
|
||||||
message(" aclocal has not been found.")
|
message(" aclocal has not been found.")
|
||||||
@ -1612,6 +1618,26 @@ if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# clang-tidy https://clang.llvm.org/extra/clang-tidy/index.html
|
||||||
|
########################################################################
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
if(NOT (CMAKE_VERSION VERSION_LESS "3.6"))
|
||||||
|
find_program(
|
||||||
|
CLANG_TIDY_EXE
|
||||||
|
NAMES "clang-tidy"
|
||||||
|
DOC "Path to clang-tidy executable"
|
||||||
|
)
|
||||||
|
if(NOT CLANG_TIDY_EXE)
|
||||||
|
message(STATUS "clang-tidy not found.")
|
||||||
|
else()
|
||||||
|
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
|
||||||
|
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*")
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Create uninstall target
|
# Create uninstall target
|
||||||
|
@ -71,6 +71,7 @@ Next release will have several improvements in different dimensions, addition of
|
|||||||
- Improvement in C++ usage: The override special identifier is now used when overriding a virtual function. This helps the compiler to check for type changes in the base class, making the detection of errors easier.
|
- Improvement in C++ usage: The override special identifier is now used when overriding a virtual function. This helps the compiler to check for type changes in the base class, making the detection of errors easier.
|
||||||
- Improvement in C++ usage: A number of unused includes have been removed. Order of includes set to: local (in-source) headers, then library headers, then system headers. This helps to detect missing includes.
|
- Improvement in C++ usage: A number of unused includes have been removed. Order of includes set to: local (in-source) headers, then library headers, then system headers. This helps to detect missing includes.
|
||||||
- Improvement in C++ usage: Enhanced const correctness. Misuses of those variables are detected by the compiler.
|
- Improvement in C++ usage: Enhanced const correctness. Misuses of those variables are detected by the compiler.
|
||||||
|
- Improved code with clang-tidy and generation of a compile_commands.json file containing the exact compiler calls for all translation units of the project in machine-readable form if clang-tidy is detected.
|
||||||
- Applied some style rules to CMake scripts.
|
- Applied some style rules to CMake scripts.
|
||||||
- Minimal versions of dependencies identified and detected.
|
- Minimal versions of dependencies identified and detected.
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
rtklib_pvt_cc_sptr pvt_;
|
rtklib_pvt_cc_sptr pvt_;
|
||||||
rtk_t rtk;
|
rtk_t rtk{};
|
||||||
std::string role_;
|
std::string role_;
|
||||||
unsigned int in_streams_;
|
unsigned int in_streams_;
|
||||||
unsigned int out_streams_;
|
unsigned int out_streams_;
|
||||||
|
@ -514,7 +514,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(uint32_t nchannels,
|
|||||||
if ((sysv_msqid = msgget(sysv_msg_key, msgflg)) == -1)
|
if ((sysv_msqid = msgget(sysv_msg_key, msgflg)) == -1)
|
||||||
{
|
{
|
||||||
std::cout << "GNSS-SDR can not create message queues!" << std::endl;
|
std::cout << "GNSS-SDR can not create message queues!" << std::endl;
|
||||||
throw new std::exception();
|
throw std::exception();
|
||||||
}
|
}
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <boost/filesystem/path.hpp> // for path, operator<<
|
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||||
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <fcntl.h> // for O_RDWR
|
#include <fcntl.h> // for O_RDWR
|
||||||
@ -187,7 +188,7 @@ Rtcm_Printer::~Rtcm_Printer()
|
|||||||
}
|
}
|
||||||
if (rtcm_file_descriptor.is_open())
|
if (rtcm_file_descriptor.is_open())
|
||||||
{
|
{
|
||||||
long pos;
|
int64_t pos;
|
||||||
pos = rtcm_file_descriptor.tellp();
|
pos = rtcm_file_descriptor.tellp();
|
||||||
rtcm_file_descriptor.close();
|
rtcm_file_descriptor.close();
|
||||||
if (pos == 0)
|
if (pos == 0)
|
||||||
@ -345,13 +346,13 @@ int Rtcm_Printer::init_serial(const std::string& serial_device)
|
|||||||
*/
|
*/
|
||||||
int32_t fd = 0;
|
int32_t fd = 0;
|
||||||
struct termios options;
|
struct termios options;
|
||||||
long BAUD;
|
int64_t BAUD;
|
||||||
long DATABITS;
|
int64_t DATABITS;
|
||||||
long STOPBITS;
|
int64_t STOPBITS;
|
||||||
long PARITYON;
|
int64_t PARITYON;
|
||||||
long PARITY;
|
int64_t PARITY;
|
||||||
|
|
||||||
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY);
|
fd = open(serial_device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY | O_CLOEXEC);
|
||||||
if (fd == -1) return fd; // failed to open TTY port
|
if (fd == -1) return fd; // failed to open TTY port
|
||||||
|
|
||||||
if (fcntl(fd, F_SETFL, 0) == -1) LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O
|
if (fcntl(fd, F_SETFL, 0) == -1) LOG(INFO) << "Error enabling direct I/O"; // clear all flags on descriptor, enable direct I/O
|
||||||
|
@ -59,7 +59,6 @@
|
|||||||
#include "GLONASS_L1_L2_CA.h"
|
#include "GLONASS_L1_L2_CA.h"
|
||||||
#include <matio.h>
|
#include <matio.h>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,16 +338,14 @@ gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_left_block()
|
|||||||
{
|
{
|
||||||
return acquisition_;
|
return acquisition_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_right_block()
|
gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisition::get_right_block()
|
||||||
|
@ -323,16 +323,14 @@ gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_left_block()
|
|||||||
{
|
{
|
||||||
return acquisition_;
|
return acquisition_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_right_block()
|
gr::basic_block_sptr GlonassL1CaPcpsAcquisition::get_right_block()
|
||||||
|
@ -322,16 +322,14 @@ gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_left_block()
|
|||||||
{
|
{
|
||||||
return acquisition_;
|
return acquisition_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_right_block()
|
gr::basic_block_sptr GlonassL2CaPcpsAcquisition::get_right_block()
|
||||||
|
@ -311,16 +311,14 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_left_block()
|
|||||||
{
|
{
|
||||||
return acquisition_;
|
return acquisition_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block()
|
gr::basic_block_sptr GpsL1CaPcpsAcquisition::get_right_block()
|
||||||
|
@ -325,16 +325,14 @@ gr::basic_block_sptr GpsL2MPcpsAcquisition::get_left_block()
|
|||||||
{
|
{
|
||||||
return acquisition_;
|
return acquisition_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GpsL2MPcpsAcquisition::get_right_block()
|
gr::basic_block_sptr GpsL2MPcpsAcquisition::get_right_block()
|
||||||
|
@ -313,16 +313,14 @@ gr::basic_block_sptr GpsL5iPcpsAcquisition::get_left_block()
|
|||||||
{
|
{
|
||||||
return acquisition_;
|
return acquisition_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
LOG(WARNING) << item_type_ << " unknown acquisition item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GpsL5iPcpsAcquisition::get_right_block()
|
gr::basic_block_sptr GpsL5iPcpsAcquisition::get_right_block()
|
||||||
|
@ -41,9 +41,12 @@
|
|||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc(
|
galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc(
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t max_dwells,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
bool dump, std::string dump_filename)
|
bool dump, std::string dump_filename)
|
||||||
{
|
{
|
||||||
return galileo_pcps_8ms_acquisition_cc_sptr(
|
return galileo_pcps_8ms_acquisition_cc_sptr(
|
||||||
@ -52,9 +55,12 @@ galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
|
galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t max_dwells,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename) : gr::block("galileo_pcps_8ms_acquisition_cc",
|
std::string dump_filename) : gr::block("galileo_pcps_8ms_acquisition_cc",
|
||||||
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
|
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
|
||||||
@ -101,11 +107,12 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
|
|||||||
d_channel = 0;
|
d_channel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc()
|
galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc()
|
||||||
{
|
{
|
||||||
if (d_num_doppler_bins > 0)
|
if (d_num_doppler_bins > 0)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < d_num_doppler_bins; i++)
|
for (uint32_t i = 0; i < d_num_doppler_bins; i++)
|
||||||
{
|
{
|
||||||
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
||||||
}
|
}
|
||||||
@ -125,6 +132,7 @@ galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_pcps_8ms_acquisition_cc::set_local_code(std::complex<float> *code)
|
void galileo_pcps_8ms_acquisition_cc::set_local_code(std::complex<float> *code)
|
||||||
{
|
{
|
||||||
// code A: two replicas of a primary code
|
// code A: two replicas of a primary code
|
||||||
@ -146,6 +154,7 @@ void galileo_pcps_8ms_acquisition_cc::set_local_code(std::complex<float> *code)
|
|||||||
volk_32fc_conjugate_32fc(d_fft_code_B, d_fft_if->get_outbuf(), d_fft_size);
|
volk_32fc_conjugate_32fc(d_fft_code_B, d_fft_if->get_outbuf(), d_fft_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_pcps_8ms_acquisition_cc::init()
|
void galileo_pcps_8ms_acquisition_cc::init()
|
||||||
{
|
{
|
||||||
d_gnss_synchro->Flag_valid_acquisition = false;
|
d_gnss_synchro->Flag_valid_acquisition = false;
|
||||||
@ -161,8 +170,8 @@ void galileo_pcps_8ms_acquisition_cc::init()
|
|||||||
const double GALILEO_TWO_PI = 6.283185307179600;
|
const double GALILEO_TWO_PI = 6.283185307179600;
|
||||||
// Count the number of bins
|
// Count the number of bins
|
||||||
d_num_doppler_bins = 0;
|
d_num_doppler_bins = 0;
|
||||||
for (int doppler = static_cast<int>(-d_doppler_max);
|
for (auto doppler = static_cast<int32_t>(-d_doppler_max);
|
||||||
doppler <= static_cast<int>(d_doppler_max);
|
doppler <= static_cast<int32_t>(d_doppler_max);
|
||||||
doppler += d_doppler_step)
|
doppler += d_doppler_step)
|
||||||
{
|
{
|
||||||
d_num_doppler_bins++;
|
d_num_doppler_bins++;
|
||||||
@ -170,10 +179,10 @@ void galileo_pcps_8ms_acquisition_cc::init()
|
|||||||
|
|
||||||
// Create the carrier Doppler wipeoff signals
|
// Create the carrier Doppler wipeoff signals
|
||||||
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_bins];
|
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_bins];
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
int32_t doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
float phase_step_rad = static_cast<float>(GALILEO_TWO_PI) * doppler / static_cast<float>(d_fs_in);
|
float phase_step_rad = static_cast<float>(GALILEO_TWO_PI) * doppler / static_cast<float>(d_fs_in);
|
||||||
float _phase[1];
|
float _phase[1];
|
||||||
_phase[0] = 0;
|
_phase[0] = 0;
|
||||||
@ -182,7 +191,7 @@ void galileo_pcps_8ms_acquisition_cc::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_pcps_8ms_acquisition_cc::set_state(int state)
|
void galileo_pcps_8ms_acquisition_cc::set_state(int32_t state)
|
||||||
{
|
{
|
||||||
d_state = state;
|
d_state = state;
|
||||||
if (d_state == 1)
|
if (d_state == 1)
|
||||||
@ -210,7 +219,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
|
|||||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items __attribute__((unused)))
|
gr_vector_void_star &output_items __attribute__((unused)))
|
||||||
{
|
{
|
||||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
int32_t acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
|
|
||||||
switch (d_state)
|
switch (d_state)
|
||||||
{
|
{
|
||||||
@ -240,7 +249,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// initialize acquisition algorithm
|
// initialize acquisition algorithm
|
||||||
int doppler;
|
int32_t doppler;
|
||||||
uint32_t indext = 0;
|
uint32_t indext = 0;
|
||||||
uint32_t indext_A = 0;
|
uint32_t indext_A = 0;
|
||||||
uint32_t indext_B = 0;
|
uint32_t indext_B = 0;
|
||||||
@ -268,10 +277,10 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
|
|||||||
d_input_power /= static_cast<float>(d_fft_size);
|
d_input_power /= static_cast<float>(d_fft_size);
|
||||||
|
|
||||||
// 2- Doppler frequency search loop
|
// 2- Doppler frequency search loop
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
// doppler search steps
|
// doppler search steps
|
||||||
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
|
|
||||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
|
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
|
||||||
d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
||||||
|
@ -44,10 +44,14 @@ class galileo_pcps_8ms_acquisition_cc;
|
|||||||
typedef boost::shared_ptr<galileo_pcps_8ms_acquisition_cc> galileo_pcps_8ms_acquisition_cc_sptr;
|
typedef boost::shared_ptr<galileo_pcps_8ms_acquisition_cc> galileo_pcps_8ms_acquisition_cc_sptr;
|
||||||
|
|
||||||
galileo_pcps_8ms_acquisition_cc_sptr
|
galileo_pcps_8ms_acquisition_cc_sptr
|
||||||
galileo_pcps_8ms_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells,
|
galileo_pcps_8ms_make_acquisition_cc(uint32_t sampled_ms,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t max_dwells,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t doppler_max,
|
||||||
bool dump, std::string dump_filename);
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
|
bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a Parallel Code Phase Search Acquisition for
|
* \brief This class implements a Parallel Code Phase Search Acquisition for
|
||||||
@ -57,41 +61,52 @@ class galileo_pcps_8ms_acquisition_cc : public gr::block
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend galileo_pcps_8ms_acquisition_cc_sptr
|
friend galileo_pcps_8ms_acquisition_cc_sptr
|
||||||
galileo_pcps_8ms_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells,
|
galileo_pcps_8ms_make_acquisition_cc(
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t sampled_ms,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t max_dwells,
|
||||||
bool dump, std::string dump_filename);
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
|
bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
|
galileo_pcps_8ms_acquisition_cc(
|
||||||
|
uint32_t sampled_ms,
|
||||||
|
uint32_t max_dwells,
|
||||||
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
|
bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
galileo_pcps_8ms_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells,
|
void calculate_magnitudes(
|
||||||
unsigned int doppler_max, long fs_in,
|
gr_complex* fft_begin,
|
||||||
int samples_per_ms, int samples_per_code,
|
int32_t doppler_shift,
|
||||||
bool dump, std::string dump_filename);
|
int32_t doppler_offset);
|
||||||
|
|
||||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
int64_t d_fs_in;
|
||||||
int doppler_offset);
|
int32_t d_samples_per_ms;
|
||||||
|
int32_t d_samples_per_code;
|
||||||
long d_fs_in;
|
uint32_t d_doppler_resolution;
|
||||||
int d_samples_per_ms;
|
|
||||||
int d_samples_per_code;
|
|
||||||
unsigned int d_doppler_resolution;
|
|
||||||
float d_threshold;
|
float d_threshold;
|
||||||
std::string d_satellite_str;
|
std::string d_satellite_str;
|
||||||
unsigned int d_doppler_max;
|
uint32_t d_doppler_max;
|
||||||
unsigned int d_doppler_step;
|
uint32_t d_doppler_step;
|
||||||
unsigned int d_sampled_ms;
|
uint32_t d_sampled_ms;
|
||||||
unsigned int d_max_dwells;
|
uint32_t d_max_dwells;
|
||||||
unsigned int d_well_count;
|
uint32_t d_well_count;
|
||||||
unsigned int d_fft_size;
|
uint32_t d_fft_size;
|
||||||
uint64_t d_sample_counter;
|
uint64_t d_sample_counter;
|
||||||
gr_complex** d_grid_doppler_wipeoffs;
|
gr_complex** d_grid_doppler_wipeoffs;
|
||||||
unsigned int d_num_doppler_bins;
|
uint32_t d_num_doppler_bins;
|
||||||
gr_complex* d_fft_code_A;
|
gr_complex* d_fft_code_A;
|
||||||
gr_complex* d_fft_code_B;
|
gr_complex* d_fft_code_B;
|
||||||
gr::fft::fft_complex* d_fft_if;
|
gr::fft::fft_complex* d_fft_if;
|
||||||
gr::fft::fft_complex* d_ifft;
|
gr::fft::fft_complex* d_ifft;
|
||||||
Gnss_Synchro* d_gnss_synchro;
|
Gnss_Synchro* d_gnss_synchro;
|
||||||
unsigned int d_code_phase;
|
uint32_t d_code_phase;
|
||||||
float d_doppler_freq;
|
float d_doppler_freq;
|
||||||
float d_mag;
|
float d_mag;
|
||||||
float* d_magnitude;
|
float* d_magnitude;
|
||||||
@ -99,9 +114,9 @@ private:
|
|||||||
float d_test_statistics;
|
float d_test_statistics;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
bool d_active;
|
bool d_active;
|
||||||
int d_state;
|
int32_t d_state;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
unsigned int d_channel;
|
uint32_t d_channel;
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -123,7 +138,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Returns the maximum peak of grid search.
|
* \brief Returns the maximum peak of grid search.
|
||||||
*/
|
*/
|
||||||
inline unsigned int mag() const
|
inline uint32_t mag() const
|
||||||
{
|
{
|
||||||
return d_mag;
|
return d_mag;
|
||||||
}
|
}
|
||||||
@ -154,13 +169,13 @@ public:
|
|||||||
* first available sample.
|
* first available sample.
|
||||||
* \param state - int=1 forces start of acquisition
|
* \param state - int=1 forces start of acquisition
|
||||||
*/
|
*/
|
||||||
void set_state(int state);
|
void set_state(int32_t state);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set acquisition channel unique ID
|
* \brief Set acquisition channel unique ID
|
||||||
* \param channel - receiver channel.
|
* \param channel - receiver channel.
|
||||||
*/
|
*/
|
||||||
inline void set_channel(unsigned int channel)
|
inline void set_channel(uint32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
}
|
}
|
||||||
@ -179,7 +194,7 @@ public:
|
|||||||
* \brief Set maximum Doppler grid search
|
* \brief Set maximum Doppler grid search
|
||||||
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_max(unsigned int doppler_max)
|
inline void set_doppler_max(uint32_t doppler_max)
|
||||||
{
|
{
|
||||||
d_doppler_max = doppler_max;
|
d_doppler_max = doppler_max;
|
||||||
}
|
}
|
||||||
@ -188,7 +203,7 @@ public:
|
|||||||
* \brief Set Doppler steps for the grid search
|
* \brief Set Doppler steps for the grid search
|
||||||
* \param doppler_step - Frequency bin of the search grid [Hz].
|
* \param doppler_step - Frequency bin of the search grid [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_step(unsigned int doppler_step)
|
inline void set_doppler_step(uint32_t doppler_step)
|
||||||
{
|
{
|
||||||
d_doppler_step = doppler_step;
|
d_doppler_step = doppler_step;
|
||||||
}
|
}
|
||||||
|
@ -274,11 +274,8 @@ bool pcps_acquisition::is_fdma()
|
|||||||
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
|
LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq)
|
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq)
|
||||||
|
@ -47,8 +47,8 @@ extern concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
|||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(
|
pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(
|
||||||
int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min,
|
int32_t max_dwells, uint32_t sampled_ms, int32_t doppler_max, int32_t doppler_min,
|
||||||
long fs_in, int samples_per_ms, bool dump,
|
int64_t fs_in, int32_t samples_per_ms, bool dump,
|
||||||
std::string dump_filename)
|
std::string dump_filename)
|
||||||
{
|
{
|
||||||
return pcps_assisted_acquisition_cc_sptr(
|
return pcps_assisted_acquisition_cc_sptr(
|
||||||
@ -58,8 +58,8 @@ pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(
|
|||||||
|
|
||||||
|
|
||||||
pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
|
pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
|
||||||
int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min,
|
int32_t max_dwells, uint32_t sampled_ms, int32_t doppler_max, int32_t doppler_min,
|
||||||
long fs_in, int samples_per_ms, bool dump,
|
int64_t fs_in, int32_t samples_per_ms, bool dump,
|
||||||
std::string dump_filename) : gr::block("pcps_assisted_acquisition_cc",
|
std::string dump_filename) : gr::block("pcps_assisted_acquisition_cc",
|
||||||
gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||||
gr::io_signature::make(0, 0, sizeof(gr_complex)))
|
gr::io_signature::make(0, 0, sizeof(gr_complex)))
|
||||||
@ -109,7 +109,7 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pcps_assisted_acquisition_cc::set_doppler_step(unsigned int doppler_step)
|
void pcps_assisted_acquisition_cc::set_doppler_step(uint32_t doppler_step)
|
||||||
{
|
{
|
||||||
d_doppler_step = doppler_step;
|
d_doppler_step = doppler_step;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ void pcps_assisted_acquisition_cc::set_doppler_step(unsigned int doppler_step)
|
|||||||
|
|
||||||
void pcps_assisted_acquisition_cc::free_grid_memory()
|
void pcps_assisted_acquisition_cc::free_grid_memory()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < d_num_doppler_points; i++)
|
for (int32_t i = 0; i < d_num_doppler_points; i++)
|
||||||
{
|
{
|
||||||
delete[] d_grid_data[i];
|
delete[] d_grid_data[i];
|
||||||
delete[] d_grid_doppler_wipeoffs[i];
|
delete[] d_grid_doppler_wipeoffs[i];
|
||||||
@ -206,9 +206,9 @@ void pcps_assisted_acquisition_cc::get_assistance()
|
|||||||
void pcps_assisted_acquisition_cc::reset_grid()
|
void pcps_assisted_acquisition_cc::reset_grid()
|
||||||
{
|
{
|
||||||
d_well_count = 0;
|
d_well_count = 0;
|
||||||
for (int i = 0; i < d_num_doppler_points; i++)
|
for (int32_t i = 0; i < d_num_doppler_points; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < d_fft_size; j++)
|
for (uint32_t j = 0; j < d_fft_size; j++)
|
||||||
{
|
{
|
||||||
d_grid_data[i][j] = 0.0;
|
d_grid_data[i][j] = 0.0;
|
||||||
}
|
}
|
||||||
@ -227,16 +227,16 @@ void pcps_assisted_acquisition_cc::redefine_grid()
|
|||||||
d_num_doppler_points = floor(std::abs(d_doppler_max - d_doppler_min) / d_doppler_step);
|
d_num_doppler_points = floor(std::abs(d_doppler_max - d_doppler_min) / d_doppler_step);
|
||||||
|
|
||||||
d_grid_data = new float *[d_num_doppler_points];
|
d_grid_data = new float *[d_num_doppler_points];
|
||||||
for (int i = 0; i < d_num_doppler_points; i++)
|
for (int32_t i = 0; i < d_num_doppler_points; i++)
|
||||||
{
|
{
|
||||||
d_grid_data[i] = new float[d_fft_size];
|
d_grid_data[i] = new float[d_fft_size];
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the carrier Doppler wipeoff signals
|
// create the carrier Doppler wipeoff signals
|
||||||
int doppler_hz;
|
int32_t doppler_hz;
|
||||||
float phase_step_rad;
|
float phase_step_rad;
|
||||||
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_points];
|
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_points];
|
||||||
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
|
for (int32_t doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
|
||||||
{
|
{
|
||||||
doppler_hz = d_doppler_min + d_doppler_step * doppler_index;
|
doppler_hz = d_doppler_min + d_doppler_step * doppler_index;
|
||||||
// doppler search steps
|
// doppler search steps
|
||||||
@ -254,11 +254,11 @@ double pcps_assisted_acquisition_cc::search_maximum()
|
|||||||
{
|
{
|
||||||
float magt = 0.0;
|
float magt = 0.0;
|
||||||
float fft_normalization_factor;
|
float fft_normalization_factor;
|
||||||
int index_doppler = 0;
|
int32_t index_doppler = 0;
|
||||||
uint32_t tmp_intex_t = 0;
|
uint32_t tmp_intex_t = 0;
|
||||||
uint32_t index_time = 0;
|
uint32_t index_time = 0;
|
||||||
|
|
||||||
for (int i = 0; i < d_num_doppler_points; i++)
|
for (int32_t i = 0; i < d_num_doppler_points; i++)
|
||||||
{
|
{
|
||||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size);
|
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size);
|
||||||
if (d_grid_data[i][tmp_intex_t] > magt)
|
if (d_grid_data[i][tmp_intex_t] > magt)
|
||||||
@ -316,7 +316,7 @@ float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_st
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
|
int32_t pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
|
||||||
{
|
{
|
||||||
// initialize acquisition algorithm
|
// initialize acquisition algorithm
|
||||||
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
|
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
|
||||||
@ -331,7 +331,7 @@ int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_vo
|
|||||||
// 2- Doppler frequency search loop
|
// 2- Doppler frequency search loop
|
||||||
auto *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
auto *p_tmp_vector = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
|
|
||||||
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
|
for (int32_t doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
|
||||||
{
|
{
|
||||||
// doppler search steps
|
// doppler search steps
|
||||||
// Perform the carrier wipe-off
|
// Perform the carrier wipe-off
|
||||||
@ -394,7 +394,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
|
|||||||
d_state = 2;
|
d_state = 2;
|
||||||
break;
|
break;
|
||||||
case 2: // S2. ComputeGrid
|
case 2: // S2. ComputeGrid
|
||||||
int consumed_samples;
|
int32_t consumed_samples;
|
||||||
consumed_samples = compute_and_accumulate_grid(input_items);
|
consumed_samples = compute_and_accumulate_grid(input_items);
|
||||||
d_well_count++;
|
d_well_count++;
|
||||||
if (d_well_count >= d_max_dwells)
|
if (d_well_count >= d_max_dwells)
|
||||||
|
@ -61,8 +61,13 @@ typedef boost::shared_ptr<pcps_assisted_acquisition_cc>
|
|||||||
pcps_assisted_acquisition_cc_sptr;
|
pcps_assisted_acquisition_cc_sptr;
|
||||||
|
|
||||||
pcps_assisted_acquisition_cc_sptr
|
pcps_assisted_acquisition_cc_sptr
|
||||||
pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms,
|
pcps_make_assisted_acquisition_cc(
|
||||||
int doppler_max, int doppler_min, long fs_in, int samples_per_ms,
|
int32_t max_dwells,
|
||||||
|
uint32_t sampled_ms,
|
||||||
|
int32_t doppler_max,
|
||||||
|
int32_t doppler_min,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
bool dump, std::string dump_filename);
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -75,20 +80,20 @@ class pcps_assisted_acquisition_cc : public gr::block
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend pcps_assisted_acquisition_cc_sptr
|
friend pcps_assisted_acquisition_cc_sptr
|
||||||
pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms,
|
pcps_make_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
|
||||||
int doppler_max, int doppler_min, long fs_in,
|
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
|
||||||
int samples_per_ms, bool dump,
|
int32_t samples_per_ms, bool dump,
|
||||||
std::string dump_filename);
|
std::string dump_filename);
|
||||||
|
|
||||||
pcps_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms,
|
pcps_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
|
||||||
int doppler_max, int doppler_min, long fs_in,
|
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
|
||||||
int samples_per_ms, bool dump,
|
int32_t samples_per_ms, bool dump,
|
||||||
std::string dump_filename);
|
std::string dump_filename);
|
||||||
|
|
||||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||||
int doppler_offset);
|
int32_t doppler_offset);
|
||||||
|
|
||||||
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
|
int32_t compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
|
||||||
float estimate_input_power(gr_vector_const_void_star& input_items);
|
float estimate_input_power(gr_vector_const_void_star& input_items);
|
||||||
double search_maximum();
|
double search_maximum();
|
||||||
void get_assistance();
|
void get_assistance();
|
||||||
@ -96,22 +101,22 @@ private:
|
|||||||
void redefine_grid();
|
void redefine_grid();
|
||||||
void free_grid_memory();
|
void free_grid_memory();
|
||||||
|
|
||||||
long d_fs_in;
|
int64_t d_fs_in;
|
||||||
int d_samples_per_ms;
|
int32_t d_samples_per_ms;
|
||||||
int d_max_dwells;
|
int32_t d_max_dwells;
|
||||||
unsigned int d_doppler_resolution;
|
uint32_t d_doppler_resolution;
|
||||||
int d_gnuradio_forecast_samples;
|
int32_t d_gnuradio_forecast_samples;
|
||||||
float d_threshold;
|
float d_threshold;
|
||||||
std::string d_satellite_str;
|
std::string d_satellite_str;
|
||||||
int d_doppler_max;
|
int32_t d_doppler_max;
|
||||||
int d_doppler_min;
|
int32_t d_doppler_min;
|
||||||
int d_config_doppler_max;
|
int32_t d_config_doppler_max;
|
||||||
int d_config_doppler_min;
|
int32_t d_config_doppler_min;
|
||||||
|
|
||||||
int d_num_doppler_points;
|
int32_t d_num_doppler_points;
|
||||||
int d_doppler_step;
|
int32_t d_doppler_step;
|
||||||
unsigned int d_sampled_ms;
|
uint32_t d_sampled_ms;
|
||||||
unsigned int d_fft_size;
|
uint32_t d_fft_size;
|
||||||
uint64_t d_sample_counter;
|
uint64_t d_sample_counter;
|
||||||
gr_complex* d_carrier;
|
gr_complex* d_carrier;
|
||||||
gr_complex* d_fft_codes;
|
gr_complex* d_fft_codes;
|
||||||
@ -122,17 +127,17 @@ private:
|
|||||||
gr::fft::fft_complex* d_fft_if;
|
gr::fft::fft_complex* d_fft_if;
|
||||||
gr::fft::fft_complex* d_ifft;
|
gr::fft::fft_complex* d_ifft;
|
||||||
Gnss_Synchro* d_gnss_synchro;
|
Gnss_Synchro* d_gnss_synchro;
|
||||||
unsigned int d_code_phase;
|
uint32_t d_code_phase;
|
||||||
float d_doppler_freq;
|
float d_doppler_freq;
|
||||||
float d_input_power;
|
float d_input_power;
|
||||||
float d_test_statistics;
|
float d_test_statistics;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
int d_state;
|
int32_t d_state;
|
||||||
bool d_active;
|
bool d_active;
|
||||||
bool d_disable_assist;
|
bool d_disable_assist;
|
||||||
int d_well_count;
|
int32_t d_well_count;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
unsigned int d_channel;
|
uint32_t d_channel;
|
||||||
|
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
|
|
||||||
@ -155,7 +160,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Returns the maximum peak of grid search.
|
* \brief Returns the maximum peak of grid search.
|
||||||
*/
|
*/
|
||||||
inline unsigned int mag() const
|
inline uint32_t mag() const
|
||||||
{
|
{
|
||||||
return d_test_statistics;
|
return d_test_statistics;
|
||||||
}
|
}
|
||||||
@ -185,7 +190,7 @@ public:
|
|||||||
* \brief Set acquisition channel unique ID
|
* \brief Set acquisition channel unique ID
|
||||||
* \param channel - receiver channel.
|
* \param channel - receiver channel.
|
||||||
*/
|
*/
|
||||||
inline void set_channel(unsigned int channel)
|
inline void set_channel(uint32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
}
|
}
|
||||||
@ -204,7 +209,7 @@ public:
|
|||||||
* \brief Set maximum Doppler grid search
|
* \brief Set maximum Doppler grid search
|
||||||
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_max(unsigned int doppler_max)
|
inline void set_doppler_max(uint32_t doppler_max)
|
||||||
{
|
{
|
||||||
d_doppler_max = doppler_max;
|
d_doppler_max = doppler_max;
|
||||||
}
|
}
|
||||||
@ -213,7 +218,7 @@ public:
|
|||||||
* \brief Set Doppler steps for the grid search
|
* \brief Set Doppler steps for the grid search
|
||||||
* \param doppler_step - Frequency bin of the search grid [Hz].
|
* \param doppler_step - Frequency bin of the search grid [Hz].
|
||||||
*/
|
*/
|
||||||
void set_doppler_step(unsigned int doppler_step);
|
void set_doppler_step(uint32_t doppler_step);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Parallel Code Phase Search Acquisition signal processing.
|
* \brief Parallel Code Phase Search Acquisition signal processing.
|
||||||
|
@ -35,22 +35,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pcps_cccwsr_acquisition_cc.h"
|
#include "pcps_cccwsr_acquisition_cc.h"
|
||||||
#include <sstream>
|
#include "control_message_factory.h"
|
||||||
#include <utility>
|
#include "GPS_L1_CA.h" // GPS_TWO_PI
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
#include <volk/volk.h>
|
#include <volk/volk.h>
|
||||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||||
#include "control_message_factory.h"
|
#include <sstream>
|
||||||
#include "GPS_L1_CA.h" //GPS_TWO_PI
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(
|
pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t max_dwells,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
bool dump, std::string dump_filename)
|
bool dump, std::string dump_filename)
|
||||||
{
|
{
|
||||||
return pcps_cccwsr_acquisition_cc_sptr(
|
return pcps_cccwsr_acquisition_cc_sptr(
|
||||||
@ -58,10 +60,14 @@ pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(
|
|||||||
samples_per_ms, samples_per_code, dump, std::move(dump_filename)));
|
samples_per_ms, samples_per_code, dump, std::move(dump_filename)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
|
pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t max_dwells,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename) : gr::block("pcps_cccwsr_acquisition_cc",
|
std::string dump_filename) : gr::block("pcps_cccwsr_acquisition_cc",
|
||||||
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
|
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
|
||||||
@ -116,7 +122,7 @@ pcps_cccwsr_acquisition_cc::~pcps_cccwsr_acquisition_cc()
|
|||||||
{
|
{
|
||||||
if (d_num_doppler_bins > 0)
|
if (d_num_doppler_bins > 0)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < d_num_doppler_bins; i++)
|
for (uint32_t i = 0; i < d_num_doppler_bins; i++)
|
||||||
{
|
{
|
||||||
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
||||||
}
|
}
|
||||||
@ -175,8 +181,8 @@ void pcps_cccwsr_acquisition_cc::init()
|
|||||||
|
|
||||||
// Count the number of bins
|
// Count the number of bins
|
||||||
d_num_doppler_bins = 0;
|
d_num_doppler_bins = 0;
|
||||||
for (int doppler = static_cast<int>(-d_doppler_max);
|
for (auto doppler = static_cast<int32_t>(-d_doppler_max);
|
||||||
doppler <= static_cast<int>(d_doppler_max);
|
doppler <= static_cast<int32_t>(d_doppler_max);
|
||||||
doppler += d_doppler_step)
|
doppler += d_doppler_step)
|
||||||
{
|
{
|
||||||
d_num_doppler_bins++;
|
d_num_doppler_bins++;
|
||||||
@ -184,11 +190,11 @@ void pcps_cccwsr_acquisition_cc::init()
|
|||||||
|
|
||||||
// Create the carrier Doppler wipeoff signals
|
// Create the carrier Doppler wipeoff signals
|
||||||
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_bins];
|
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_bins];
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
|
|
||||||
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
int32_t doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
float phase_step_rad = GPS_TWO_PI * doppler / static_cast<float>(d_fs_in);
|
float phase_step_rad = GPS_TWO_PI * doppler / static_cast<float>(d_fs_in);
|
||||||
float _phase[1];
|
float _phase[1];
|
||||||
_phase[0] = 0;
|
_phase[0] = 0;
|
||||||
@ -197,7 +203,7 @@ void pcps_cccwsr_acquisition_cc::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pcps_cccwsr_acquisition_cc::set_state(int state)
|
void pcps_cccwsr_acquisition_cc::set_state(int32_t state)
|
||||||
{
|
{
|
||||||
d_state = state;
|
d_state = state;
|
||||||
if (d_state == 1)
|
if (d_state == 1)
|
||||||
@ -225,7 +231,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
|
|||||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items __attribute__((unused)))
|
gr_vector_void_star &output_items __attribute__((unused)))
|
||||||
{
|
{
|
||||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
int32_t acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
|
|
||||||
switch (d_state)
|
switch (d_state)
|
||||||
{
|
{
|
||||||
@ -254,7 +260,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// initialize acquisition algorithm
|
// initialize acquisition algorithm
|
||||||
int doppler;
|
int32_t doppler;
|
||||||
|
|
||||||
uint32_t indext = 0;
|
uint32_t indext = 0;
|
||||||
uint32_t indext_plus = 0;
|
uint32_t indext_plus = 0;
|
||||||
@ -281,11 +287,11 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
|
|||||||
d_input_power /= static_cast<float>(d_fft_size);
|
d_input_power /= static_cast<float>(d_fft_size);
|
||||||
|
|
||||||
// 2- Doppler frequency search loop
|
// 2- Doppler frequency search loop
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
// doppler search steps
|
// doppler search steps
|
||||||
|
|
||||||
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
|
|
||||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
|
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
|
||||||
d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
||||||
@ -320,7 +326,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
|
|||||||
// d_data_correlation.
|
// d_data_correlation.
|
||||||
memcpy(d_pilot_correlation, d_ifft->get_outbuf(), sizeof(gr_complex) * d_fft_size);
|
memcpy(d_pilot_correlation, d_ifft->get_outbuf(), sizeof(gr_complex) * d_fft_size);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
for (uint32_t i = 0; i < d_fft_size; i++)
|
||||||
{
|
{
|
||||||
d_correlation_plus[i] = std::complex<float>(
|
d_correlation_plus[i] = std::complex<float>(
|
||||||
d_data_correlation[i].real() - d_pilot_correlation[i].imag(),
|
d_data_correlation[i].real() - d_pilot_correlation[i].imag(),
|
||||||
|
@ -50,10 +50,15 @@ class pcps_cccwsr_acquisition_cc;
|
|||||||
typedef boost::shared_ptr<pcps_cccwsr_acquisition_cc> pcps_cccwsr_acquisition_cc_sptr;
|
typedef boost::shared_ptr<pcps_cccwsr_acquisition_cc> pcps_cccwsr_acquisition_cc_sptr;
|
||||||
|
|
||||||
pcps_cccwsr_acquisition_cc_sptr
|
pcps_cccwsr_acquisition_cc_sptr
|
||||||
pcps_cccwsr_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells,
|
pcps_cccwsr_make_acquisition_cc(
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t sampled_ms,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t max_dwells,
|
||||||
bool dump, std::string dump_filename);
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
|
bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a Parallel Code Phase Search Acquisition with
|
* \brief This class implements a Parallel Code Phase Search Acquisition with
|
||||||
@ -63,40 +68,40 @@ class pcps_cccwsr_acquisition_cc : public gr::block
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend pcps_cccwsr_acquisition_cc_sptr
|
friend pcps_cccwsr_acquisition_cc_sptr
|
||||||
pcps_cccwsr_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells,
|
pcps_cccwsr_make_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t doppler_max, int64_t fs_in,
|
||||||
int samples_per_ms, int samples_per_code,
|
int32_t samples_per_ms, int32_t samples_per_code,
|
||||||
bool dump, std::string dump_filename);
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
pcps_cccwsr_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells,
|
pcps_cccwsr_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t doppler_max, int64_t fs_in,
|
||||||
int samples_per_ms, int samples_per_code,
|
int32_t samples_per_ms, int32_t samples_per_code,
|
||||||
bool dump, std::string dump_filename);
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||||
int doppler_offset);
|
int32_t doppler_offset);
|
||||||
|
|
||||||
long d_fs_in;
|
int64_t d_fs_in;
|
||||||
int d_samples_per_ms;
|
int32_t d_samples_per_ms;
|
||||||
int d_samples_per_code;
|
int32_t d_samples_per_code;
|
||||||
unsigned int d_doppler_resolution;
|
uint32_t d_doppler_resolution;
|
||||||
float d_threshold;
|
float d_threshold;
|
||||||
std::string d_satellite_str;
|
std::string d_satellite_str;
|
||||||
unsigned int d_doppler_max;
|
uint32_t d_doppler_max;
|
||||||
unsigned int d_doppler_step;
|
uint32_t d_doppler_step;
|
||||||
unsigned int d_sampled_ms;
|
uint32_t d_sampled_ms;
|
||||||
unsigned int d_max_dwells;
|
uint32_t d_max_dwells;
|
||||||
unsigned int d_well_count;
|
uint32_t d_well_count;
|
||||||
unsigned int d_fft_size;
|
uint32_t d_fft_size;
|
||||||
uint64_t d_sample_counter;
|
uint64_t d_sample_counter;
|
||||||
gr_complex** d_grid_doppler_wipeoffs;
|
gr_complex** d_grid_doppler_wipeoffs;
|
||||||
unsigned int d_num_doppler_bins;
|
uint32_t d_num_doppler_bins;
|
||||||
gr_complex* d_fft_code_data;
|
gr_complex* d_fft_code_data;
|
||||||
gr_complex* d_fft_code_pilot;
|
gr_complex* d_fft_code_pilot;
|
||||||
gr::fft::fft_complex* d_fft_if;
|
gr::fft::fft_complex* d_fft_if;
|
||||||
gr::fft::fft_complex* d_ifft;
|
gr::fft::fft_complex* d_ifft;
|
||||||
Gnss_Synchro* d_gnss_synchro;
|
Gnss_Synchro* d_gnss_synchro;
|
||||||
unsigned int d_code_phase;
|
uint32_t d_code_phase;
|
||||||
float d_doppler_freq;
|
float d_doppler_freq;
|
||||||
float d_mag;
|
float d_mag;
|
||||||
float* d_magnitude;
|
float* d_magnitude;
|
||||||
@ -108,9 +113,9 @@ private:
|
|||||||
float d_test_statistics;
|
float d_test_statistics;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
bool d_active;
|
bool d_active;
|
||||||
int d_state;
|
int32_t d_state;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
unsigned int d_channel;
|
uint32_t d_channel;
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -132,7 +137,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Returns the maximum peak of grid search.
|
* \brief Returns the maximum peak of grid search.
|
||||||
*/
|
*/
|
||||||
inline unsigned int mag() const
|
inline uint32_t mag() const
|
||||||
{
|
{
|
||||||
return d_mag;
|
return d_mag;
|
||||||
}
|
}
|
||||||
@ -164,13 +169,13 @@ public:
|
|||||||
* first available sample.
|
* first available sample.
|
||||||
* \param state - int=1 forces start of acquisition
|
* \param state - int=1 forces start of acquisition
|
||||||
*/
|
*/
|
||||||
void set_state(int state);
|
void set_state(int32_t state);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set acquisition channel unique ID
|
* \brief Set acquisition channel unique ID
|
||||||
* \param channel - receiver channel.
|
* \param channel - receiver channel.
|
||||||
*/
|
*/
|
||||||
inline void set_channel(unsigned int channel)
|
inline void set_channel(uint32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
}
|
}
|
||||||
@ -189,7 +194,7 @@ public:
|
|||||||
* \brief Set maximum Doppler grid search
|
* \brief Set maximum Doppler grid search
|
||||||
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_max(unsigned int doppler_max)
|
inline void set_doppler_max(uint32_t doppler_max)
|
||||||
{
|
{
|
||||||
d_doppler_max = doppler_max;
|
d_doppler_max = doppler_max;
|
||||||
}
|
}
|
||||||
@ -198,7 +203,7 @@ public:
|
|||||||
* \brief Set Doppler steps for the grid search
|
* \brief Set Doppler steps for the grid search
|
||||||
* \param doppler_step - Frequency bin of the search grid [Hz].
|
* \param doppler_step - Frequency bin of the search grid [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_step(unsigned int doppler_step)
|
inline void set_doppler_step(uint32_t doppler_step)
|
||||||
{
|
{
|
||||||
d_doppler_step = doppler_step;
|
d_doppler_step = doppler_step;
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,13 @@
|
|||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(
|
pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(
|
||||||
unsigned int folding_factor,
|
uint32_t folding_factor,
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t max_dwells,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
bool bit_transition_flag,
|
bool bit_transition_flag,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename)
|
std::string dump_filename)
|
||||||
@ -63,10 +66,10 @@ pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(
|
|||||||
|
|
||||||
|
|
||||||
pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
|
pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
|
||||||
unsigned int folding_factor,
|
uint32_t folding_factor,
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms, uint32_t max_dwells,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t doppler_max, int64_t fs_in,
|
||||||
int samples_per_ms, int samples_per_code,
|
int32_t samples_per_ms, int32_t samples_per_code,
|
||||||
bool bit_transition_flag,
|
bool bit_transition_flag,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename) : gr::block("pcps_quicksync_acquisition_cc",
|
std::string dump_filename) : gr::block("pcps_quicksync_acquisition_cc",
|
||||||
@ -97,7 +100,7 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
|
|||||||
d_magnitude = static_cast<float*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(float), volk_gnsssdr_get_alignment()));
|
d_magnitude = static_cast<float*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
d_magnitude_folded = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
d_magnitude_folded = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
|
|
||||||
d_possible_delay = new unsigned int[d_folding_factor];
|
d_possible_delay = new uint32_t[d_folding_factor];
|
||||||
d_corr_output_f = new float[d_folding_factor];
|
d_corr_output_f = new float[d_folding_factor];
|
||||||
|
|
||||||
/*Create the d_code signal , which would store the values of the code in its
|
/*Create the d_code signal , which would store the values of the code in its
|
||||||
@ -138,7 +141,7 @@ pcps_quicksync_acquisition_cc::~pcps_quicksync_acquisition_cc()
|
|||||||
//DLOG(INFO) << "START DESTROYER";
|
//DLOG(INFO) << "START DESTROYER";
|
||||||
if (d_num_doppler_bins > 0)
|
if (d_num_doppler_bins > 0)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < d_num_doppler_bins; i++)
|
for (uint32_t i = 0; i < d_num_doppler_bins; i++)
|
||||||
{
|
{
|
||||||
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
||||||
}
|
}
|
||||||
@ -176,7 +179,7 @@ void pcps_quicksync_acquisition_cc::set_local_code(std::complex<float>* code)
|
|||||||
/*perform folding of the code by the factorial factor parameter. Notice that
|
/*perform folding of the code by the factorial factor parameter. Notice that
|
||||||
folding of the code in the time stage would result in a downsampled spectrum
|
folding of the code in the time stage would result in a downsampled spectrum
|
||||||
in the frequency domain after applying the fftw operation*/
|
in the frequency domain after applying the fftw operation*/
|
||||||
for (unsigned int i = 0; i < d_folding_factor; i++)
|
for (uint32_t i = 0; i < d_folding_factor; i++)
|
||||||
{
|
{
|
||||||
std::transform((code + i * d_fft_size), (code + ((i + 1) * d_fft_size)),
|
std::transform((code + i * d_fft_size), (code + ((i + 1) * d_fft_size)),
|
||||||
d_fft_if->get_inbuf(), d_fft_if->get_inbuf(),
|
d_fft_if->get_inbuf(), d_fft_if->get_inbuf(),
|
||||||
@ -209,8 +212,8 @@ void pcps_quicksync_acquisition_cc::init()
|
|||||||
|
|
||||||
// Count the number of bins
|
// Count the number of bins
|
||||||
d_num_doppler_bins = 0;
|
d_num_doppler_bins = 0;
|
||||||
for (int doppler = static_cast<int>(-d_doppler_max);
|
for (auto doppler = static_cast<int32_t>(-d_doppler_max);
|
||||||
doppler <= static_cast<int>(d_doppler_max);
|
doppler <= static_cast<int32_t>(d_doppler_max);
|
||||||
doppler += d_doppler_step)
|
doppler += d_doppler_step)
|
||||||
{
|
{
|
||||||
d_num_doppler_bins++;
|
d_num_doppler_bins++;
|
||||||
@ -218,10 +221,10 @@ void pcps_quicksync_acquisition_cc::init()
|
|||||||
|
|
||||||
// Create the carrier Doppler wipeoff signals
|
// Create the carrier Doppler wipeoff signals
|
||||||
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
|
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
int32_t doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
float phase_step_rad = GPS_TWO_PI * doppler / static_cast<float>(d_fs_in);
|
float phase_step_rad = GPS_TWO_PI * doppler / static_cast<float>(d_fs_in);
|
||||||
float _phase[1];
|
float _phase[1];
|
||||||
_phase[0] = 0;
|
_phase[0] = 0;
|
||||||
@ -231,7 +234,7 @@ void pcps_quicksync_acquisition_cc::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pcps_quicksync_acquisition_cc::set_state(int state)
|
void pcps_quicksync_acquisition_cc::set_state(int32_t state)
|
||||||
{
|
{
|
||||||
d_state = state;
|
d_state = state;
|
||||||
if (d_state == 1)
|
if (d_state == 1)
|
||||||
@ -270,7 +273,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
* 6. Declare positive or negative acquisition using a message queue
|
* 6. Declare positive or negative acquisition using a message queue
|
||||||
*/
|
*/
|
||||||
//DLOG(INFO) << "START GENERAL WORK";
|
//DLOG(INFO) << "START GENERAL WORK";
|
||||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
int32_t acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
//std::cout<<"general_work in quicksync gnuradio block"<<std::endl;
|
//std::cout<<"general_work in quicksync gnuradio block"<<std::endl;
|
||||||
switch (d_state)
|
switch (d_state)
|
||||||
{
|
{
|
||||||
@ -302,7 +305,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
{
|
{
|
||||||
/* initialize acquisition implementing the QuickSync algorithm*/
|
/* initialize acquisition implementing the QuickSync algorithm*/
|
||||||
//DLOG(INFO) << "START CASE 1";
|
//DLOG(INFO) << "START CASE 1";
|
||||||
int doppler;
|
int32_t doppler;
|
||||||
uint32_t indext = 0;
|
uint32_t indext = 0;
|
||||||
float magt = 0.0;
|
float magt = 0.0;
|
||||||
const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); //Get the input samples pointer
|
const auto* in = reinterpret_cast<const gr_complex*>(input_items[0]); //Get the input samples pointer
|
||||||
@ -349,7 +352,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_samples_per_code * d_folding_factor);
|
volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_samples_per_code * d_folding_factor);
|
||||||
d_input_power /= static_cast<float>(d_samples_per_code * d_folding_factor);
|
d_input_power /= static_cast<float>(d_samples_per_code * d_folding_factor);
|
||||||
|
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
/*Ensure that the signal is going to start with all samples
|
/*Ensure that the signal is going to start with all samples
|
||||||
at zero. This is done to avoid over acumulation when performing
|
at zero. This is done to avoid over acumulation when performing
|
||||||
@ -360,7 +363,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
/*Doppler search steps and then multiplication of the incoming
|
/*Doppler search steps and then multiplication of the incoming
|
||||||
signal with the doppler wipeoffs to eliminate frequency offset
|
signal with the doppler wipeoffs to eliminate frequency offset
|
||||||
*/
|
*/
|
||||||
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
|
|
||||||
/*Perform multiplication of the incoming signal with the
|
/*Perform multiplication of the incoming signal with the
|
||||||
complex exponential vector. This removes the frequency doppler
|
complex exponential vector. This removes the frequency doppler
|
||||||
@ -372,7 +375,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
/*Perform folding of the carrier wiped-off incoming signal. Since
|
/*Perform folding of the carrier wiped-off incoming signal. Since
|
||||||
superlinear method is being used the folding factor in the
|
superlinear method is being used the folding factor in the
|
||||||
incoming raw data signal is of d_folding_factor^2*/
|
incoming raw data signal is of d_folding_factor^2*/
|
||||||
for (int i = 0; i < static_cast<int>(d_folding_factor * d_folding_factor); i++)
|
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor * d_folding_factor); i++)
|
||||||
{
|
{
|
||||||
std::transform((in_temp + i * d_fft_size),
|
std::transform((in_temp + i * d_fft_size),
|
||||||
(in_temp + ((i + 1) * d_fft_size)),
|
(in_temp + ((i + 1) * d_fft_size)),
|
||||||
@ -423,17 +426,17 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
restarted between consecutive dwells in multidwell operation.*/
|
restarted between consecutive dwells in multidwell operation.*/
|
||||||
if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag)
|
if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag)
|
||||||
{
|
{
|
||||||
unsigned int detected_delay_samples_folded = 0;
|
uint32_t detected_delay_samples_folded = 0;
|
||||||
detected_delay_samples_folded = (indext % d_samples_per_code);
|
detected_delay_samples_folded = (indext % d_samples_per_code);
|
||||||
gr_complex complex_acumulator[100];
|
gr_complex complex_acumulator[100];
|
||||||
//gr_complex complex_acumulator[d_folding_factor];
|
//gr_complex complex_acumulator[d_folding_factor];
|
||||||
|
|
||||||
for (int i = 0; i < static_cast<int>(d_folding_factor); i++)
|
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++)
|
||||||
{
|
{
|
||||||
d_possible_delay[i] = detected_delay_samples_folded + (i)*d_fft_size;
|
d_possible_delay[i] = detected_delay_samples_folded + (i)*d_fft_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < static_cast<int>(d_folding_factor); i++)
|
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++)
|
||||||
{
|
{
|
||||||
/*Copy a signal of 1 code length into suggested buffer.
|
/*Copy a signal of 1 code length into suggested buffer.
|
||||||
The copied signal must have doppler effect corrected*/
|
The copied signal must have doppler effect corrected*/
|
||||||
@ -447,7 +450,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
of a shift*/
|
of a shift*/
|
||||||
volk_32fc_x2_multiply_32fc(corr_output, in_1code, d_code, d_samples_per_code);
|
volk_32fc_x2_multiply_32fc(corr_output, in_1code, d_code, d_samples_per_code);
|
||||||
|
|
||||||
for (int j = 0; j < d_samples_per_code; j++)
|
for (int32_t j = 0; j < d_samples_per_code; j++)
|
||||||
{
|
{
|
||||||
complex_acumulator[i] += (corr_output[j]);
|
complex_acumulator[i] += (corr_output[j]);
|
||||||
}
|
}
|
||||||
@ -532,7 +535,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
DLOG(INFO) << "test statistics threshold " << d_threshold;
|
DLOG(INFO) << "test statistics threshold " << d_threshold;
|
||||||
DLOG(INFO) << "folding factor " << d_folding_factor;
|
DLOG(INFO) << "folding factor " << d_folding_factor;
|
||||||
DLOG(INFO) << "possible delay correlation output";
|
DLOG(INFO) << "possible delay correlation output";
|
||||||
for (int i = 0; i < static_cast<int>(d_folding_factor); i++) DLOG(INFO) << d_possible_delay[i] << "\t\t\t" << d_corr_output_f[i];
|
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++) DLOG(INFO) << d_possible_delay[i] << "\t\t\t" << d_corr_output_f[i];
|
||||||
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
|
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
|
||||||
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
|
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
|
||||||
DLOG(INFO) << "magnitude folded " << d_mag;
|
DLOG(INFO) << "magnitude folded " << d_mag;
|
||||||
@ -561,7 +564,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
|
|||||||
DLOG(INFO) << "test statistics threshold " << d_threshold;
|
DLOG(INFO) << "test statistics threshold " << d_threshold;
|
||||||
DLOG(INFO) << "folding factor " << d_folding_factor;
|
DLOG(INFO) << "folding factor " << d_folding_factor;
|
||||||
DLOG(INFO) << "possible delay corr output";
|
DLOG(INFO) << "possible delay corr output";
|
||||||
for (int i = 0; i < static_cast<int>(d_folding_factor); i++) DLOG(INFO) << d_possible_delay[i] << "\t\t\t" << d_corr_output_f[i];
|
for (int32_t i = 0; i < static_cast<int32_t>(d_folding_factor); i++) DLOG(INFO) << d_possible_delay[i] << "\t\t\t" << d_corr_output_f[i];
|
||||||
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
|
DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples;
|
||||||
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
|
DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz;
|
||||||
DLOG(INFO) << "magnitude folded " << d_mag;
|
DLOG(INFO) << "magnitude folded " << d_mag;
|
||||||
|
@ -67,10 +67,14 @@ typedef boost::shared_ptr<pcps_quicksync_acquisition_cc>
|
|||||||
pcps_quicksync_acquisition_cc_sptr;
|
pcps_quicksync_acquisition_cc_sptr;
|
||||||
|
|
||||||
pcps_quicksync_acquisition_cc_sptr
|
pcps_quicksync_acquisition_cc_sptr
|
||||||
pcps_quicksync_make_acquisition_cc(unsigned int folding_factor,
|
pcps_quicksync_make_acquisition_cc(
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t folding_factor,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t sampled_ms,
|
||||||
int samples_per_ms, int samples_per_code,
|
uint32_t max_dwells,
|
||||||
|
uint32_t doppler_max,
|
||||||
|
int64_t fs_in,
|
||||||
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
bool bit_transition_flag,
|
bool bit_transition_flag,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename);
|
std::string dump_filename);
|
||||||
@ -86,56 +90,56 @@ class pcps_quicksync_acquisition_cc : public gr::block
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend pcps_quicksync_acquisition_cc_sptr
|
friend pcps_quicksync_acquisition_cc_sptr
|
||||||
pcps_quicksync_make_acquisition_cc(unsigned int folding_factor,
|
pcps_quicksync_make_acquisition_cc(uint32_t folding_factor,
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms, uint32_t max_dwells,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t doppler_max, int64_t fs_in,
|
||||||
int samples_per_ms, int samples_per_code,
|
int32_t samples_per_ms, int32_t samples_per_code,
|
||||||
bool bit_transition_flag,
|
bool bit_transition_flag,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename);
|
std::string dump_filename);
|
||||||
|
|
||||||
pcps_quicksync_acquisition_cc(unsigned int folding_factor,
|
pcps_quicksync_acquisition_cc(uint32_t folding_factor,
|
||||||
unsigned int sampled_ms, unsigned int max_dwells,
|
uint32_t sampled_ms, uint32_t max_dwells,
|
||||||
unsigned int doppler_max, long fs_in,
|
uint32_t doppler_max, int64_t fs_in,
|
||||||
int samples_per_ms, int samples_per_code,
|
int32_t samples_per_ms, int32_t samples_per_code,
|
||||||
bool bit_transition_flag,
|
bool bit_transition_flag,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename);
|
std::string dump_filename);
|
||||||
|
|
||||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||||
int doppler_offset);
|
int32_t doppler_offset);
|
||||||
|
|
||||||
gr_complex* d_code;
|
gr_complex* d_code;
|
||||||
unsigned int d_folding_factor; // also referred in the paper as 'p'
|
uint32_t d_folding_factor; // also referred in the paper as 'p'
|
||||||
float* d_corr_acumulator;
|
float* d_corr_acumulator;
|
||||||
unsigned int* d_possible_delay;
|
uint32_t * d_possible_delay;
|
||||||
float* d_corr_output_f;
|
float* d_corr_output_f;
|
||||||
float* d_magnitude_folded;
|
float* d_magnitude_folded;
|
||||||
gr_complex* d_signal_folded;
|
gr_complex* d_signal_folded;
|
||||||
gr_complex* d_code_folded;
|
gr_complex* d_code_folded;
|
||||||
float d_noise_floor_power;
|
float d_noise_floor_power;
|
||||||
|
|
||||||
long d_fs_in;
|
int64_t d_fs_in;
|
||||||
int d_samples_per_ms;
|
int32_t d_samples_per_ms;
|
||||||
int d_samples_per_code;
|
int32_t d_samples_per_code;
|
||||||
unsigned int d_doppler_resolution;
|
uint32_t d_doppler_resolution;
|
||||||
float d_threshold;
|
float d_threshold;
|
||||||
std::string d_satellite_str;
|
std::string d_satellite_str;
|
||||||
unsigned int d_doppler_max;
|
uint32_t d_doppler_max;
|
||||||
unsigned int d_doppler_step;
|
uint32_t d_doppler_step;
|
||||||
unsigned int d_sampled_ms;
|
uint32_t d_sampled_ms;
|
||||||
unsigned int d_max_dwells;
|
uint32_t d_max_dwells;
|
||||||
unsigned int d_well_count;
|
uint32_t d_well_count;
|
||||||
unsigned int d_fft_size;
|
uint32_t d_fft_size;
|
||||||
uint64_t d_sample_counter;
|
uint64_t d_sample_counter;
|
||||||
gr_complex** d_grid_doppler_wipeoffs;
|
gr_complex** d_grid_doppler_wipeoffs;
|
||||||
unsigned int d_num_doppler_bins;
|
uint32_t d_num_doppler_bins;
|
||||||
gr_complex* d_fft_codes;
|
gr_complex* d_fft_codes;
|
||||||
gr::fft::fft_complex* d_fft_if;
|
gr::fft::fft_complex* d_fft_if;
|
||||||
gr::fft::fft_complex* d_fft_if2;
|
gr::fft::fft_complex* d_fft_if2;
|
||||||
gr::fft::fft_complex* d_ifft;
|
gr::fft::fft_complex* d_ifft;
|
||||||
Gnss_Synchro* d_gnss_synchro;
|
Gnss_Synchro* d_gnss_synchro;
|
||||||
unsigned int d_code_phase;
|
uint32_t d_code_phase;
|
||||||
float d_doppler_freq;
|
float d_doppler_freq;
|
||||||
float d_mag;
|
float d_mag;
|
||||||
float* d_magnitude;
|
float* d_magnitude;
|
||||||
@ -144,9 +148,9 @@ private:
|
|||||||
bool d_bit_transition_flag;
|
bool d_bit_transition_flag;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
bool d_active;
|
bool d_active;
|
||||||
int d_state;
|
int32_t d_state;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
unsigned int d_channel;
|
uint32_t d_channel;
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -168,7 +172,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Returns the maximum peak of grid search.
|
* \brief Returns the maximum peak of grid search.
|
||||||
*/
|
*/
|
||||||
inline unsigned int mag() const
|
inline uint32_t mag() const
|
||||||
{
|
{
|
||||||
return d_mag;
|
return d_mag;
|
||||||
}
|
}
|
||||||
@ -199,13 +203,13 @@ public:
|
|||||||
* first available sample.
|
* first available sample.
|
||||||
* \param state - int=1 forces start of acquisition
|
* \param state - int=1 forces start of acquisition
|
||||||
*/
|
*/
|
||||||
void set_state(int state);
|
void set_state(int32_t state);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set acquisition channel unique ID
|
* \brief Set acquisition channel unique ID
|
||||||
* \param channel - receiver channel.
|
* \param channel - receiver channel.
|
||||||
*/
|
*/
|
||||||
inline void set_channel(unsigned int channel)
|
inline void set_channel(uint32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
}
|
}
|
||||||
@ -224,7 +228,7 @@ public:
|
|||||||
* \brief Set maximum Doppler grid search
|
* \brief Set maximum Doppler grid search
|
||||||
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_max(unsigned int doppler_max)
|
inline void set_doppler_max(uint32_t doppler_max)
|
||||||
{
|
{
|
||||||
d_doppler_max = doppler_max;
|
d_doppler_max = doppler_max;
|
||||||
}
|
}
|
||||||
@ -233,7 +237,7 @@ public:
|
|||||||
* \brief Set Doppler steps for the grid search
|
* \brief Set Doppler steps for the grid search
|
||||||
* \param doppler_step - Frequency bin of the search grid [Hz].
|
* \param doppler_step - Frequency bin of the search grid [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_step(unsigned int doppler_step)
|
inline void set_doppler_step(uint32_t doppler_step)
|
||||||
{
|
{
|
||||||
d_doppler_step = doppler_step;
|
d_doppler_step = doppler_step;
|
||||||
}
|
}
|
||||||
|
@ -61,10 +61,14 @@
|
|||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(
|
pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(
|
||||||
unsigned int sampled_ms, unsigned int doppler_max,
|
uint32_t sampled_ms,
|
||||||
long fs_in, int samples_per_ms,
|
uint32_t doppler_max,
|
||||||
int samples_per_code, unsigned int tong_init_val,
|
int64_t fs_in,
|
||||||
unsigned int tong_max_val, unsigned int tong_max_dwells,
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
|
uint32_t tong_init_val,
|
||||||
|
uint32_t tong_max_val,
|
||||||
|
uint32_t tong_max_dwells,
|
||||||
bool dump, std::string dump_filename)
|
bool dump, std::string dump_filename)
|
||||||
{
|
{
|
||||||
return pcps_tong_acquisition_cc_sptr(
|
return pcps_tong_acquisition_cc_sptr(
|
||||||
@ -73,10 +77,14 @@ pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
|
pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
|
||||||
unsigned int sampled_ms, unsigned int doppler_max,
|
uint32_t sampled_ms,
|
||||||
long fs_in, int samples_per_ms,
|
uint32_t doppler_max,
|
||||||
int samples_per_code, unsigned int tong_init_val,
|
int64_t fs_in,
|
||||||
unsigned int tong_max_val, unsigned int tong_max_dwells,
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
|
uint32_t tong_init_val,
|
||||||
|
uint32_t tong_max_val,
|
||||||
|
uint32_t tong_max_dwells,
|
||||||
bool dump,
|
bool dump,
|
||||||
std::string dump_filename) : gr::block("pcps_tong_acquisition_cc",
|
std::string dump_filename) : gr::block("pcps_tong_acquisition_cc",
|
||||||
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
|
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
|
||||||
@ -130,7 +138,7 @@ pcps_tong_acquisition_cc::~pcps_tong_acquisition_cc()
|
|||||||
{
|
{
|
||||||
if (d_num_doppler_bins > 0)
|
if (d_num_doppler_bins > 0)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < d_num_doppler_bins; i++)
|
for (uint32_t i = 0; i < d_num_doppler_bins; i++)
|
||||||
{
|
{
|
||||||
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
||||||
volk_gnsssdr_free(d_grid_data[i]);
|
volk_gnsssdr_free(d_grid_data[i]);
|
||||||
@ -176,8 +184,8 @@ void pcps_tong_acquisition_cc::init()
|
|||||||
|
|
||||||
// Count the number of bins
|
// Count the number of bins
|
||||||
d_num_doppler_bins = 0;
|
d_num_doppler_bins = 0;
|
||||||
for (int doppler = static_cast<int>(-d_doppler_max);
|
for (auto doppler = static_cast<int32_t>(-d_doppler_max);
|
||||||
doppler <= static_cast<int>(d_doppler_max);
|
doppler <= static_cast<int32_t>(d_doppler_max);
|
||||||
doppler += d_doppler_step)
|
doppler += d_doppler_step)
|
||||||
{
|
{
|
||||||
d_num_doppler_bins++;
|
d_num_doppler_bins++;
|
||||||
@ -186,11 +194,11 @@ void pcps_tong_acquisition_cc::init()
|
|||||||
// Create the carrier Doppler wipeoff signals and allocate data grid.
|
// Create the carrier Doppler wipeoff signals and allocate data grid.
|
||||||
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_bins];
|
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_bins];
|
||||||
d_grid_data = new float *[d_num_doppler_bins];
|
d_grid_data = new float *[d_num_doppler_bins];
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
|
|
||||||
int doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
int32_t doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
float phase_step_rad = GPS_TWO_PI * doppler / static_cast<float>(d_fs_in);
|
float phase_step_rad = GPS_TWO_PI * doppler / static_cast<float>(d_fs_in);
|
||||||
float _phase[1];
|
float _phase[1];
|
||||||
_phase[0] = 0;
|
_phase[0] = 0;
|
||||||
@ -198,14 +206,14 @@ void pcps_tong_acquisition_cc::init()
|
|||||||
|
|
||||||
d_grid_data[doppler_index] = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
d_grid_data[doppler_index] = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
|
|
||||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
for (uint32_t i = 0; i < d_fft_size; i++)
|
||||||
{
|
{
|
||||||
d_grid_data[doppler_index][i] = 0;
|
d_grid_data[doppler_index][i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcps_tong_acquisition_cc::set_state(int state)
|
void pcps_tong_acquisition_cc::set_state(int32_t state)
|
||||||
{
|
{
|
||||||
d_state = state;
|
d_state = state;
|
||||||
if (d_state == 1)
|
if (d_state == 1)
|
||||||
@ -220,9 +228,9 @@ void pcps_tong_acquisition_cc::set_state(int state)
|
|||||||
d_input_power = 0.0;
|
d_input_power = 0.0;
|
||||||
d_test_statistics = 0.0;
|
d_test_statistics = 0.0;
|
||||||
|
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
for (uint32_t i = 0; i < d_fft_size; i++)
|
||||||
{
|
{
|
||||||
d_grid_data[doppler_index][i] = 0;
|
d_grid_data[doppler_index][i] = 0;
|
||||||
}
|
}
|
||||||
@ -241,7 +249,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
|
|||||||
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items __attribute__((unused)))
|
gr_vector_void_star &output_items __attribute__((unused)))
|
||||||
{
|
{
|
||||||
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
int32_t acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
|
||||||
|
|
||||||
switch (d_state)
|
switch (d_state)
|
||||||
{
|
{
|
||||||
@ -260,9 +268,9 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
|
|||||||
d_input_power = 0.0;
|
d_input_power = 0.0;
|
||||||
d_test_statistics = 0.0;
|
d_test_statistics = 0.0;
|
||||||
|
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < d_fft_size; i++)
|
for (uint32_t i = 0; i < d_fft_size; i++)
|
||||||
{
|
{
|
||||||
d_grid_data[doppler_index][i] = 0;
|
d_grid_data[doppler_index][i] = 0;
|
||||||
}
|
}
|
||||||
@ -280,7 +288,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// initialize acquisition algorithm
|
// initialize acquisition algorithm
|
||||||
int doppler;
|
int32_t doppler;
|
||||||
uint32_t indext = 0;
|
uint32_t indext = 0;
|
||||||
float magt = 0.0;
|
float magt = 0.0;
|
||||||
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
|
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
|
||||||
@ -304,11 +312,11 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
|
|||||||
d_input_power /= static_cast<float>(d_fft_size);
|
d_input_power /= static_cast<float>(d_fft_size);
|
||||||
|
|
||||||
// 2- Doppler frequency search loop
|
// 2- Doppler frequency search loop
|
||||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
{
|
{
|
||||||
// doppler search steps
|
// doppler search steps
|
||||||
|
|
||||||
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
|
doppler = -static_cast<int32_t>(d_doppler_max) + d_doppler_step * doppler_index;
|
||||||
|
|
||||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
|
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
|
||||||
d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
||||||
|
@ -64,11 +64,17 @@ class pcps_tong_acquisition_cc;
|
|||||||
typedef boost::shared_ptr<pcps_tong_acquisition_cc> pcps_tong_acquisition_cc_sptr;
|
typedef boost::shared_ptr<pcps_tong_acquisition_cc> pcps_tong_acquisition_cc_sptr;
|
||||||
|
|
||||||
pcps_tong_acquisition_cc_sptr
|
pcps_tong_acquisition_cc_sptr
|
||||||
pcps_tong_make_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max,
|
pcps_tong_make_acquisition_cc(
|
||||||
long fs_in, int samples_per_ms,
|
uint32_t sampled_ms,
|
||||||
int samples_per_code, unsigned int tong_init_val,
|
uint32_t doppler_max,
|
||||||
unsigned int tong_max_val, unsigned int tong_max_dwells,
|
int64_t fs_in,
|
||||||
bool dump, std::string dump_filename);
|
int32_t samples_per_ms,
|
||||||
|
int32_t samples_per_code,
|
||||||
|
uint32_t tong_init_val,
|
||||||
|
uint32_t tong_max_val,
|
||||||
|
uint32_t tong_max_dwells,
|
||||||
|
bool dump,
|
||||||
|
std::string dump_filename);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a Parallel Code Phase Search Acquisition with
|
* \brief This class implements a Parallel Code Phase Search Acquisition with
|
||||||
@ -78,45 +84,45 @@ class pcps_tong_acquisition_cc : public gr::block
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend pcps_tong_acquisition_cc_sptr
|
friend pcps_tong_acquisition_cc_sptr
|
||||||
pcps_tong_make_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max,
|
pcps_tong_make_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
|
||||||
long fs_in, int samples_per_ms,
|
int64_t fs_in, int32_t samples_per_ms,
|
||||||
int samples_per_code, unsigned int tong_init_val,
|
int32_t samples_per_code, uint32_t tong_init_val,
|
||||||
unsigned int tong_max_val, unsigned int tong_max_dwells,
|
uint32_t tong_max_val, uint32_t tong_max_dwells,
|
||||||
bool dump, std::string dump_filename);
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
pcps_tong_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max,
|
pcps_tong_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
|
||||||
long fs_in, int samples_per_ms,
|
int64_t fs_in, int32_t samples_per_ms,
|
||||||
int samples_per_code, unsigned int tong_init_val,
|
int32_t samples_per_code, uint32_t tong_init_val,
|
||||||
unsigned int tong_max_val, unsigned int tong_max_dwells,
|
uint32_t tong_max_val, uint32_t tong_max_dwells,
|
||||||
bool dump, std::string dump_filename);
|
bool dump, std::string dump_filename);
|
||||||
|
|
||||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||||
int doppler_offset);
|
int32_t doppler_offset);
|
||||||
|
|
||||||
long d_fs_in;
|
int64_t d_fs_in;
|
||||||
int d_samples_per_ms;
|
int32_t d_samples_per_ms;
|
||||||
int d_samples_per_code;
|
int32_t d_samples_per_code;
|
||||||
unsigned int d_doppler_resolution;
|
uint32_t d_doppler_resolution;
|
||||||
float d_threshold;
|
float d_threshold;
|
||||||
std::string d_satellite_str;
|
std::string d_satellite_str;
|
||||||
unsigned int d_doppler_max;
|
uint32_t d_doppler_max;
|
||||||
unsigned int d_doppler_step;
|
uint32_t d_doppler_step;
|
||||||
unsigned int d_sampled_ms;
|
uint32_t d_sampled_ms;
|
||||||
unsigned int d_dwell_count;
|
uint32_t d_dwell_count;
|
||||||
unsigned int d_tong_count;
|
uint32_t d_tong_count;
|
||||||
unsigned int d_tong_init_val;
|
uint32_t d_tong_init_val;
|
||||||
unsigned int d_tong_max_val;
|
uint32_t d_tong_max_val;
|
||||||
unsigned int d_tong_max_dwells;
|
uint32_t d_tong_max_dwells;
|
||||||
unsigned int d_fft_size;
|
uint32_t d_fft_size;
|
||||||
uint64_t d_sample_counter;
|
uint64_t d_sample_counter;
|
||||||
gr_complex** d_grid_doppler_wipeoffs;
|
gr_complex** d_grid_doppler_wipeoffs;
|
||||||
unsigned int d_num_doppler_bins;
|
uint32_t d_num_doppler_bins;
|
||||||
gr_complex* d_fft_codes;
|
gr_complex* d_fft_codes;
|
||||||
float** d_grid_data;
|
float** d_grid_data;
|
||||||
gr::fft::fft_complex* d_fft_if;
|
gr::fft::fft_complex* d_fft_if;
|
||||||
gr::fft::fft_complex* d_ifft;
|
gr::fft::fft_complex* d_ifft;
|
||||||
Gnss_Synchro* d_gnss_synchro;
|
Gnss_Synchro* d_gnss_synchro;
|
||||||
unsigned int d_code_phase;
|
uint32_t d_code_phase;
|
||||||
float d_doppler_freq;
|
float d_doppler_freq;
|
||||||
float d_mag;
|
float d_mag;
|
||||||
float* d_magnitude;
|
float* d_magnitude;
|
||||||
@ -124,9 +130,9 @@ private:
|
|||||||
float d_test_statistics;
|
float d_test_statistics;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
bool d_active;
|
bool d_active;
|
||||||
int d_state;
|
int32_t d_state;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
unsigned int d_channel;
|
uint32_t d_channel;
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -148,7 +154,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Returns the maximum peak of grid search.
|
* \brief Returns the maximum peak of grid search.
|
||||||
*/
|
*/
|
||||||
inline unsigned int mag() const
|
inline uint32_t mag() const
|
||||||
{
|
{
|
||||||
return d_mag;
|
return d_mag;
|
||||||
}
|
}
|
||||||
@ -179,13 +185,13 @@ public:
|
|||||||
* first available sample.
|
* first available sample.
|
||||||
* \param state - int=1 forces start of acquisition
|
* \param state - int=1 forces start of acquisition
|
||||||
*/
|
*/
|
||||||
void set_state(int state);
|
void set_state(int32_t state);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set acquisition channel unique ID
|
* \brief Set acquisition channel unique ID
|
||||||
* \param channel - receiver channel.
|
* \param channel - receiver channel.
|
||||||
*/
|
*/
|
||||||
inline void set_channel(unsigned int channel)
|
inline void set_channel(uint32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
}
|
}
|
||||||
@ -204,7 +210,7 @@ public:
|
|||||||
* \brief Set maximum Doppler grid search
|
* \brief Set maximum Doppler grid search
|
||||||
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_max(unsigned int doppler_max)
|
inline void set_doppler_max(uint32_t doppler_max)
|
||||||
{
|
{
|
||||||
d_doppler_max = doppler_max;
|
d_doppler_max = doppler_max;
|
||||||
}
|
}
|
||||||
@ -213,7 +219,7 @@ public:
|
|||||||
* \brief Set Doppler steps for the grid search
|
* \brief Set Doppler steps for the grid search
|
||||||
* \param doppler_step - Frequency bin of the search grid [Hz].
|
* \param doppler_step - Frequency bin of the search grid [Hz].
|
||||||
*/
|
*/
|
||||||
inline void set_doppler_step(unsigned int doppler_step)
|
inline void set_doppler_step(uint32_t doppler_step)
|
||||||
{
|
{
|
||||||
d_doppler_step = doppler_step;
|
d_doppler_step = doppler_step;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "byte_to_short.h"
|
#include "byte_to_short.h"
|
||||||
#include "configuration_interface.h"
|
#include "configuration_interface.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ ByteToShort::ByteToShort(ConfigurationInterface* configuration, std::string role
|
|||||||
dump_ = config_->property(role_ + ".dump", false);
|
dump_ = config_->property(role_ + ".dump", false);
|
||||||
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
|
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
|
||||||
|
|
||||||
size_t item_size = sizeof(short);
|
size_t item_size = sizeof(int16_t);
|
||||||
|
|
||||||
gr_char_to_short_ = gr::blocks::char_to_short::make();
|
gr_char_to_short_ = gr::blocks::char_to_short::make();
|
||||||
|
|
||||||
|
@ -287,15 +287,15 @@ gr::basic_block_sptr FirFilter::get_left_block()
|
|||||||
{
|
{
|
||||||
return cshort_to_float_x2_;
|
return cshort_to_float_x2_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
|
||||||
{
|
{
|
||||||
return cbyte_to_float_x2_;
|
return cbyte_to_float_x2_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return cshort_to_float_x2_;
|
return cshort_to_float_x2_;
|
||||||
}
|
}
|
||||||
@ -317,15 +317,15 @@ gr::basic_block_sptr FirFilter::get_right_block()
|
|||||||
{
|
{
|
||||||
return short_x2_to_cshort_;
|
return short_x2_to_cshort_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return float_to_complex_;
|
return float_to_complex_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "cbyte") && (output_item_type_ == "cbyte"))
|
||||||
{
|
{
|
||||||
return char_x2_cbyte_;
|
return char_x2_cbyte_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "cshort") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return float_to_complex_;
|
return float_to_complex_;
|
||||||
}
|
}
|
||||||
|
@ -327,15 +327,15 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_left_block()
|
|||||||
{
|
{
|
||||||
return freq_xlating_fir_filter_fcf_;
|
return freq_xlating_fir_filter_fcf_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return freq_xlating_fir_filter_scf_;
|
return freq_xlating_fir_filter_scf_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
||||||
{
|
{
|
||||||
return freq_xlating_fir_filter_scf_;
|
return freq_xlating_fir_filter_scf_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return gr_char_to_short_;
|
return gr_char_to_short_;
|
||||||
}
|
}
|
||||||
@ -361,15 +361,15 @@ gr::basic_block_sptr FreqXlatingFirFilter::get_right_block()
|
|||||||
{
|
{
|
||||||
return freq_xlating_fir_filter_fcf_;
|
return freq_xlating_fir_filter_fcf_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return freq_xlating_fir_filter_scf_;
|
return freq_xlating_fir_filter_scf_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "short") && (output_item_type_ == "cshort"))
|
||||||
{
|
{
|
||||||
return short_x2_to_cshort_;
|
return short_x2_to_cshort_;
|
||||||
}
|
}
|
||||||
else if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
if ((taps_item_type_ == "float") && (input_item_type_ == "byte") && (output_item_type_ == "gr_complex"))
|
||||||
{
|
{
|
||||||
return freq_xlating_fir_filter_scf_;
|
return freq_xlating_fir_filter_scf_;
|
||||||
}
|
}
|
||||||
|
@ -160,12 +160,9 @@ gr::basic_block_sptr PulseBlankingFilter::get_left_block()
|
|||||||
}
|
}
|
||||||
return pulse_blanking_cc_;
|
return pulse_blanking_cc_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(ERROR) << " Unknown input filter input/output item type conversion";
|
LOG(ERROR) << " Unknown input filter input/output item type conversion";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr PulseBlankingFilter::get_right_block()
|
gr::basic_block_sptr PulseBlankingFilter::get_right_block()
|
||||||
|
@ -49,7 +49,7 @@ beamformer::beamformer()
|
|||||||
{
|
{
|
||||||
//initialize weight vector
|
//initialize weight vector
|
||||||
|
|
||||||
if (posix_memalign((void **)&weight_vector, 16, GNSS_SDR_BEAMFORMER_CHANNELS * sizeof(gr_complex)) == 0)
|
if (posix_memalign(reinterpret_cast<void **>(&weight_vector), 16, GNSS_SDR_BEAMFORMER_CHANNELS * sizeof(gr_complex)) == 0)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void galileo_e5_a_code_gen_complex_sampled(std::complex<float>* _dest, char _Sig
|
|||||||
if (_fs != _codeFreqBasis)
|
if (_fs != _codeFreqBasis)
|
||||||
{
|
{
|
||||||
std::complex<float>* _resampled_signal;
|
std::complex<float>* _resampled_signal;
|
||||||
if (posix_memalign((void**)&_resampled_signal, 16, _samplesPerCode * sizeof(gr_complex)) == 0)
|
if (posix_memalign(reinterpret_cast<void**>(&_resampled_signal), 16, _samplesPerCode * sizeof(gr_complex)) == 0)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
resampler(_code, _resampled_signal, _codeFreqBasis, _fs, _codeLength, _samplesPerCode); // resamples code to fs
|
resampler(_code, _resampled_signal, _codeFreqBasis, _fs, _codeLength, _samplesPerCode); // resamples code to fs
|
||||||
|
@ -69,7 +69,7 @@ DEFINE_double(pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter,
|
|||||||
|
|
||||||
static bool ValidateC(const char* flagname, const std::string& value)
|
static bool ValidateC(const char* flagname, const std::string& value)
|
||||||
{
|
{
|
||||||
if (boost::filesystem::exists(value) or value.compare("-") == 0) // value is ok
|
if (boost::filesystem::exists(value) or value == "-") // value is ok
|
||||||
return true;
|
return true;
|
||||||
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
||||||
std::cout << "GNSS-SDR program ended." << std::endl;
|
std::cout << "GNSS-SDR program ended." << std::endl;
|
||||||
@ -78,7 +78,7 @@ static bool ValidateC(const char* flagname, const std::string& value)
|
|||||||
|
|
||||||
static bool ValidateConfigFile(const char* flagname, const std::string& value)
|
static bool ValidateConfigFile(const char* flagname, const std::string& value)
|
||||||
{
|
{
|
||||||
if (boost::filesystem::exists(value) or value.compare(std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf")) == 0) // value is ok
|
if (boost::filesystem::exists(value) or value == std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf")) // value is ok
|
||||||
return true;
|
return true;
|
||||||
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
||||||
std::cout << "GNSS-SDR program ended." << std::endl;
|
std::cout << "GNSS-SDR program ended." << std::endl;
|
||||||
@ -87,7 +87,7 @@ static bool ValidateConfigFile(const char* flagname, const std::string& value)
|
|||||||
|
|
||||||
static bool ValidateS(const char* flagname, const std::string& value)
|
static bool ValidateS(const char* flagname, const std::string& value)
|
||||||
{
|
{
|
||||||
if (boost::filesystem::exists(value) or value.compare("-") == 0) // value is ok
|
if (boost::filesystem::exists(value) or value == "-") // value is ok
|
||||||
return true;
|
return true;
|
||||||
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
||||||
std::cout << "GNSS-SDR program ended." << std::endl;
|
std::cout << "GNSS-SDR program ended." << std::endl;
|
||||||
@ -96,7 +96,7 @@ static bool ValidateS(const char* flagname, const std::string& value)
|
|||||||
|
|
||||||
static bool ValidateSignalSource(const char* flagname, const std::string& value)
|
static bool ValidateSignalSource(const char* flagname, const std::string& value)
|
||||||
{
|
{
|
||||||
if (boost::filesystem::exists(value) or value.compare("-") == 0) // value is ok
|
if (boost::filesystem::exists(value) or value == "-") // value is ok
|
||||||
return true;
|
return true;
|
||||||
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
std::cout << "Invalid value for flag -" << flagname << ". The file '" << value << "' does not exist." << std::endl;
|
||||||
std::cout << "GNSS-SDR program ended." << std::endl;
|
std::cout << "GNSS-SDR program ended." << std::endl;
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
|
gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
|
||||||
unsigned long long nitems,
|
uint64_t nitems,
|
||||||
gr::msg_queue::sptr queue,
|
gr::msg_queue::sptr queue,
|
||||||
bool stop_flowgraph) : gr::sync_block("valve",
|
bool stop_flowgraph) : gr::sync_block("valve",
|
||||||
gr::io_signature::make(1, 1, sizeof_stream_item),
|
gr::io_signature::make(1, 1, sizeof_stream_item),
|
||||||
@ -54,14 +54,14 @@ gnss_sdr_valve::gnss_sdr_valve(size_t sizeof_stream_item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue, bool stop_flowgraph)
|
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue, bool stop_flowgraph)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
|
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
|
||||||
return valve_;
|
return valve_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, unsigned long long nitems, gr::msg_queue::sptr queue)
|
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), true));
|
boost::shared_ptr<gnss_sdr_valve> valve_(new gnss_sdr_valve(sizeof_stream_item, nitems, std::move(queue), true));
|
||||||
return valve_;
|
return valve_;
|
||||||
@ -93,7 +93,7 @@ int gnss_sdr_valve::work(int noutput_items,
|
|||||||
usleep(1000000);
|
usleep(1000000);
|
||||||
return 0; // do not produce or consume
|
return 0; // do not produce or consume
|
||||||
}
|
}
|
||||||
unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast<long long unsigned int>(noutput_items));
|
uint64_t n = std::min(d_nitems - d_ncopied_items, static_cast<uint64_t>(noutput_items));
|
||||||
if (n == 0) return 0;
|
if (n == 0) return 0;
|
||||||
memcpy(output_items[0], input_items[0], n * input_signature()->sizeof_stream_item(0));
|
memcpy(output_items[0], input_items[0], n * input_signature()->sizeof_stream_item(0));
|
||||||
d_ncopied_items += n;
|
d_ncopied_items += n;
|
||||||
|
@ -37,13 +37,14 @@
|
|||||||
#include <gnuradio/sync_block.h>
|
#include <gnuradio/sync_block.h>
|
||||||
#include <gnuradio/msg_queue.h>
|
#include <gnuradio/msg_queue.h>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
||||||
unsigned long long nitems,
|
uint64_t nitems,
|
||||||
gr::msg_queue::sptr queue);
|
gr::msg_queue::sptr queue);
|
||||||
|
|
||||||
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
||||||
unsigned long long nitems,
|
uint64_t nitems,
|
||||||
gr::msg_queue::sptr queue,
|
gr::msg_queue::sptr queue,
|
||||||
bool stop_flowgraph);
|
bool stop_flowgraph);
|
||||||
|
|
||||||
@ -54,22 +55,22 @@ boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
|||||||
class gnss_sdr_valve : public gr::sync_block
|
class gnss_sdr_valve : public gr::sync_block
|
||||||
{
|
{
|
||||||
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
||||||
unsigned long long nitems,
|
uint64_t nitems,
|
||||||
gr::msg_queue::sptr queue);
|
gr::msg_queue::sptr queue);
|
||||||
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
friend boost::shared_ptr<gr::block> gnss_sdr_make_valve(size_t sizeof_stream_item,
|
||||||
unsigned long long nitems,
|
uint64_t nitems,
|
||||||
gr::msg_queue::sptr queue,
|
gr::msg_queue::sptr queue,
|
||||||
bool stop_flowgraph);
|
bool stop_flowgraph);
|
||||||
|
|
||||||
unsigned long long d_nitems;
|
uint64_t d_nitems;
|
||||||
unsigned long long d_ncopied_items;
|
uint64_t d_ncopied_items;
|
||||||
gr::msg_queue::sptr d_queue;
|
gr::msg_queue::sptr d_queue;
|
||||||
bool d_stop_flowgraph;
|
bool d_stop_flowgraph;
|
||||||
bool d_open_valve;
|
bool d_open_valve;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
gnss_sdr_valve(size_t sizeof_stream_item,
|
gnss_sdr_valve(size_t sizeof_stream_item,
|
||||||
unsigned long long nitems,
|
uint64_t nitems,
|
||||||
gr::msg_queue::sptr queue, bool stop_flowgraph);
|
gr::msg_queue::sptr queue, bool stop_flowgraph);
|
||||||
void open_valve();
|
void open_valve();
|
||||||
|
|
||||||
|
@ -153,16 +153,13 @@ gr::basic_block_sptr Pass_Through::get_left_block()
|
|||||||
{
|
{
|
||||||
return conjugate_sc_;
|
return conjugate_sc_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return conjugate_ic_;
|
return conjugate_ic_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << "Setting inverted_spectrum to true with item_type "
|
LOG(WARNING) << "Setting inverted_spectrum to true with item_type "
|
||||||
<< item_type_ << " is not defined and has no effect.";
|
<< item_type_ << " is not defined and has no effect.";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return kludge_copy_;
|
return kludge_copy_;
|
||||||
}
|
}
|
||||||
@ -180,16 +177,13 @@ gr::basic_block_sptr Pass_Through::get_right_block()
|
|||||||
{
|
{
|
||||||
return conjugate_sc_;
|
return conjugate_sc_;
|
||||||
}
|
}
|
||||||
else if (item_type_ == "cbyte")
|
if (item_type_ == "cbyte")
|
||||||
{
|
{
|
||||||
return conjugate_ic_;
|
return conjugate_ic_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
DLOG(WARNING) << "Setting inverted_spectrum to true with item_type "
|
DLOG(WARNING) << "Setting inverted_spectrum to true with item_type "
|
||||||
<< item_type_ << " is not defined and has no effect.";
|
<< item_type_ << " is not defined and has no effect.";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return kludge_copy_;
|
return kludge_copy_;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
/* macros --------------------------------------------------------------------*/
|
/* macros --------------------------------------------------------------------*/
|
||||||
|
@ -66,7 +66,7 @@ int getindex(double value, const double *range)
|
|||||||
if (range[2] == 0.0) return 0;
|
if (range[2] == 0.0) return 0;
|
||||||
if (range[1] > 0.0 && (value < range[0] || range[1] < value)) return -1;
|
if (range[1] > 0.0 && (value < range[0] || range[1] < value)) return -1;
|
||||||
if (range[1] < 0.0 && (value < range[1] || range[0] < value)) return -1;
|
if (range[1] < 0.0 && (value < range[1] || range[0] < value)) return -1;
|
||||||
return (int)floor((value - range[0]) / range[2] + 0.5);
|
return static_cast<int>(floor((value - range[0]) / range[2] + 0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ tec_t *addtec(const double *lats, const double *lons, const double *hgts,
|
|||||||
if (nav->nt >= nav->ntmax)
|
if (nav->nt >= nav->ntmax)
|
||||||
{
|
{
|
||||||
nav->ntmax += 256;
|
nav->ntmax += 256;
|
||||||
if (!(nav_tec = (tec_t *)realloc(nav->tec, sizeof(tec_t) * nav->ntmax)))
|
if (!(nav_tec = static_cast<tec_t *>(realloc(nav->tec, sizeof(tec_t) * nav->ntmax))))
|
||||||
{
|
{
|
||||||
trace(1, "readionex malloc error ntmax=%d\n", nav->ntmax);
|
trace(1, "readionex malloc error ntmax=%d\n", nav->ntmax);
|
||||||
free(nav->tec);
|
free(nav->tec);
|
||||||
@ -125,8 +125,8 @@ tec_t *addtec(const double *lats, const double *lons, const double *hgts,
|
|||||||
}
|
}
|
||||||
n = ndata[0] * ndata[1] * ndata[2];
|
n = ndata[0] * ndata[1] * ndata[2];
|
||||||
|
|
||||||
if (!(p->data = (double *)malloc(sizeof(double) * n)) ||
|
if (!(p->data = static_cast<double *>(malloc(sizeof(double) * n))) ||
|
||||||
!(p->rms = (float *)malloc(sizeof(float) * n)))
|
!(p->rms = static_cast<float *>(malloc(sizeof(float) * n))))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -310,7 +310,7 @@ int readionexb(FILE *fp, const double *lats, const double *lons,
|
|||||||
if (type == 1)
|
if (type == 1)
|
||||||
p->data[index] = x * std::pow(10.0, nexp);
|
p->data[index] = x * std::pow(10.0, nexp);
|
||||||
else
|
else
|
||||||
p->rms[index] = (float)(x * std::pow(10.0, nexp));
|
p->rms[index] = static_cast<float>(x * std::pow(10.0, nexp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ void readtec(const char *file, nav_t *nav, int opt)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < MAXEXFILE; i++)
|
for (i = 0; i < MAXEXFILE; i++)
|
||||||
{
|
{
|
||||||
if (!(efiles[i] = (char *)malloc(1024)))
|
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
|
||||||
{
|
{
|
||||||
for (i--; i >= 0; i--) free(efiles[i]);
|
for (i--; i >= 0; i--) free(efiles[i]);
|
||||||
return;
|
return;
|
||||||
@ -395,7 +395,7 @@ void readtec(const char *file, nav_t *nav, int opt)
|
|||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
if (!(fp = fopen(efiles[i], "r")))
|
if (!(fp = fopen(efiles[i], "re")))
|
||||||
{
|
{
|
||||||
trace(2, "ionex file open error %s\n", efiles[i]);
|
trace(2, "ionex file open error %s\n", efiles[i]);
|
||||||
continue;
|
continue;
|
||||||
@ -447,9 +447,9 @@ int interptec(const tec_t *tec, int k, const double *posp, double *value,
|
|||||||
|
|
||||||
a = dlat / tec->lats[2];
|
a = dlat / tec->lats[2];
|
||||||
b = dlon / tec->lons[2];
|
b = dlon / tec->lons[2];
|
||||||
i = (int)floor(a);
|
i = static_cast<int>(floor(a));
|
||||||
a -= i;
|
a -= i;
|
||||||
j = (int)floor(b);
|
j = static_cast<int>(floor(b));
|
||||||
b -= j;
|
b -= j;
|
||||||
|
|
||||||
/* get gridded tec data */
|
/* get gridded tec data */
|
||||||
|
@ -84,10 +84,10 @@ void gauss(int n, double *L, double *Z, int i, int j)
|
|||||||
{
|
{
|
||||||
int k, mu;
|
int k, mu;
|
||||||
|
|
||||||
if ((mu = (int)ROUND_LAMBDA(L[i + j * n])) != 0)
|
if ((mu = static_cast<int>ROUND_LAMBDA(L[i + j * n])) != 0)
|
||||||
{
|
{
|
||||||
for (k = i; k < n; k++) L[k + n * j] -= (double)mu * L[k + i * n];
|
for (k = i; k < n; k++) L[k + n * j] -= static_cast<double>(mu) * L[k + i * n];
|
||||||
for (k = 0; k < n; k++) Z[k + n * j] -= (double)mu * Z[k + i * n];
|
for (k = 0; k < n; k++) Z[k + n * j] -= static_cast<double>(mu) * Z[k + i * n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,11 +609,11 @@ int estpos(const obsd_t *obs, int n, const double *rs, const double *dts,
|
|||||||
sol->dtr[2] = x[5] / SPEED_OF_LIGHT; /* gal-gps time offset (s) */
|
sol->dtr[2] = x[5] / SPEED_OF_LIGHT; /* gal-gps time offset (s) */
|
||||||
sol->dtr[3] = x[6] / SPEED_OF_LIGHT; /* bds-gps time offset (s) */
|
sol->dtr[3] = x[6] / SPEED_OF_LIGHT; /* bds-gps time offset (s) */
|
||||||
for (j = 0; j < 6; j++) sol->rr[j] = j < 3 ? x[j] : 0.0;
|
for (j = 0; j < 6; j++) sol->rr[j] = j < 3 ? x[j] : 0.0;
|
||||||
for (j = 0; j < 3; j++) sol->qr[j] = (float)Q[j + j * NX];
|
for (j = 0; j < 3; j++) sol->qr[j] = static_cast<float>(Q[j + j * NX]);
|
||||||
sol->qr[3] = (float)Q[1]; /* cov xy */
|
sol->qr[3] = static_cast<float>(Q[1]); /* cov xy */
|
||||||
sol->qr[4] = (float)Q[2 + NX]; /* cov yz */
|
sol->qr[4] = static_cast<float>(Q[2 + NX]); /* cov yz */
|
||||||
sol->qr[5] = (float)Q[2]; /* cov zx */
|
sol->qr[5] = static_cast<float>(Q[2]); /* cov zx */
|
||||||
sol->ns = (unsigned char)ns;
|
sol->ns = static_cast<unsigned char>(ns);
|
||||||
sol->age = sol->ratio = 0.0;
|
sol->age = sol->ratio = 0.0;
|
||||||
|
|
||||||
/* validate solution */
|
/* validate solution */
|
||||||
@ -652,7 +652,7 @@ int raim_fde(const obsd_t *obs, int n, const double *rs,
|
|||||||
|
|
||||||
trace(3, "raim_fde: %s n=%2d\n", time_str(obs[0].time, 0), n);
|
trace(3, "raim_fde: %s n=%2d\n", time_str(obs[0].time, 0), n);
|
||||||
|
|
||||||
if (!(obs_e = (obsd_t *)malloc(sizeof(obsd_t) * n))) return 0;
|
if (!(obs_e = static_cast<obsd_t *>(malloc(sizeof(obsd_t) * n)))) return 0;
|
||||||
rs_e = mat(6, n);
|
rs_e = mat(6, n);
|
||||||
dts_e = mat(2, n);
|
dts_e = mat(2, n);
|
||||||
vare_e = mat(1, n);
|
vare_e = mat(1, n);
|
||||||
|
@ -518,7 +518,7 @@ int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtk->sol.ratio = (float)(MIN_PPP(s[1] / s[0], 999.9));
|
rtk->sol.ratio = static_cast<float>(MIN_PPP(s[1] / s[0], 999.9));
|
||||||
|
|
||||||
/* varidation by ratio-test */
|
/* varidation by ratio-test */
|
||||||
if (rtk->opt.thresar[0] > 0.0 && rtk->sol.ratio < rtk->opt.thresar[0])
|
if (rtk->opt.thresar[0] > 0.0 && rtk->sol.ratio < rtk->opt.thresar[0])
|
||||||
@ -1113,7 +1113,7 @@ void udbias_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
|
|||||||
/* reset phase-bias if expire obs outage counter */
|
/* reset phase-bias if expire obs outage counter */
|
||||||
for (i = 0; i < MAXSAT; i++)
|
for (i = 0; i < MAXSAT; i++)
|
||||||
{
|
{
|
||||||
if (++rtk->ssat[i].outc[0] > (unsigned int)rtk->opt.maxout)
|
if (++rtk->ssat[i].outc[0] > static_cast<unsigned int>(rtk->opt.maxout))
|
||||||
{
|
{
|
||||||
initx(rtk, 0.0, 0.0, IB_PPP(i + 1, &rtk->opt));
|
initx(rtk, 0.0, 0.0, IB_PPP(i + 1, &rtk->opt));
|
||||||
}
|
}
|
||||||
@ -1492,11 +1492,11 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
rtk->sol.rr[i] = rtk->x[i];
|
rtk->sol.rr[i] = rtk->x[i];
|
||||||
rtk->sol.qr[i] = (float)rtk->P[i + i * rtk->nx];
|
rtk->sol.qr[i] = static_cast<float>(rtk->P[i + i * rtk->nx]);
|
||||||
}
|
}
|
||||||
rtk->sol.qr[3] = (float)rtk->P[1];
|
rtk->sol.qr[3] = static_cast<float>(rtk->P[1]);
|
||||||
rtk->sol.qr[4] = (float)rtk->P[2 + rtk->nx];
|
rtk->sol.qr[4] = static_cast<float>(rtk->P[2 + rtk->nx]);
|
||||||
rtk->sol.qr[5] = (float)rtk->P[2];
|
rtk->sol.qr[5] = static_cast<float>(rtk->P[2]);
|
||||||
rtk->sol.dtr[0] = rtk->x[IC_PPP(0, opt)];
|
rtk->sol.dtr[0] = rtk->x[IC_PPP(0, opt)];
|
||||||
rtk->sol.dtr[1] = rtk->x[IC_PPP(1, opt)] - rtk->x[IC_PPP(0, opt)];
|
rtk->sol.dtr[1] = rtk->x[IC_PPP(1, opt)] - rtk->x[IC_PPP(0, opt)];
|
||||||
for (i = 0; i < n && i < MAXOBS; i++)
|
for (i = 0; i < n && i < MAXOBS; i++)
|
||||||
|
@ -98,12 +98,12 @@ int readsp3h(FILE *fp, gtime_t *time, char *type, int *sats,
|
|||||||
{
|
{
|
||||||
if (i == 2)
|
if (i == 2)
|
||||||
{
|
{
|
||||||
ns = (int)str2num(buff, 4, 2);
|
ns = static_cast<int>(str2num(buff, 4, 2));
|
||||||
}
|
}
|
||||||
for (j = 0; j < 17 && k < ns; j++)
|
for (j = 0; j < 17 && k < ns; j++)
|
||||||
{
|
{
|
||||||
sys = code2sys(buff[9 + 3 * j]);
|
sys = code2sys(buff[9 + 3 * j]);
|
||||||
prn = (int)str2num(buff, 10 + 3 * j, 2);
|
prn = static_cast<int>(str2num(buff, 10 + 3 * j, 2));
|
||||||
if (k < MAXSAT) sats[k++] = satno(sys, prn);
|
if (k < MAXSAT) sats[k++] = satno(sys, prn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ int addpeph(nav_t *nav, peph_t *peph)
|
|||||||
if (nav->ne >= nav->nemax)
|
if (nav->ne >= nav->nemax)
|
||||||
{
|
{
|
||||||
nav->nemax += 256;
|
nav->nemax += 256;
|
||||||
if (!(nav_peph = (peph_t *)realloc(nav->peph, sizeof(peph_t) * nav->nemax)))
|
if (!(nav_peph = static_cast<peph_t *>(realloc(nav->peph, sizeof(peph_t) * nav->nemax))))
|
||||||
{
|
{
|
||||||
trace(1, "readsp3b malloc error n=%d\n", nav->nemax);
|
trace(1, "readsp3b malloc error n=%d\n", nav->nemax);
|
||||||
free(nav->peph);
|
free(nav->peph);
|
||||||
@ -190,7 +190,7 @@ void readsp3b(FILE *fp, char type, int *sats __attribute__((unused)), int ns, do
|
|||||||
if (strlen(buff) < 4 || (buff[0] != 'P' && buff[0] != 'V')) continue;
|
if (strlen(buff) < 4 || (buff[0] != 'P' && buff[0] != 'V')) continue;
|
||||||
|
|
||||||
sys = buff[1] == ' ' ? SYS_GPS : code2sys(buff[1]);
|
sys = buff[1] == ' ' ? SYS_GPS : code2sys(buff[1]);
|
||||||
prn = (int)str2num(buff, 2, 2);
|
prn = static_cast<int>(str2num(buff, 2, 2));
|
||||||
if (sys == SYS_SBS)
|
if (sys == SYS_SBS)
|
||||||
prn += 100;
|
prn += 100;
|
||||||
else if (sys == SYS_QZS)
|
else if (sys == SYS_QZS)
|
||||||
@ -223,7 +223,7 @@ void readsp3b(FILE *fp, char type, int *sats __attribute__((unused)), int ns, do
|
|||||||
}
|
}
|
||||||
if ((base = bfact[j < 3 ? 0 : 1]) > 0.0 && std > 0.0)
|
if ((base = bfact[j < 3 ? 0 : 1]) > 0.0 && std > 0.0)
|
||||||
{
|
{
|
||||||
peph.std[sat - 1][j] = (float)(std::pow(base, std) * (j < 3 ? 1e-3 : 1e-12));
|
peph.std[sat - 1][j] = static_cast<float>(std::pow(base, std) * (j < 3 ? 1e-3 : 1e-12));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (v)
|
else if (v)
|
||||||
@ -234,7 +234,7 @@ void readsp3b(FILE *fp, char type, int *sats __attribute__((unused)), int ns, do
|
|||||||
}
|
}
|
||||||
if ((base = bfact[j < 3 ? 0 : 1]) > 0.0 && std > 0.0)
|
if ((base = bfact[j < 3 ? 0 : 1]) > 0.0 && std > 0.0)
|
||||||
{
|
{
|
||||||
peph.vst[sat - 1][j] = (float)(std::pow(base, std) * (j < 3 ? 1e-7 : 1e-16));
|
peph.vst[sat - 1][j] = static_cast<float>(std::pow(base, std) * (j < 3 ? 1e-7 : 1e-16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ void readsp3(const char *file, nav_t *nav, int opt)
|
|||||||
|
|
||||||
for (i = 0; i < MAXEXFILE; i++)
|
for (i = 0; i < MAXEXFILE; i++)
|
||||||
{
|
{
|
||||||
if (!(efiles[i] = (char *)malloc(1024)))
|
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
|
||||||
{
|
{
|
||||||
for (i--; i >= 0; i--) free(efiles[i]);
|
for (i--; i >= 0; i--) free(efiles[i]);
|
||||||
return;
|
return;
|
||||||
@ -331,7 +331,7 @@ void readsp3(const char *file, nav_t *nav, int opt)
|
|||||||
if (!strstr(ext + 1, "sp3") && !strstr(ext + 1, ".SP3") &&
|
if (!strstr(ext + 1, "sp3") && !strstr(ext + 1, ".SP3") &&
|
||||||
!strstr(ext + 1, "eph") && !strstr(ext + 1, ".EPH")) continue;
|
!strstr(ext + 1, "eph") && !strstr(ext + 1, ".EPH")) continue;
|
||||||
|
|
||||||
if (!(fp = fopen(efiles[i], "r")))
|
if (!(fp = fopen(efiles[i], "re")))
|
||||||
{
|
{
|
||||||
trace(2, "sp3 file open error %s\n", efiles[i]);
|
trace(2, "sp3 file open error %s\n", efiles[i]);
|
||||||
continue;
|
continue;
|
||||||
@ -389,7 +389,7 @@ int readdcbf(const char *file, nav_t *nav, const sta_t *sta)
|
|||||||
|
|
||||||
trace(3, "readdcbf: file=%s\n", file);
|
trace(3, "readdcbf: file=%s\n", file);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
trace(2, "dcb parameters file open error: %s\n", file);
|
trace(2, "dcb parameters file open error: %s\n", file);
|
||||||
return 0;
|
return 0;
|
||||||
@ -453,7 +453,7 @@ int readdcb(const char *file, nav_t *nav, const sta_t *sta)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < MAXEXFILE; i++)
|
for (i = 0; i < MAXEXFILE; i++)
|
||||||
{
|
{
|
||||||
if (!(efiles[i] = (char *)malloc(1024)))
|
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
|
||||||
{
|
{
|
||||||
for (i--; i >= 0; i--) free(efiles[i]);
|
for (i--; i >= 0; i--) free(efiles[i]);
|
||||||
return 0;
|
return 0;
|
||||||
@ -490,7 +490,7 @@ int addfcb(nav_t *nav, gtime_t ts, gtime_t te, int sat,
|
|||||||
if (nav->nf >= nav->nfmax)
|
if (nav->nf >= nav->nfmax)
|
||||||
{
|
{
|
||||||
nav->nfmax = nav->nfmax <= 0 ? 2048 : nav->nfmax * 2;
|
nav->nfmax = nav->nfmax <= 0 ? 2048 : nav->nfmax * 2;
|
||||||
if (!(nav_fcb = (fcbd_t *)realloc(nav->fcb, sizeof(fcbd_t) * nav->nfmax)))
|
if (!(nav_fcb = static_cast<fcbd_t *>(realloc(nav->fcb, sizeof(fcbd_t) * nav->nfmax))))
|
||||||
{
|
{
|
||||||
free(nav->fcb);
|
free(nav->fcb);
|
||||||
nav->nf = nav->nfmax = 0;
|
nav->nf = nav->nfmax = 0;
|
||||||
@ -525,7 +525,7 @@ int readfcbf(const char *file, nav_t *nav)
|
|||||||
|
|
||||||
trace(3, "readfcbf: file=%s\n", file);
|
trace(3, "readfcbf: file=%s\n", file);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
trace(2, "fcb parameters file open error: %s\n", file);
|
trace(2, "fcb parameters file open error: %s\n", file);
|
||||||
return 0;
|
return 0;
|
||||||
@ -578,7 +578,7 @@ int readfcb(const char *file, nav_t *nav)
|
|||||||
|
|
||||||
for (i = 0; i < MAXEXFILE; i++)
|
for (i = 0; i < MAXEXFILE; i++)
|
||||||
{
|
{
|
||||||
if (!(efiles[i] = (char *)malloc(1024)))
|
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
|
||||||
{
|
{
|
||||||
for (i--; i >= 0; i--) free(efiles[i]);
|
for (i--; i >= 0; i--) free(efiles[i]);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -113,9 +113,9 @@ int init_rtcm(rtcm_t *rtcm)
|
|||||||
rtcm->nav.geph = nullptr;
|
rtcm->nav.geph = nullptr;
|
||||||
|
|
||||||
/* reallocate memory for observation and ephemris buffer */
|
/* reallocate memory for observation and ephemris buffer */
|
||||||
if (!(rtcm->obs.data = (obsd_t *)malloc(sizeof(obsd_t) * MAXOBS)) ||
|
if (!(rtcm->obs.data = static_cast<obsd_t *>(malloc(sizeof(obsd_t) * MAXOBS))) ||
|
||||||
!(rtcm->nav.eph = (eph_t *)malloc(sizeof(eph_t) * MAXSAT)) ||
|
!(rtcm->nav.eph = static_cast<eph_t *>(malloc(sizeof(eph_t) * MAXSAT))) ||
|
||||||
!(rtcm->nav.geph = (geph_t *)malloc(sizeof(geph_t) * MAXPRNGLO)))
|
!(rtcm->nav.geph = static_cast<geph_t *>(malloc(sizeof(geph_t) * MAXPRNGLO))))
|
||||||
{
|
{
|
||||||
free_rtcm(rtcm);
|
free_rtcm(rtcm);
|
||||||
return 0;
|
return 0;
|
||||||
@ -182,7 +182,7 @@ int input_rtcm2(rtcm_t *rtcm, unsigned char data)
|
|||||||
/* synchronize frame */
|
/* synchronize frame */
|
||||||
if (rtcm->nbyte == 0)
|
if (rtcm->nbyte == 0)
|
||||||
{
|
{
|
||||||
preamb = (unsigned char)(rtcm->word >> 22);
|
preamb = static_cast<unsigned char>(rtcm->word >> 22);
|
||||||
if (rtcm->word & 0x40000000) preamb ^= 0xFF; /* decode preamble */
|
if (rtcm->word & 0x40000000) preamb ^= 0xFF; /* decode preamble */
|
||||||
if (preamb != RTCM2PREAMB) continue;
|
if (preamb != RTCM2PREAMB) continue;
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ int input_rtcm2f(rtcm_t *rtcm, FILE *fp)
|
|||||||
for (i = 0; i < 4096; i++)
|
for (i = 0; i < 4096; i++)
|
||||||
{
|
{
|
||||||
if ((data = fgetc(fp)) == EOF) return -2;
|
if ((data = fgetc(fp)) == EOF) return -2;
|
||||||
if ((ret = input_rtcm2(rtcm, (unsigned char)data))) return ret;
|
if ((ret = input_rtcm2(rtcm, static_cast<unsigned char>(data)))) return ret;
|
||||||
}
|
}
|
||||||
return 0; /* return at every 4k bytes */
|
return 0; /* return at every 4k bytes */
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ int input_rtcm3f(rtcm_t *rtcm, FILE *fp)
|
|||||||
for (i = 0; i < 4096; i++)
|
for (i = 0; i < 4096; i++)
|
||||||
{
|
{
|
||||||
if ((data = fgetc(fp)) == EOF) return -2;
|
if ((data = fgetc(fp)) == EOF) return -2;
|
||||||
if ((ret = input_rtcm3(rtcm, (unsigned char)data))) return ret;
|
if ((ret = input_rtcm3(rtcm, static_cast<unsigned char>(data)))) return ret;
|
||||||
}
|
}
|
||||||
return 0; /* return at every 4k bytes */
|
return 0; /* return at every 4k bytes */
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ double adjcp(rtcm_t *rtcm, int sat, int freq, double cp)
|
|||||||
int lossoflock(rtcm_t *rtcm, int sat, int freq, int lock)
|
int lossoflock(rtcm_t *rtcm, int sat, int freq, int lock)
|
||||||
{
|
{
|
||||||
int lli = (!lock && !rtcm->lock[sat - 1][freq]) || lock < rtcm->lock[sat - 1][freq];
|
int lli = (!lock && !rtcm->lock[sat - 1][freq]) || lock < rtcm->lock[sat - 1][freq];
|
||||||
rtcm->lock[sat - 1][freq] = (unsigned short)lock;
|
rtcm->lock[sat - 1][freq] = static_cast<uint16_t>(lock);
|
||||||
return lli;
|
return lli;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ int lossoflock(rtcm_t *rtcm, int sat, int freq, int lock)
|
|||||||
/* s/n ratio -----------------------------------------------------------------*/
|
/* s/n ratio -----------------------------------------------------------------*/
|
||||||
unsigned char snratio(double snr)
|
unsigned char snratio(double snr)
|
||||||
{
|
{
|
||||||
return (unsigned char)(snr <= 0.0 || 255.5 <= snr ? 0.0 : snr * 4.0 + 0.5);
|
return static_cast<unsigned char>(snr <= 0.0 || 255.5 <= snr ? 0.0 : snr * 4.0 + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ int decode_type1002(rtcm_t *rtcm)
|
|||||||
}
|
}
|
||||||
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
||||||
pr1 = pr1 * 0.02 + amb * PRUNIT_GPS;
|
pr1 = pr1 * 0.02 + amb * PRUNIT_GPS;
|
||||||
if (ppr1 != (int)0xFFF80000)
|
if (ppr1 != static_cast<int>(0xFFF80000))
|
||||||
{
|
{
|
||||||
rtcm->obs.data[index].P[0] = pr1;
|
rtcm->obs.data[index].P[0] = pr1;
|
||||||
cp1 = adjcp(rtcm, sat, 0, ppr1 * 0.0005 / lam_carr[0]);
|
cp1 = adjcp(rtcm, sat, 0, ppr1 * 0.0005 / lam_carr[0]);
|
||||||
@ -418,7 +418,7 @@ int decode_type1004(rtcm_t *rtcm)
|
|||||||
}
|
}
|
||||||
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
||||||
pr1 = pr1 * 0.02 + amb * PRUNIT_GPS;
|
pr1 = pr1 * 0.02 + amb * PRUNIT_GPS;
|
||||||
if (ppr1 != (int)0xFFF80000)
|
if (ppr1 != static_cast<int>(0xFFF80000))
|
||||||
{
|
{
|
||||||
rtcm->obs.data[index].P[0] = pr1;
|
rtcm->obs.data[index].P[0] = pr1;
|
||||||
cp1 = adjcp(rtcm, sat, 0, ppr1 * 0.0005 / lam_carr[0]);
|
cp1 = adjcp(rtcm, sat, 0, ppr1 * 0.0005 / lam_carr[0]);
|
||||||
@ -428,11 +428,11 @@ int decode_type1004(rtcm_t *rtcm)
|
|||||||
rtcm->obs.data[index].SNR[0] = snratio(cnr1 * 0.25);
|
rtcm->obs.data[index].SNR[0] = snratio(cnr1 * 0.25);
|
||||||
rtcm->obs.data[index].code[0] = code1 ? CODE_L1P : CODE_L1C;
|
rtcm->obs.data[index].code[0] = code1 ? CODE_L1P : CODE_L1C;
|
||||||
|
|
||||||
if (pr21 != (int)0xFFFFE000)
|
if (pr21 != static_cast<int>(0xFFFFE000))
|
||||||
{
|
{
|
||||||
rtcm->obs.data[index].P[1] = pr1 + pr21 * 0.02;
|
rtcm->obs.data[index].P[1] = pr1 + pr21 * 0.02;
|
||||||
}
|
}
|
||||||
if (ppr2 != (int)0xFFF80000)
|
if (ppr2 != static_cast<int>(0xFFF80000))
|
||||||
{
|
{
|
||||||
cp2 = adjcp(rtcm, sat, 1, ppr2 * 0.0005 / lam_carr[1]);
|
cp2 = adjcp(rtcm, sat, 1, ppr2 * 0.0005 / lam_carr[1]);
|
||||||
rtcm->obs.data[index].L[1] = pr1 / lam_carr[1] + cp2;
|
rtcm->obs.data[index].L[1] = pr1 / lam_carr[1] + cp2;
|
||||||
@ -449,7 +449,7 @@ int decode_type1004(rtcm_t *rtcm)
|
|||||||
/* get signed 38bit field ----------------------------------------------------*/
|
/* get signed 38bit field ----------------------------------------------------*/
|
||||||
double getbits_38(const unsigned char *buff, int pos)
|
double getbits_38(const unsigned char *buff, int pos)
|
||||||
{
|
{
|
||||||
return (double)getbits(buff, pos, 32) * 64.0 + getbitu(buff, pos + 32, 6);
|
return static_cast<double>(getbits(buff, pos, 32)) * 64.0 + getbitu(buff, pos + 32, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ int decode_type1007(rtcm_t *rtcm)
|
|||||||
i += 12 + 8;
|
i += 12 + 8;
|
||||||
for (j = 0; j < n && j < 31; j++)
|
for (j = 0; j < n && j < 31; j++)
|
||||||
{
|
{
|
||||||
des[j] = (char)getbitu(rtcm->buff, i, 8);
|
des[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
setup = getbitu(rtcm->buff, i, 8);
|
setup = getbitu(rtcm->buff, i, 8);
|
||||||
@ -606,14 +606,14 @@ int decode_type1008(rtcm_t *rtcm)
|
|||||||
i += 12 + 8;
|
i += 12 + 8;
|
||||||
for (j = 0; j < n && j < 31; j++)
|
for (j = 0; j < n && j < 31; j++)
|
||||||
{
|
{
|
||||||
des[j] = (char)getbitu(rtcm->buff, i, 8);
|
des[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
setup = getbitu(rtcm->buff, i, 8);
|
setup = getbitu(rtcm->buff, i, 8);
|
||||||
i += 8 + 8;
|
i += 8 + 8;
|
||||||
for (j = 0; j < m && j < 31; j++)
|
for (j = 0; j < m && j < 31; j++)
|
||||||
{
|
{
|
||||||
sno[j] = (char)getbitu(rtcm->buff, i, 8);
|
sno[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -730,7 +730,7 @@ int decode_type1010(rtcm_t *rtcm)
|
|||||||
}
|
}
|
||||||
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
||||||
pr1 = pr1 * 0.02 + amb * PRUNIT_GLO;
|
pr1 = pr1 * 0.02 + amb * PRUNIT_GLO;
|
||||||
if (ppr1 != (int)0xFFF80000)
|
if (ppr1 != static_cast<int>(0xFFF80000))
|
||||||
{
|
{
|
||||||
rtcm->obs.data[index].P[0] = pr1;
|
rtcm->obs.data[index].P[0] = pr1;
|
||||||
lam1 = SPEED_OF_LIGHT / (FREQ1_GLO + DFRQ1_GLO * (freq - 7));
|
lam1 = SPEED_OF_LIGHT / (FREQ1_GLO + DFRQ1_GLO * (freq - 7));
|
||||||
@ -804,7 +804,7 @@ int decode_type1012(rtcm_t *rtcm)
|
|||||||
}
|
}
|
||||||
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
|
||||||
pr1 = pr1 * 0.02 + amb * PRUNIT_GLO;
|
pr1 = pr1 * 0.02 + amb * PRUNIT_GLO;
|
||||||
if (ppr1 != (int)0xFFF80000)
|
if (ppr1 != static_cast<int>(0xFFF80000))
|
||||||
{
|
{
|
||||||
lam1 = SPEED_OF_LIGHT / (FREQ1_GLO + DFRQ1_GLO * (freq - 7));
|
lam1 = SPEED_OF_LIGHT / (FREQ1_GLO + DFRQ1_GLO * (freq - 7));
|
||||||
rtcm->obs.data[index].P[0] = pr1;
|
rtcm->obs.data[index].P[0] = pr1;
|
||||||
@ -815,11 +815,11 @@ int decode_type1012(rtcm_t *rtcm)
|
|||||||
rtcm->obs.data[index].SNR[0] = snratio(cnr1 * 0.25);
|
rtcm->obs.data[index].SNR[0] = snratio(cnr1 * 0.25);
|
||||||
rtcm->obs.data[index].code[0] = code1 ? CODE_L1P : CODE_L1C;
|
rtcm->obs.data[index].code[0] = code1 ? CODE_L1P : CODE_L1C;
|
||||||
|
|
||||||
if (pr21 != (int)0xFFFFE000)
|
if (pr21 != static_cast<int>(0xFFFFE000))
|
||||||
{
|
{
|
||||||
rtcm->obs.data[index].P[1] = pr1 + pr21 * 0.02;
|
rtcm->obs.data[index].P[1] = pr1 + pr21 * 0.02;
|
||||||
}
|
}
|
||||||
if (ppr2 != (int)0xFFF80000)
|
if (ppr2 != static_cast<int>(0xFFF80000))
|
||||||
{
|
{
|
||||||
lam2 = SPEED_OF_LIGHT / (FREQ2_GLO + DFRQ2_GLO * (freq - 7));
|
lam2 = SPEED_OF_LIGHT / (FREQ2_GLO + DFRQ2_GLO * (freq - 7));
|
||||||
cp2 = adjcp(rtcm, sat, 1, ppr2 * 0.0005 / lam2);
|
cp2 = adjcp(rtcm, sat, 1, ppr2 * 0.0005 / lam2);
|
||||||
@ -1189,32 +1189,32 @@ int decode_type1033(rtcm_t *rtcm)
|
|||||||
i += 12 + 8;
|
i += 12 + 8;
|
||||||
for (j = 0; j < n && j < 31; j++)
|
for (j = 0; j < n && j < 31; j++)
|
||||||
{
|
{
|
||||||
des[j] = (char)getbitu(rtcm->buff, i, 8);
|
des[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
setup = getbitu(rtcm->buff, i, 8);
|
setup = getbitu(rtcm->buff, i, 8);
|
||||||
i += 8 + 8;
|
i += 8 + 8;
|
||||||
for (j = 0; j < m && j < 31; j++)
|
for (j = 0; j < m && j < 31; j++)
|
||||||
{
|
{
|
||||||
sno[j] = (char)getbitu(rtcm->buff, i, 8);
|
sno[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
i += 8;
|
i += 8;
|
||||||
for (j = 0; j < n1 && j < 31; j++)
|
for (j = 0; j < n1 && j < 31; j++)
|
||||||
{
|
{
|
||||||
rec[j] = (char)getbitu(rtcm->buff, i, 8);
|
rec[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
i += 8;
|
i += 8;
|
||||||
for (j = 0; j < n2 && j < 31; j++)
|
for (j = 0; j < n2 && j < 31; j++)
|
||||||
{
|
{
|
||||||
ver[j] = (char)getbitu(rtcm->buff, i, 8);
|
ver[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
i += 8;
|
i += 8;
|
||||||
for (j = 0; j < n3 && j < 31; j++)
|
for (j = 0; j < n3 && j < 31; j++)
|
||||||
{
|
{
|
||||||
rsn[j] = (char)getbitu(rtcm->buff, i, 8);
|
rsn[j] = static_cast<char>(getbitu(rtcm->buff, i, 8));
|
||||||
i += 8;
|
i += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2222,7 +2222,7 @@ int decode_ssr3(rtcm_t *rtcm, int sys)
|
|||||||
i += 14;
|
i += 14;
|
||||||
if (mode <= ncode)
|
if (mode <= ncode)
|
||||||
{
|
{
|
||||||
cbias[codes[mode] - 1] = (float)bias;
|
cbias[codes[mode] - 1] = static_cast<float>(bias);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2240,7 +2240,7 @@ int decode_ssr3(rtcm_t *rtcm, int sys)
|
|||||||
|
|
||||||
for (k = 0; k < MAXCODE; k++)
|
for (k = 0; k < MAXCODE; k++)
|
||||||
{
|
{
|
||||||
rtcm->ssr[sat - 1].cbias[k] = (float)cbias[k];
|
rtcm->ssr[sat - 1].cbias[k] = static_cast<float>(cbias[k]);
|
||||||
}
|
}
|
||||||
rtcm->ssr[sat - 1].update = 1;
|
rtcm->ssr[sat - 1].update = 1;
|
||||||
}
|
}
|
||||||
@ -2579,7 +2579,7 @@ int decode_ssr7(rtcm_t *rtcm, int sys)
|
|||||||
for (k = 0; k < MAXCODE; k++)
|
for (k = 0; k < MAXCODE; k++)
|
||||||
{
|
{
|
||||||
rtcm->ssr[sat - 1].pbias[k] = pbias[k];
|
rtcm->ssr[sat - 1].pbias[k] = pbias[k];
|
||||||
rtcm->ssr[sat - 1].stdpb[k] = (float)stdpb[k];
|
rtcm->ssr[sat - 1].stdpb[k] = static_cast<float>(stdpb[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 20;
|
return 20;
|
||||||
@ -2773,11 +2773,11 @@ void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r,
|
|||||||
/* doppler (hz) */
|
/* doppler (hz) */
|
||||||
if (rr && rrf && rrf[j] > -1E12 && wl > 0.0)
|
if (rr && rrf && rrf[j] > -1E12 && wl > 0.0)
|
||||||
{
|
{
|
||||||
rtcm->obs.data[index].D[ind[k]] = (float)(-(rr[i] + rrf[j]) / wl);
|
rtcm->obs.data[index].D[ind[k]] = static_cast<float>(-(rr[i] + rrf[j]) / wl);
|
||||||
}
|
}
|
||||||
rtcm->obs.data[index].LLI[ind[k]] =
|
rtcm->obs.data[index].LLI[ind[k]] =
|
||||||
lossoflock(rtcm, sat, ind[k], lock[j]) + (half[j] ? 3 : 0);
|
lossoflock(rtcm, sat, ind[k], lock[j]) + (half[j] ? 3 : 0);
|
||||||
rtcm->obs.data[index].SNR[ind[k]] = (unsigned char)(cnr[j] * 4.0);
|
rtcm->obs.data[index].SNR[ind[k]] = static_cast<unsigned char>(cnr[j] * 4.0);
|
||||||
rtcm->obs.data[index].code[ind[k]] = code[k];
|
rtcm->obs.data[index].code[ind[k]] = code[k];
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
|
@ -153,7 +153,7 @@ char codepris[7][MAXFREQ][16] = {
|
|||||||
fatalfunc_t *fatalfunc = nullptr; /* fatal callback function */
|
fatalfunc_t *fatalfunc = nullptr; /* fatal callback function */
|
||||||
|
|
||||||
/* crc tables generated by util/gencrc ---------------------------------------*/
|
/* crc tables generated by util/gencrc ---------------------------------------*/
|
||||||
const unsigned short tbl_CRC16[] = {
|
const uint16_t tbl_CRC16[] = {
|
||||||
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
|
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
|
||||||
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
|
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
|
||||||
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
|
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
|
||||||
@ -519,7 +519,7 @@ int testsnr(int base, int freq, double el, double snr,
|
|||||||
if (!mask->ena[base] || freq < 0 || freq >= NFREQ) return 0;
|
if (!mask->ena[base] || freq < 0 || freq >= NFREQ) return 0;
|
||||||
|
|
||||||
a = (el * R2D + 5.0) / 10.0;
|
a = (el * R2D + 5.0) / 10.0;
|
||||||
i = (int)floor(a);
|
i = static_cast<int>(floor(a));
|
||||||
a -= i;
|
a -= i;
|
||||||
if (i < 1)
|
if (i < 1)
|
||||||
minsnr = mask->mask[freq][0];
|
minsnr = mask->mask[freq][0];
|
||||||
@ -546,9 +546,9 @@ unsigned char obs2code(const char *obs, int *freq)
|
|||||||
if (freq) *freq = 0;
|
if (freq) *freq = 0;
|
||||||
for (i = 1; *obscodes[i]; i++)
|
for (i = 1; *obscodes[i]; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(obscodes[i], obs)) continue;
|
if (strcmp(obscodes[i], obs) != 0) continue;
|
||||||
if (freq) *freq = obsfreqs[i];
|
if (freq) *freq = obsfreqs[i];
|
||||||
return (unsigned char)i;
|
return static_cast<unsigned char>(i);
|
||||||
}
|
}
|
||||||
return CODE_NONE;
|
return CODE_NONE;
|
||||||
}
|
}
|
||||||
@ -657,7 +657,7 @@ int getcodepri(int sys, unsigned char code, const char *opt)
|
|||||||
return str[1] == obs[1] ? 15 : 0;
|
return str[1] == obs[1] ? 15 : 0;
|
||||||
}
|
}
|
||||||
/* search code priority */
|
/* search code priority */
|
||||||
return (p = strchr(codepris[i][j - 1], obs[1])) ? 14 - (int)(p - codepris[i][j - 1]) : 0;
|
return (p = strchr(codepris[i][j - 1], obs[1])) ? 14 - static_cast<int>(p - codepris[i][j - 1]) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -680,8 +680,8 @@ unsigned int getbitu(const unsigned char *buff, int pos, int len)
|
|||||||
int getbits(const unsigned char *buff, int pos, int len)
|
int getbits(const unsigned char *buff, int pos, int len)
|
||||||
{
|
{
|
||||||
unsigned int bits = getbitu(buff, pos, len);
|
unsigned int bits = getbitu(buff, pos, len);
|
||||||
if (len <= 0 || 32 <= len || !(bits & (1u << (len - 1)))) return (int)bits;
|
if (len <= 0 || 32 <= len || !(bits & (1u << (len - 1)))) return static_cast<int>(bits);
|
||||||
return (int)(bits | (~0u << len)); /* extend sign */
|
return static_cast<int>(bits | (~0u << len)); /* extend sign */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ void setbits(unsigned char *buff, int pos, int len, int data)
|
|||||||
data |= 1 << (len - 1);
|
data |= 1 << (len - 1);
|
||||||
else
|
else
|
||||||
data &= ~(1 << (len - 1)); /* set sign bit */
|
data &= ~(1 << (len - 1)); /* set sign bit */
|
||||||
setbitu(buff, pos, len, (unsigned int)data);
|
setbitu(buff, pos, len, static_cast<unsigned int>(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -773,9 +773,9 @@ unsigned int rtk_crc24q(const unsigned char *buff, int len)
|
|||||||
* return : crc-16 parity
|
* return : crc-16 parity
|
||||||
* notes : see reference [10] A.3.
|
* notes : see reference [10] A.3.
|
||||||
*-----------------------------------------------------------------------------*/
|
*-----------------------------------------------------------------------------*/
|
||||||
unsigned short rtk_crc16(const unsigned char *buff, int len)
|
uint16_t rtk_crc16(const unsigned char *buff, int len)
|
||||||
{
|
{
|
||||||
unsigned short crc = 0;
|
uint16_t crc = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
trace(4, "rtk_crc16: len=%d\n", len);
|
trace(4, "rtk_crc16: len=%d\n", len);
|
||||||
@ -815,7 +815,7 @@ int decode_word(unsigned int word, unsigned char *data)
|
|||||||
}
|
}
|
||||||
if (parity != (word & 0x3F)) return 0;
|
if (parity != (word & 0x3F)) return 0;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) data[i] = (unsigned char)(word >> (22 - i * 8));
|
for (i = 0; i < 3; i++) data[i] = static_cast<unsigned char>(word >> (22 - i * 8));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,7 +830,7 @@ double *mat(int n, int m)
|
|||||||
double *p;
|
double *p;
|
||||||
|
|
||||||
if (n <= 0 || m <= 0) return nullptr;
|
if (n <= 0 || m <= 0) return nullptr;
|
||||||
if (!(p = (double *)malloc(sizeof(double) * n * m)))
|
if (!(p = static_cast<double *>(malloc(sizeof(double) * n * m))))
|
||||||
{
|
{
|
||||||
fatalerr("matrix memory allocation error: n=%d,m=%d\n", n, m);
|
fatalerr("matrix memory allocation error: n=%d,m=%d\n", n, m);
|
||||||
}
|
}
|
||||||
@ -848,7 +848,7 @@ int *imat(int n, int m)
|
|||||||
int *p;
|
int *p;
|
||||||
|
|
||||||
if (n <= 0 || m <= 0) return nullptr;
|
if (n <= 0 || m <= 0) return nullptr;
|
||||||
if (!(p = (int *)malloc(sizeof(int) * n * m)))
|
if (!(p = static_cast<int *>(malloc(sizeof(int) * n * m))))
|
||||||
{
|
{
|
||||||
fatalerr("integer matrix memory allocation error: n=%d,m=%d\n", n, m);
|
fatalerr("integer matrix memory allocation error: n=%d,m=%d\n", n, m);
|
||||||
}
|
}
|
||||||
@ -870,7 +870,7 @@ double *zeros(int n, int m)
|
|||||||
for (n = n * m - 1; n >= 0; n--) p[n] = 0.0;
|
for (n = n * m - 1; n >= 0; n--) p[n] = 0.0;
|
||||||
#else
|
#else
|
||||||
if (n <= 0 || m <= 0) return nullptr;
|
if (n <= 0 || m <= 0) return nullptr;
|
||||||
if (!(p = (double *)calloc(sizeof(double), n * m)))
|
if (!(p = static_cast<double *>(calloc(sizeof(double), n * m))))
|
||||||
{
|
{
|
||||||
fatalerr("matrix memory allocation error: n=%d,m=%d\n", n, m);
|
fatalerr("matrix memory allocation error: n=%d,m=%d\n", n, m);
|
||||||
}
|
}
|
||||||
@ -983,7 +983,7 @@ void matmul(const char *tr, int n, int k, int m, double alpha,
|
|||||||
{
|
{
|
||||||
int lda = tr[0] == 'T' ? m : n, ldb = tr[1] == 'T' ? k : m;
|
int lda = tr[0] == 'T' ? m : n, ldb = tr[1] == 'T' ? k : m;
|
||||||
|
|
||||||
dgemm_((char *)tr, (char *)tr + 1, &n, &k, &m, &alpha, (double *)A, &lda, (double *)B,
|
dgemm_(const_cast<char *>(tr), const_cast<char *>(tr) + 1, &n, &k, &m, &alpha, const_cast<double *>(A), &lda, const_cast<double *>(B),
|
||||||
&ldb, &beta, C, &n);
|
&ldb, &beta, C, &n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1028,7 +1028,7 @@ int solve(const char *tr, const double *A, const double *Y, int n,
|
|||||||
matcpy(B, A, n, n);
|
matcpy(B, A, n, n);
|
||||||
matcpy(X, Y, n, m);
|
matcpy(X, Y, n, m);
|
||||||
dgetrf_(&n, &n, B, &n, ipiv, &info);
|
dgetrf_(&n, &n, B, &n, ipiv, &info);
|
||||||
if (!info) dgetrs_((char *)tr, &n, &m, B, &n, ipiv, X, &n, &info);
|
if (!info) dgetrs_(const_cast<char *>(tr), &n, &m, B, &n, ipiv, X, &n, &info);
|
||||||
free(ipiv);
|
free(ipiv);
|
||||||
free(B);
|
free(B);
|
||||||
return info;
|
return info;
|
||||||
@ -1239,7 +1239,7 @@ double str2num(const char *s, int i, int n)
|
|||||||
double value;
|
double value;
|
||||||
char str[256], *p = str;
|
char str[256], *p = str;
|
||||||
|
|
||||||
if (i < 0 || (int)strlen(s) < i || (int)sizeof(str) - 1 < n) return 0.0;
|
if (i < 0 || static_cast<int>(strlen(s)) < i || static_cast<int>(sizeof(str)) - 1 < n) return 0.0;
|
||||||
for (s += i; *s && --n >= 0; s++)
|
for (s += i; *s && --n >= 0; s++)
|
||||||
{
|
{
|
||||||
*p++ = *s == 'd' || *s == 'D' ? 'E' : *s;
|
*p++ = *s == 'd' || *s == 'D' ? 'E' : *s;
|
||||||
@ -1261,7 +1261,7 @@ int str2time(const char *s, int i, int n, gtime_t *t)
|
|||||||
double ep[6];
|
double ep[6];
|
||||||
char str[256], *p = str;
|
char str[256], *p = str;
|
||||||
|
|
||||||
if (i < 0 || (int)strlen(s) < i || (int)sizeof(str) - 1 < i) return -1;
|
if (i < 0 || static_cast<int>(strlen(s)) < i || static_cast<int>(sizeof(str)) - 1 < i) return -1;
|
||||||
for (s += i; *s && --n >= 0;)
|
for (s += i; *s && --n >= 0;)
|
||||||
{
|
{
|
||||||
*p++ = *s++;
|
*p++ = *s++;
|
||||||
@ -1285,14 +1285,14 @@ gtime_t epoch2time(const double *ep)
|
|||||||
{
|
{
|
||||||
const int doy[] = {1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
|
const int doy[] = {1, 32, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
|
||||||
gtime_t time = {0, 0};
|
gtime_t time = {0, 0};
|
||||||
int days, sec, year = (int)ep[0], mon = (int)ep[1], day = (int)ep[2];
|
int days, sec, year = static_cast<int>(ep[0]), mon = static_cast<int>(ep[1]), day = static_cast<int>(ep[2]);
|
||||||
|
|
||||||
if (year < 1970 || 2099 < year || mon < 1 || 12 < mon) return time;
|
if (year < 1970 || 2099 < year || mon < 1 || 12 < mon) return time;
|
||||||
|
|
||||||
/* leap year if year%4==0 in 1901-2099 */
|
/* leap year if year%4==0 in 1901-2099 */
|
||||||
days = (year - 1970) * 365 + (year - 1969) / 4 + doy[mon - 1] + day - 2 + (year % 4 == 0 && mon >= 3 ? 1 : 0);
|
days = (year - 1970) * 365 + (year - 1969) / 4 + doy[mon - 1] + day - 2 + (year % 4 == 0 && mon >= 3 ? 1 : 0);
|
||||||
sec = (int)floor(ep[5]);
|
sec = static_cast<int>(floor(ep[5]));
|
||||||
time.time = (time_t)days * 86400 + (int)ep[3] * 3600 + (int)ep[4] * 60 + sec;
|
time.time = static_cast<time_t>(days) * 86400 + static_cast<int>(ep[3]) * 3600 + static_cast<int>(ep[4]) * 60 + sec;
|
||||||
time.sec = ep[5] - sec;
|
time.sec = ep[5] - sec;
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
@ -1313,8 +1313,8 @@ void time2epoch(gtime_t t, double *ep)
|
|||||||
int days, sec, mon, day;
|
int days, sec, mon, day;
|
||||||
|
|
||||||
/* leap year if year%4==0 in 1901-2099 */
|
/* leap year if year%4==0 in 1901-2099 */
|
||||||
days = (int)(t.time / 86400);
|
days = static_cast<int>(t.time / 86400);
|
||||||
sec = (int)(t.time - (time_t)days * 86400);
|
sec = static_cast<int>(t.time - static_cast<time_t>(days) * 86400);
|
||||||
for (day = days % 1461, mon = 0; mon < 48; mon++)
|
for (day = days % 1461, mon = 0; mon < 48; mon++)
|
||||||
{
|
{
|
||||||
if (day >= mday[mon])
|
if (day >= mday[mon])
|
||||||
@ -1342,8 +1342,8 @@ gtime_t gpst2time(int week, double sec)
|
|||||||
gtime_t t = epoch2time(gpst0);
|
gtime_t t = epoch2time(gpst0);
|
||||||
|
|
||||||
if (sec < -1e9 || 1e9 < sec) sec = 0.0;
|
if (sec < -1e9 || 1e9 < sec) sec = 0.0;
|
||||||
t.time += (time_t)86400 * 7 * week + (int)sec;
|
t.time += static_cast<time_t>(86400) * 7 * week + static_cast<int>(sec);
|
||||||
t.sec = sec - (int)sec;
|
t.sec = sec - static_cast<int>(sec);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1376,8 +1376,8 @@ gtime_t gst2time(int week, double sec)
|
|||||||
gtime_t t = epoch2time(gst0);
|
gtime_t t = epoch2time(gst0);
|
||||||
|
|
||||||
if (sec < -1e9 || 1e9 < sec) sec = 0.0;
|
if (sec < -1e9 || 1e9 < sec) sec = 0.0;
|
||||||
t.time += (time_t)86400 * 7 * week + (int)sec;
|
t.time += static_cast<time_t>(86400) * 7 * week + static_cast<int>(sec);
|
||||||
t.sec = sec - (int)sec;
|
t.sec = sec - static_cast<int>(sec);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1392,10 +1392,10 @@ double time2gst(gtime_t t, int *week)
|
|||||||
{
|
{
|
||||||
gtime_t t0 = epoch2time(gst0);
|
gtime_t t0 = epoch2time(gst0);
|
||||||
time_t sec = t.time - t0.time;
|
time_t sec = t.time - t0.time;
|
||||||
int w = (int)(sec / (86400 * 7));
|
int w = static_cast<int>(sec / (86400 * 7));
|
||||||
|
|
||||||
if (week) *week = w;
|
if (week) *week = w;
|
||||||
return (double)(sec - (double)w * 86400 * 7) + t.sec;
|
return (sec - static_cast<double>(w) * 86400 * 7) + t.sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1410,8 +1410,8 @@ gtime_t bdt2time(int week, double sec)
|
|||||||
gtime_t t = epoch2time(bdt0);
|
gtime_t t = epoch2time(bdt0);
|
||||||
|
|
||||||
if (sec < -1e9 || 1e9 < sec) sec = 0.0;
|
if (sec < -1e9 || 1e9 < sec) sec = 0.0;
|
||||||
t.time += (time_t)86400 * 7 * week + (int)sec;
|
t.time += static_cast<time_t>(86400) * 7 * week + static_cast<int>(sec);
|
||||||
t.sec = sec - (int)sec;
|
t.sec = sec - static_cast<int>(sec);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,10 +1426,10 @@ double time2bdt(gtime_t t, int *week)
|
|||||||
{
|
{
|
||||||
gtime_t t0 = epoch2time(bdt0);
|
gtime_t t0 = epoch2time(bdt0);
|
||||||
time_t sec = t.time - t0.time;
|
time_t sec = t.time - t0.time;
|
||||||
int w = (int)(sec / (86400 * 7));
|
int w = static_cast<int>(sec / (86400 * 7));
|
||||||
|
|
||||||
if (week) *week = w;
|
if (week) *week = w;
|
||||||
return (double)(sec - (double)w * 86400 * 7) + t.sec;
|
return (sec - static_cast<double>(w) * 86400 * 7) + t.sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1445,7 +1445,7 @@ gtime_t timeadd(gtime_t t, double sec)
|
|||||||
|
|
||||||
t.sec += sec;
|
t.sec += sec;
|
||||||
tt = floor(t.sec);
|
tt = floor(t.sec);
|
||||||
t.time += (int)tt;
|
t.time += static_cast<int>(tt);
|
||||||
t.sec -= tt;
|
t.sec -= tt;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -1471,7 +1471,7 @@ gtime_t timeget(void)
|
|||||||
{
|
{
|
||||||
gtime_t time;
|
gtime_t time;
|
||||||
double ep[6] = {};
|
double ep[6] = {};
|
||||||
struct timeval tv;
|
struct timeval tv{};
|
||||||
struct tm *tt;
|
struct tm *tt;
|
||||||
|
|
||||||
if (!gettimeofday(&tv, nullptr) && (tt = gmtime(&tv.tv_sec)))
|
if (!gettimeofday(&tv, nullptr) && (tt = gmtime(&tv.tv_sec)))
|
||||||
@ -1547,7 +1547,7 @@ int read_leaps_usno(FILE *fp)
|
|||||||
ls[n][0] = y;
|
ls[n][0] = y;
|
||||||
ls[n][1] = m;
|
ls[n][1] = m;
|
||||||
ls[n][2] = d;
|
ls[n][2] = d;
|
||||||
ls[n++][6] = (char)(19.0 - tai_utc);
|
ls[n++][6] = static_cast<char>(19.0 - tai_utc);
|
||||||
}
|
}
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
for (j = 0; j < 7; j++)
|
for (j = 0; j < 7; j++)
|
||||||
@ -1574,7 +1574,7 @@ int read_leaps(const char *file)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r"))) return 0;
|
if (!(fp = fopen(file, "re"))) return 0;
|
||||||
|
|
||||||
/* read leap seconds table by text or usno */
|
/* read leap seconds table by text or usno */
|
||||||
if (!(n = read_leaps_text(fp)) && !(n = read_leaps_usno(fp)))
|
if (!(n = read_leaps_text(fp)) && !(n = read_leaps_usno(fp)))
|
||||||
@ -1794,8 +1794,8 @@ void sleepms(int ms)
|
|||||||
{
|
{
|
||||||
struct timespec ts = {0, 0};
|
struct timespec ts = {0, 0};
|
||||||
if (ms <= 0) return;
|
if (ms <= 0) return;
|
||||||
ts.tv_sec = (time_t)(ms / 1000);
|
ts.tv_sec = static_cast<time_t>(ms / 1000);
|
||||||
ts.tv_nsec = (long)(ms % 1000 * 1000000);
|
ts.tv_nsec = static_cast<int64_t>(ms % 1000 * 1000000);
|
||||||
nanosleep(&ts, nullptr);
|
nanosleep(&ts, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2242,7 +2242,7 @@ void addpcv(const pcv_t *pcv, pcvs_t *pcvs)
|
|||||||
if (pcvs->nmax <= pcvs->n)
|
if (pcvs->nmax <= pcvs->n)
|
||||||
{
|
{
|
||||||
pcvs->nmax += 256;
|
pcvs->nmax += 256;
|
||||||
if (!(pcvs_pcv = (pcv_t *)realloc(pcvs->pcv, sizeof(pcv_t) * pcvs->nmax)))
|
if (!(pcvs_pcv = static_cast<pcv_t *>(realloc(pcvs->pcv, sizeof(pcv_t) * pcvs->nmax))))
|
||||||
{
|
{
|
||||||
trace(1, "addpcv: memory allocation error\n");
|
trace(1, "addpcv: memory allocation error\n");
|
||||||
free(pcvs->pcv);
|
free(pcvs->pcv);
|
||||||
@ -2266,7 +2266,7 @@ int readngspcv(const char *file, pcvs_t *pcvs)
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
char buff[256];
|
char buff[256];
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
trace(2, "ngs pcv file open error: %s\n", file);
|
trace(2, "ngs pcv file open error: %s\n", file);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2327,7 +2327,7 @@ int readantex(const char *file, pcvs_t *pcvs)
|
|||||||
|
|
||||||
trace(3, "readantex: file=%s\n", file);
|
trace(3, "readantex: file=%s\n", file);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
trace(2, "antex pcv file open error: %s\n", file);
|
trace(2, "antex pcv file open error: %s\n", file);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2521,7 +2521,7 @@ void readpos(const char *file, const char *rcv, double *pos)
|
|||||||
|
|
||||||
trace(3, "readpos: file=%s\n", file);
|
trace(3, "readpos: file=%s\n", file);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "reference position file open error : %s\n", file);
|
fprintf(stderr, "reference position file open error : %s\n", file);
|
||||||
return;
|
return;
|
||||||
@ -2536,10 +2536,10 @@ void readpos(const char *file, const char *rcv, double *pos)
|
|||||||
stas[np++][15] = '\0';
|
stas[np++][15] = '\0';
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
len = (int)strlen(rcv);
|
len = static_cast<int>(strlen(rcv));
|
||||||
for (i = 0; i < np; i++)
|
for (i = 0; i < np; i++)
|
||||||
{
|
{
|
||||||
if (strncmp(stas[i], rcv, len)) continue;
|
if (strncmp(stas[i], rcv, len) != 0) continue;
|
||||||
for (j = 0; j < 3; j++) pos[j] = poss[i][j];
|
for (j = 0; j < 3; j++) pos[j] = poss[i][j];
|
||||||
pos[0] *= D2R;
|
pos[0] *= D2R;
|
||||||
pos[1] *= D2R;
|
pos[1] *= D2R;
|
||||||
@ -2582,10 +2582,10 @@ int readblq(const char *file, const char *sta, double *odisp)
|
|||||||
|
|
||||||
/* station name to upper case */
|
/* station name to upper case */
|
||||||
sscanf(sta, "%16s", staname);
|
sscanf(sta, "%16s", staname);
|
||||||
for (p = staname; (*p = (char)toupper((int)(*p))); p++)
|
for (p = staname; (*p = static_cast<char>(toupper(static_cast<int>(*p)))); p++)
|
||||||
;
|
;
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
trace(2, "blq file open error: file=%s\n", file);
|
trace(2, "blq file open error: file=%s\n", file);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2595,9 +2595,9 @@ int readblq(const char *file, const char *sta, double *odisp)
|
|||||||
if (!strncmp(buff, "$$", 2) || strlen(buff) < 2) continue;
|
if (!strncmp(buff, "$$", 2) || strlen(buff) < 2) continue;
|
||||||
|
|
||||||
if (sscanf(buff + 2, "%16s", name) < 1) continue;
|
if (sscanf(buff + 2, "%16s", name) < 1) continue;
|
||||||
for (p = name; (*p = (char)toupper((int)(*p))); p++)
|
for (p = name; (*p = static_cast<char>(toupper(static_cast<int>(*p)))); p++)
|
||||||
;
|
;
|
||||||
if (strcmp(name, staname)) continue;
|
if (strcmp(name, staname) != 0) continue;
|
||||||
|
|
||||||
/* read blq record */
|
/* read blq record */
|
||||||
if (readblqrecord(fp, odisp))
|
if (readblqrecord(fp, odisp))
|
||||||
@ -2627,7 +2627,7 @@ int readerp(const char *file, erp_t *erp)
|
|||||||
|
|
||||||
trace(3, "readerp: file=%s\n", file);
|
trace(3, "readerp: file=%s\n", file);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
trace(2, "erp file open error: file=%s\n", file);
|
trace(2, "erp file open error: file=%s\n", file);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2642,7 +2642,7 @@ int readerp(const char *file, erp_t *erp)
|
|||||||
if (erp->n >= erp->nmax)
|
if (erp->n >= erp->nmax)
|
||||||
{
|
{
|
||||||
erp->nmax = erp->nmax <= 0 ? 128 : erp->nmax * 2;
|
erp->nmax = erp->nmax <= 0 ? 128 : erp->nmax * 2;
|
||||||
erp_data = (erpd_t *)realloc(erp->data, sizeof(erpd_t) * erp->nmax);
|
erp_data = static_cast<erpd_t *>(realloc(erp->data, sizeof(erpd_t) * erp->nmax));
|
||||||
if (!erp_data)
|
if (!erp_data)
|
||||||
{
|
{
|
||||||
free(erp->data);
|
free(erp->data);
|
||||||
@ -2730,7 +2730,7 @@ int geterp(const erp_t *erp, gtime_t time, double *erpv)
|
|||||||
int cmpeph(const void *p1, const void *p2)
|
int cmpeph(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
auto *q1 = (eph_t *)p1, *q2 = (eph_t *)p2;
|
auto *q1 = (eph_t *)p1, *q2 = (eph_t *)p2;
|
||||||
return q1->ttr.time != q2->ttr.time ? (int)(q1->ttr.time - q2->ttr.time) : (q1->toe.time != q2->toe.time ? (int)(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
|
return q1->ttr.time != q2->ttr.time ? static_cast<int>(q1->ttr.time - q2->ttr.time) : (q1->toe.time != q2->toe.time ? static_cast<int>(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2756,7 +2756,7 @@ void uniqeph(nav_t *nav)
|
|||||||
}
|
}
|
||||||
nav->n = j + 1;
|
nav->n = j + 1;
|
||||||
|
|
||||||
if (!(nav_eph = (eph_t *)realloc(nav->eph, sizeof(eph_t) * nav->n)))
|
if (!(nav_eph = static_cast<eph_t *>(realloc(nav->eph, sizeof(eph_t) * nav->n))))
|
||||||
{
|
{
|
||||||
trace(1, "uniqeph malloc error n=%d\n", nav->n);
|
trace(1, "uniqeph malloc error n=%d\n", nav->n);
|
||||||
free(nav->eph);
|
free(nav->eph);
|
||||||
@ -2775,7 +2775,7 @@ void uniqeph(nav_t *nav)
|
|||||||
int cmpgeph(const void *p1, const void *p2)
|
int cmpgeph(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
auto *q1 = (geph_t *)p1, *q2 = (geph_t *)p2;
|
auto *q1 = (geph_t *)p1, *q2 = (geph_t *)p2;
|
||||||
return q1->tof.time != q2->tof.time ? (int)(q1->tof.time - q2->tof.time) : (q1->toe.time != q2->toe.time ? (int)(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
|
return q1->tof.time != q2->tof.time ? static_cast<int>(q1->tof.time - q2->tof.time) : (q1->toe.time != q2->toe.time ? static_cast<int>(q1->toe.time - q2->toe.time) : q1->sat - q2->sat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2802,7 +2802,7 @@ void uniqgeph(nav_t *nav)
|
|||||||
}
|
}
|
||||||
nav->ng = j + 1;
|
nav->ng = j + 1;
|
||||||
|
|
||||||
if (!(nav_geph = (geph_t *)realloc(nav->geph, sizeof(geph_t) * nav->ng)))
|
if (!(nav_geph = static_cast<geph_t *>(realloc(nav->geph, sizeof(geph_t) * nav->ng))))
|
||||||
{
|
{
|
||||||
trace(1, "uniqgeph malloc error ng=%d\n", nav->ng);
|
trace(1, "uniqgeph malloc error ng=%d\n", nav->ng);
|
||||||
free(nav->geph);
|
free(nav->geph);
|
||||||
@ -2821,7 +2821,7 @@ void uniqgeph(nav_t *nav)
|
|||||||
int cmpseph(const void *p1, const void *p2)
|
int cmpseph(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
auto *q1 = (seph_t *)p1, *q2 = (seph_t *)p2;
|
auto *q1 = (seph_t *)p1, *q2 = (seph_t *)p2;
|
||||||
return q1->tof.time != q2->tof.time ? (int)(q1->tof.time - q2->tof.time) : (q1->t0.time != q2->t0.time ? (int)(q1->t0.time - q2->t0.time) : q1->sat - q2->sat);
|
return q1->tof.time != q2->tof.time ? static_cast<int>(q1->tof.time - q2->tof.time) : (q1->t0.time != q2->t0.time ? static_cast<int>(q1->t0.time - q2->t0.time) : q1->sat - q2->sat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2847,7 +2847,7 @@ void uniqseph(nav_t *nav)
|
|||||||
}
|
}
|
||||||
nav->ns = j + 1;
|
nav->ns = j + 1;
|
||||||
|
|
||||||
if (!(nav_seph = (seph_t *)realloc(nav->seph, sizeof(seph_t) * nav->ns)))
|
if (!(nav_seph = static_cast<seph_t *>(realloc(nav->seph, sizeof(seph_t) * nav->ns))))
|
||||||
{
|
{
|
||||||
trace(1, "uniqseph malloc error ns=%d\n", nav->ns);
|
trace(1, "uniqseph malloc error ns=%d\n", nav->ns);
|
||||||
free(nav->seph);
|
free(nav->seph);
|
||||||
@ -2893,8 +2893,8 @@ int cmpobs(const void *p1, const void *p2)
|
|||||||
auto *q1 = (obsd_t *)p1, *q2 = (obsd_t *)p2;
|
auto *q1 = (obsd_t *)p1, *q2 = (obsd_t *)p2;
|
||||||
double tt = timediff(q1->time, q2->time);
|
double tt = timediff(q1->time, q2->time);
|
||||||
if (fabs(tt) > DTTOL) return tt < 0 ? -1 : 1;
|
if (fabs(tt) > DTTOL) return tt < 0 ? -1 : 1;
|
||||||
if (q1->rcv != q2->rcv) return (int)q1->rcv - (int)q2->rcv;
|
if (q1->rcv != q2->rcv) return static_cast<int>(q1->rcv) - static_cast<int>(q2->rcv);
|
||||||
return (int)q1->sat - (int)q2->sat;
|
return static_cast<int>(q1->sat) - static_cast<int>(q2->sat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2965,12 +2965,12 @@ int readnav(const char *file, nav_t *nav)
|
|||||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
|
||||||
geph_t geph0 = {0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {}, {}, {}, 0.0, 0.0, 0.0};
|
geph_t geph0 = {0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {}, {}, {}, 0.0, 0.0, 0.0};
|
||||||
char buff[4096], *p;
|
char buff[4096], *p;
|
||||||
long toe_time, tof_time, toc_time, ttr_time;
|
int32_t toe_time, tof_time, toc_time, ttr_time;
|
||||||
int i, sat, prn;
|
int i, sat, prn;
|
||||||
|
|
||||||
trace(3, "loadnav: file=%s\n", file);
|
trace(3, "loadnav: file=%s\n", file);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r"))) return 0;
|
if (!(fp = fopen(file, "re"))) return 0;
|
||||||
|
|
||||||
while (fgets(buff, sizeof(buff), fp))
|
while (fgets(buff, sizeof(buff), fp))
|
||||||
{
|
{
|
||||||
@ -2997,7 +2997,7 @@ int readnav(const char *file, nav_t *nav)
|
|||||||
nav->geph[prn - 1].sat = sat;
|
nav->geph[prn - 1].sat = sat;
|
||||||
toe_time = tof_time = 0;
|
toe_time = tof_time = 0;
|
||||||
sscanf(p + 1,
|
sscanf(p + 1,
|
||||||
"%d,%d,%d,%d,%d,%ld,%ld,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,"
|
"%d,%d,%d,%d,%d,%d,%d,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,"
|
||||||
"%lf,%lf,%lf,%lf",
|
"%lf,%lf,%lf,%lf",
|
||||||
&nav->geph[prn - 1].iode, &nav->geph[prn - 1].frq, &nav->geph[prn - 1].svh,
|
&nav->geph[prn - 1].iode, &nav->geph[prn - 1].frq, &nav->geph[prn - 1].svh,
|
||||||
&nav->geph[prn - 1].sva, &nav->geph[prn - 1].age,
|
&nav->geph[prn - 1].sva, &nav->geph[prn - 1].age,
|
||||||
@ -3015,7 +3015,7 @@ int readnav(const char *file, nav_t *nav)
|
|||||||
nav->eph[sat - 1].sat = sat;
|
nav->eph[sat - 1].sat = sat;
|
||||||
toe_time = toc_time = ttr_time = 0;
|
toe_time = toc_time = ttr_time = 0;
|
||||||
sscanf(p + 1,
|
sscanf(p + 1,
|
||||||
"%d,%d,%d,%d,%ld,%ld,%ld,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,"
|
"%d,%d,%d,%d,%d,%d,%d,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,"
|
||||||
"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%d,%d",
|
"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%d,%d",
|
||||||
&nav->eph[sat - 1].iode, &nav->eph[sat - 1].iodc, &nav->eph[sat - 1].sva,
|
&nav->eph[sat - 1].iode, &nav->eph[sat - 1].iodc, &nav->eph[sat - 1].sva,
|
||||||
&nav->eph[sat - 1].svh,
|
&nav->eph[sat - 1].svh,
|
||||||
@ -3046,7 +3046,7 @@ int savenav(const char *file, const nav_t *nav)
|
|||||||
|
|
||||||
trace(3, "savenav: file=%s\n", file);
|
trace(3, "savenav: file=%s\n", file);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "w"))) return 0;
|
if (!(fp = fopen(file, "we"))) return 0;
|
||||||
|
|
||||||
for (i = 0; i < MAXSAT; i++)
|
for (i = 0; i < MAXSAT; i++)
|
||||||
{
|
{
|
||||||
@ -3057,8 +3057,8 @@ int savenav(const char *file, const nav_t *nav)
|
|||||||
"%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
|
"%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
|
||||||
"%.14E,%.14E,%.14E,%.14E,%.14E,%d,%d\n",
|
"%.14E,%.14E,%.14E,%.14E,%.14E,%d,%d\n",
|
||||||
id, nav->eph[i].iode, nav->eph[i].iodc, nav->eph[i].sva,
|
id, nav->eph[i].iode, nav->eph[i].iodc, nav->eph[i].sva,
|
||||||
nav->eph[i].svh, (int)nav->eph[i].toe.time,
|
nav->eph[i].svh, static_cast<int>(nav->eph[i].toe.time),
|
||||||
(int)nav->eph[i].toc.time, (int)nav->eph[i].ttr.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,
|
nav->eph[i].A, nav->eph[i].e, nav->eph[i].i0, nav->eph[i].OMG0,
|
||||||
nav->eph[i].omg, nav->eph[i].M0, nav->eph[i].deln, nav->eph[i].OMGd,
|
nav->eph[i].omg, nav->eph[i].M0, nav->eph[i].deln, nav->eph[i].OMGd,
|
||||||
nav->eph[i].idot, nav->eph[i].crc, nav->eph[i].crs, nav->eph[i].cuc,
|
nav->eph[i].idot, nav->eph[i].crc, nav->eph[i].crs, nav->eph[i].cuc,
|
||||||
@ -3074,8 +3074,8 @@ int savenav(const char *file, const nav_t *nav)
|
|||||||
"%s,%d,%d,%d,%d,%d,%d,%d,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
|
"%s,%d,%d,%d,%d,%d,%d,%d,%.14E,%.14E,%.14E,%.14E,%.14E,%.14E,"
|
||||||
"%.14E,%.14E,%.14E,%.14E,%.14E,%.14E\n",
|
"%.14E,%.14E,%.14E,%.14E,%.14E,%.14E\n",
|
||||||
id, nav->geph[i].iode, nav->geph[i].frq, nav->geph[i].svh,
|
id, nav->geph[i].iode, nav->geph[i].frq, nav->geph[i].svh,
|
||||||
nav->geph[i].sva, nav->geph[i].age, (int)nav->geph[i].toe.time,
|
nav->geph[i].sva, nav->geph[i].age, static_cast<int>(nav->geph[i].toe.time),
|
||||||
(int)nav->geph[i].tof.time,
|
static_cast<int>(nav->geph[i].tof.time),
|
||||||
nav->geph[i].pos[0], nav->geph[i].pos[1], nav->geph[i].pos[2],
|
nav->geph[i].pos[0], nav->geph[i].pos[1], nav->geph[i].pos[2],
|
||||||
nav->geph[i].vel[0], nav->geph[i].vel[1], nav->geph[i].vel[2],
|
nav->geph[i].vel[0], nav->geph[i].vel[1], nav->geph[i].vel[2],
|
||||||
nav->geph[i].acc[0], nav->geph[i].acc[1], nav->geph[i].acc[2],
|
nav->geph[i].acc[0], nav->geph[i].acc[1], nav->geph[i].acc[2],
|
||||||
@ -3187,8 +3187,8 @@ void traceswap(void)
|
|||||||
|
|
||||||
rtk_lock(&lock_trace);
|
rtk_lock(&lock_trace);
|
||||||
|
|
||||||
if ((int)(time2gpst(time, nullptr) / INT_SWAP_TRAC) ==
|
if (static_cast<int>(time2gpst(time, nullptr) / INT_SWAP_TRAC) ==
|
||||||
(int)(time2gpst(time_trace, nullptr) / INT_SWAP_TRAC))
|
static_cast<int>(time2gpst(time_trace, nullptr) / INT_SWAP_TRAC))
|
||||||
{
|
{
|
||||||
rtk_unlock(&lock_trace);
|
rtk_unlock(&lock_trace);
|
||||||
return;
|
return;
|
||||||
@ -3202,7 +3202,7 @@ void traceswap(void)
|
|||||||
}
|
}
|
||||||
if (fp_trace) fclose(fp_trace);
|
if (fp_trace) fclose(fp_trace);
|
||||||
|
|
||||||
if (!(fp_trace = fopen(path, "w")))
|
if (!(fp_trace = fopen(path, "we")))
|
||||||
{
|
{
|
||||||
fp_trace = stderr;
|
fp_trace = stderr;
|
||||||
}
|
}
|
||||||
@ -3216,7 +3216,7 @@ void traceopen(const char *file)
|
|||||||
char path[1024];
|
char path[1024];
|
||||||
|
|
||||||
reppath(file, path, time, "", "");
|
reppath(file, path, time, "", "");
|
||||||
if (!*path || !(fp_trace = fopen(path, "w"))) fp_trace = stderr;
|
if (!*path || !(fp_trace = fopen(path, "we"))) fp_trace = stderr;
|
||||||
if (strlen(file) < 1025)
|
if (strlen(file) < 1025)
|
||||||
strcpy(file_trace, file);
|
strcpy(file_trace, file);
|
||||||
else
|
else
|
||||||
@ -3447,7 +3447,7 @@ void createdir(const char *path)
|
|||||||
/* replace string ------------------------------------------------------------*/
|
/* replace string ------------------------------------------------------------*/
|
||||||
int repstr(char *str, const char *pat, const char *rep)
|
int repstr(char *str, const char *pat, const char *rep)
|
||||||
{
|
{
|
||||||
int len = (int)strlen(pat);
|
int len = static_cast<int>(strlen(pat));
|
||||||
char buff[1024], *p, *q, *r;
|
char buff[1024], *p, *q, *r;
|
||||||
|
|
||||||
for (p = str, r = buff; *p; p = q + len)
|
for (p = str, r = buff; *p; p = q + len)
|
||||||
@ -3512,13 +3512,13 @@ int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
|
|||||||
{
|
{
|
||||||
time2epoch(time, ep);
|
time2epoch(time, ep);
|
||||||
ep0[0] = ep[0];
|
ep0[0] = ep[0];
|
||||||
dow = (int)floor(time2gpst(time, &week) / 86400.0);
|
dow = static_cast<int>(floor(time2gpst(time, &week) / 86400.0));
|
||||||
doy = (int)floor(timediff(time, epoch2time(ep0)) / 86400.0) + 1;
|
doy = static_cast<int>(floor(timediff(time, epoch2time(ep0)) / 86400.0)) + 1;
|
||||||
sprintf(rep, "%02d", ((int)ep[3] / 3) * 3);
|
sprintf(rep, "%02d", (static_cast<int>(ep[3]) / 3) * 3);
|
||||||
stat |= repstr(rpath, "%ha", rep);
|
stat |= repstr(rpath, "%ha", rep);
|
||||||
sprintf(rep, "%02d", ((int)ep[3] / 6) * 6);
|
sprintf(rep, "%02d", (static_cast<int>(ep[3]) / 6) * 6);
|
||||||
stat |= repstr(rpath, "%hb", rep);
|
stat |= repstr(rpath, "%hb", rep);
|
||||||
sprintf(rep, "%02d", ((int)ep[3] / 12) * 12);
|
sprintf(rep, "%02d", (static_cast<int>(ep[3]) / 12) * 12);
|
||||||
stat |= repstr(rpath, "%hc", rep);
|
stat |= repstr(rpath, "%hc", rep);
|
||||||
sprintf(rep, "%04.0f", ep[0]);
|
sprintf(rep, "%04.0f", ep[0]);
|
||||||
stat |= repstr(rpath, "%Y", rep);
|
stat |= repstr(rpath, "%Y", rep);
|
||||||
@ -3540,9 +3540,9 @@ int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
|
|||||||
stat |= repstr(rpath, "%W", rep);
|
stat |= repstr(rpath, "%W", rep);
|
||||||
sprintf(rep, "%d", dow);
|
sprintf(rep, "%d", dow);
|
||||||
stat |= repstr(rpath, "%D", rep);
|
stat |= repstr(rpath, "%D", rep);
|
||||||
sprintf(rep, "%c", 'a' + (int)ep[3]);
|
sprintf(rep, "%c", 'a' + static_cast<int>(ep[3]));
|
||||||
stat |= repstr(rpath, "%H", rep);
|
stat |= repstr(rpath, "%H", rep);
|
||||||
sprintf(rep, "%02d", ((int)ep[4] / 15) * 15);
|
sprintf(rep, "%02d", (static_cast<int>(ep[4]) / 15) * 15);
|
||||||
stat |= repstr(rpath, "%t", rep);
|
stat |= repstr(rpath, "%t", rep);
|
||||||
}
|
}
|
||||||
else if (strstr(rpath, "%ha") || strstr(rpath, "%hb") || strstr(rpath, "%hc") ||
|
else if (strstr(rpath, "%ha") || strstr(rpath, "%hb") || strstr(rpath, "%hc") ||
|
||||||
@ -3593,7 +3593,7 @@ int reppaths(const char *path, char *rpath[], int nmax, gtime_t ts,
|
|||||||
while (timediff(time, te) <= 0.0 && n < nmax)
|
while (timediff(time, te) <= 0.0 && n < nmax)
|
||||||
{
|
{
|
||||||
reppath(path, rpath[n], time, rov, base);
|
reppath(path, rpath[n], time, rov, base);
|
||||||
if (n == 0 || strcmp(rpath[n], rpath[n - 1])) n++;
|
if (n == 0 || strcmp(rpath[n], rpath[n - 1]) != 0) n++;
|
||||||
time = timeadd(time, tint);
|
time = timeadd(time, tint);
|
||||||
}
|
}
|
||||||
for (i = 0; i < n; i++) trace(3, "reppaths: rpath=%s\n", rpath[i]);
|
for (i = 0; i < n; i++) trace(3, "reppaths: rpath=%s\n", rpath[i]);
|
||||||
@ -3635,7 +3635,7 @@ double satwavelen(int sat, int frq, const nav_t *nav)
|
|||||||
return SPEED_OF_LIGHT / FREQ1_BDS; /* B1 */
|
return SPEED_OF_LIGHT / FREQ1_BDS; /* B1 */
|
||||||
if (frq == 1)
|
if (frq == 1)
|
||||||
return SPEED_OF_LIGHT / FREQ2_BDS; /* B2 */
|
return SPEED_OF_LIGHT / FREQ2_BDS; /* B2 */
|
||||||
else if (frq == 2)
|
if (frq == 2)
|
||||||
return SPEED_OF_LIGHT / FREQ3_BDS; /* B3 */
|
return SPEED_OF_LIGHT / FREQ3_BDS; /* B3 */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3644,11 +3644,11 @@ double satwavelen(int sat, int frq, const nav_t *nav)
|
|||||||
return SPEED_OF_LIGHT / FREQ1; /* L1/E1 */
|
return SPEED_OF_LIGHT / FREQ1; /* L1/E1 */
|
||||||
if (frq == 1)
|
if (frq == 1)
|
||||||
return SPEED_OF_LIGHT / FREQ2; /* L2 */
|
return SPEED_OF_LIGHT / FREQ2; /* L2 */
|
||||||
else if (frq == 2)
|
if (frq == 2)
|
||||||
return SPEED_OF_LIGHT / FREQ5; /* L5/E5a */
|
return SPEED_OF_LIGHT / FREQ5; /* L5/E5a */
|
||||||
else if (frq == 3)
|
if (frq == 3)
|
||||||
return SPEED_OF_LIGHT / FREQ6; /* L6/LEX */
|
return SPEED_OF_LIGHT / FREQ6; /* L6/LEX */
|
||||||
else if (frq == 4)
|
if (frq == 4)
|
||||||
return SPEED_OF_LIGHT / FREQ7; /* E5b */
|
return SPEED_OF_LIGHT / FREQ7; /* E5b */
|
||||||
else if (frq == 5)
|
else if (frq == 5)
|
||||||
return SPEED_OF_LIGHT / FREQ8; /* E5a+b */
|
return SPEED_OF_LIGHT / FREQ8; /* E5a+b */
|
||||||
@ -3881,7 +3881,7 @@ double tropmodel(gtime_t time __attribute__((unused)), const double *pos, const
|
|||||||
|
|
||||||
double interpc(const double coef[], double lat)
|
double interpc(const double coef[], double lat)
|
||||||
{
|
{
|
||||||
int i = (int)(lat / 15.0);
|
int i = static_cast<int>(lat / 15.0);
|
||||||
if (i < 1)
|
if (i < 1)
|
||||||
return coef[0];
|
return coef[0];
|
||||||
if (i > 4)
|
if (i > 4)
|
||||||
@ -3994,7 +3994,7 @@ double tropmapf(gtime_t time, const double pos[], const double azel[],
|
|||||||
double interpvar(double ang, const double *var)
|
double interpvar(double ang, const double *var)
|
||||||
{
|
{
|
||||||
double a = ang / 5.0; /* ang=0-90 */
|
double a = ang / 5.0; /* ang=0-90 */
|
||||||
int i = (int)a;
|
int i = static_cast<int>(a);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return var[0];
|
return var[0];
|
||||||
if (i >= 18)
|
if (i >= 18)
|
||||||
@ -4307,8 +4307,8 @@ int expath(const char *path, char *paths[], int nmax)
|
|||||||
if (*(d->d_name) == '.') continue;
|
if (*(d->d_name) == '.') continue;
|
||||||
sprintf(s1, "^%s$", d->d_name);
|
sprintf(s1, "^%s$", d->d_name);
|
||||||
sprintf(s2, "^%s$", file);
|
sprintf(s2, "^%s$", file);
|
||||||
for (p = s1; *p; p++) *p = (char)tolower((int)*p);
|
for (p = s1; *p; p++) *p = static_cast<char>(tolower(static_cast<int>(*p)));
|
||||||
for (p = s2; *p; p++) *p = (char)tolower((int)*p);
|
for (p = s2; *p; p++) *p = static_cast<char>(tolower(static_cast<int>(*p)));
|
||||||
|
|
||||||
for (p = s1, q = strtok_r(s2, "*", &r); q; q = strtok_r(nullptr, "*", &r))
|
for (p = s1, q = strtok_r(s2, "*", &r); q; q = strtok_r(nullptr, "*", &r))
|
||||||
{
|
{
|
||||||
|
@ -151,7 +151,7 @@ int rtkopenstat(const char *file, int level)
|
|||||||
|
|
||||||
reppath(file, path, time, "", "");
|
reppath(file, path, time, "", "");
|
||||||
|
|
||||||
if (!(fp_stat = fopen(path, "w")))
|
if (!(fp_stat = fopen(path, "we")))
|
||||||
{
|
{
|
||||||
trace(1, "rtkopenstat: file open error path=%s\n", path);
|
trace(1, "rtkopenstat: file open error path=%s\n", path);
|
||||||
return 0;
|
return 0;
|
||||||
@ -301,8 +301,8 @@ void swapsolstat(void)
|
|||||||
gtime_t time = utc2gpst(timeget());
|
gtime_t time = utc2gpst(timeget());
|
||||||
char path[1024];
|
char path[1024];
|
||||||
|
|
||||||
if ((int)(time2gpst(time, nullptr) / INT_SWAP_STAT) ==
|
if (static_cast<int>(time2gpst(time, nullptr) / INT_SWAP_STAT) ==
|
||||||
(int)(time2gpst(time_stat, nullptr) / INT_SWAP_STAT))
|
static_cast<int>(time2gpst(time_stat, nullptr) / INT_SWAP_STAT))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ void swapsolstat(void)
|
|||||||
}
|
}
|
||||||
if (fp_stat) fclose(fp_stat);
|
if (fp_stat) fclose(fp_stat);
|
||||||
|
|
||||||
if (!(fp_stat = fopen(path, "w")))
|
if (!(fp_stat = fopen(path, "we")))
|
||||||
{
|
{
|
||||||
trace(2, "swapsolstat: file open error path=%s\n", path);
|
trace(2, "swapsolstat: file open error path=%s\n", path);
|
||||||
return;
|
return;
|
||||||
@ -795,7 +795,7 @@ void detslp_ll(rtk_t *rtk, const obsd_t *obs, int i, int rcv)
|
|||||||
setbitu(&rtk->ssat[sat - 1].slip[f], 2, 2, obs[i].LLI[f]);
|
setbitu(&rtk->ssat[sat - 1].slip[f], 2, 2, obs[i].LLI[f]);
|
||||||
|
|
||||||
/* save slip and half-cycle valid flag */
|
/* save slip and half-cycle valid flag */
|
||||||
rtk->ssat[sat - 1].slip[f] |= (unsigned char)slip;
|
rtk->ssat[sat - 1].slip[f] |= static_cast<unsigned char>(slip);
|
||||||
rtk->ssat[sat - 1].half[f] = (obs[i].LLI[f] & 2) ? 0 : 1;
|
rtk->ssat[sat - 1].half[f] = (obs[i].LLI[f] & 2) ? 0 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -923,7 +923,7 @@ void udbias(rtk_t *rtk, double tt, const obsd_t *obs, const int *sat,
|
|||||||
/* reset phase-bias if instantaneous AR or expire obs outage counter */
|
/* reset phase-bias if instantaneous AR or expire obs outage counter */
|
||||||
for (i = 1; i <= MAXSAT; i++)
|
for (i = 1; i <= MAXSAT; i++)
|
||||||
{
|
{
|
||||||
reset = ++rtk->ssat[i - 1].outc[f] > (unsigned int)rtk->opt.maxout;
|
reset = ++rtk->ssat[i - 1].outc[f] > static_cast<unsigned int>(rtk->opt.maxout);
|
||||||
|
|
||||||
if (rtk->opt.modear == ARMODE_INST && rtk->x[IB_RTK(i, f, &rtk->opt)] != 0.0)
|
if (rtk->opt.modear == ARMODE_INST && rtk->x[IB_RTK(i, f, &rtk->opt)] != 0.0)
|
||||||
{
|
{
|
||||||
@ -1786,7 +1786,7 @@ int resamb_LAMBDA(rtk_t *rtk, double *bias, double *xa)
|
|||||||
trace(4, "N(2)=");
|
trace(4, "N(2)=");
|
||||||
tracemat(4, b + nb, 1, nb, 10, 3);
|
tracemat(4, b + nb, 1, nb, 10, 3);
|
||||||
|
|
||||||
rtk->sol.ratio = s[0] > 0 ? (float)(s[1] / s[0]) : 0.0f;
|
rtk->sol.ratio = s[0] > 0 ? static_cast<float>(s[1] / s[0]) : 0.0f;
|
||||||
if (rtk->sol.ratio > 999.9) rtk->sol.ratio = 999.9f;
|
if (rtk->sol.ratio > 999.9) rtk->sol.ratio = 999.9f;
|
||||||
|
|
||||||
/* validation by popular ratio-test */
|
/* validation by popular ratio-test */
|
||||||
@ -2077,22 +2077,22 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
rtk->sol.rr[i] = rtk->xa[i];
|
rtk->sol.rr[i] = rtk->xa[i];
|
||||||
rtk->sol.qr[i] = (float)rtk->Pa[i + i * rtk->na];
|
rtk->sol.qr[i] = static_cast<float>(rtk->Pa[i + i * rtk->na]);
|
||||||
}
|
}
|
||||||
rtk->sol.qr[3] = (float)rtk->Pa[1];
|
rtk->sol.qr[3] = static_cast<float>(rtk->Pa[1]);
|
||||||
rtk->sol.qr[4] = (float)rtk->Pa[1 + 2 * rtk->na];
|
rtk->sol.qr[4] = static_cast<float>(rtk->Pa[1 + 2 * rtk->na]);
|
||||||
rtk->sol.qr[5] = (float)rtk->Pa[2];
|
rtk->sol.qr[5] = static_cast<float>(rtk->Pa[2]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
rtk->sol.rr[i] = rtk->x[i];
|
rtk->sol.rr[i] = rtk->x[i];
|
||||||
rtk->sol.qr[i] = (float)rtk->P[i + i * rtk->nx];
|
rtk->sol.qr[i] = static_cast<float>(rtk->P[i + i * rtk->nx]);
|
||||||
}
|
}
|
||||||
rtk->sol.qr[3] = (float)rtk->P[1];
|
rtk->sol.qr[3] = static_cast<float>(rtk->P[1]);
|
||||||
rtk->sol.qr[4] = (float)rtk->P[1 + 2 * rtk->nx];
|
rtk->sol.qr[4] = static_cast<float>(rtk->P[1 + 2 * rtk->nx]);
|
||||||
rtk->sol.qr[5] = (float)rtk->P[2];
|
rtk->sol.qr[5] = static_cast<float>(rtk->P[2]);
|
||||||
rtk->nfix = 0;
|
rtk->nfix = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
@ -2321,7 +2321,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
|
|||||||
errmsg(rtk, "base station position error (%s)\n", msg);
|
errmsg(rtk, "base station position error (%s)\n", msg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rtk->sol.age = (float)timediff(rtk->sol.time, solb.time);
|
rtk->sol.age = static_cast<float>(timediff(rtk->sol.time, solb.time));
|
||||||
|
|
||||||
if (fabs(rtk->sol.age) > TTOL_MOVEB)
|
if (fabs(rtk->sol.age) > TTOL_MOVEB)
|
||||||
{
|
{
|
||||||
@ -2335,7 +2335,7 @@ int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rtk->sol.age = (float)timediff(obs[0].time, obs[nu].time);
|
rtk->sol.age = static_cast<float>(timediff(obs[0].time, obs[nu].time));
|
||||||
|
|
||||||
if (fabs(rtk->sol.age) > opt->maxtdiff)
|
if (fabs(rtk->sol.age) > opt->maxtdiff)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ void updatesvr(rtksvr_t *svr, int ret, obs_t *obs, nav_t *nav, int sat,
|
|||||||
for (i = 0; i < obs->n; i++)
|
for (i = 0; i < obs->n; i++)
|
||||||
{
|
{
|
||||||
if (svr->rtk.opt.exsats[obs->data[i].sat - 1] == 1 ||
|
if (svr->rtk.opt.exsats[obs->data[i].sat - 1] == 1 ||
|
||||||
!(satsys(obs->data[i].sat, NULL) & svr->rtk.opt.navsys)) continue;
|
!(satsys(obs->data[i].sat, nullptr) & svr->rtk.opt.navsys)) continue;
|
||||||
svr->obs[index][iobs].data[n] = obs->data[i];
|
svr->obs[index][iobs].data[n] = obs->data[i];
|
||||||
svr->obs[index][iobs].data[n++].rcv = index + 1;
|
svr->obs[index][iobs].data[n++].rcv = index + 1;
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ int decoderaw(rtksvr_t *svr, int index)
|
|||||||
{
|
{
|
||||||
obs_t *obs;
|
obs_t *obs;
|
||||||
nav_t *nav;
|
nav_t *nav;
|
||||||
sbsmsg_t *sbsmsg = NULL;
|
sbsmsg_t *sbsmsg = nullptr;
|
||||||
int i, ret = 0, sat, fobs = 0;
|
int i, ret = 0, sat, fobs = 0;
|
||||||
|
|
||||||
tracet(4, "decoderaw: index=%d\n", index);
|
tracet(4, "decoderaw: index=%d\n", index);
|
||||||
@ -373,8 +373,8 @@ void decodefile(rtksvr_t *svr, int index)
|
|||||||
trop_t trop0[MAXSTA] = {{{0, 0.0}, {0.0}, {0.0}}};
|
trop_t trop0[MAXSTA] = {{{0, 0.0}, {0.0}, {0.0}}};
|
||||||
pppcorr_t pppcorr0 = {0, {{0}, {0}}, {{0.0}, {0.0}}, {0}, {0}, {0}, {0}, {stec0}, {trop0}};
|
pppcorr_t pppcorr0 = {0, {{0}, {0}}, {{0.0}, {0.0}}, {0}, {0}, {0}, {0}, {stec0}, {trop0}};
|
||||||
|
|
||||||
nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||||
{0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0},
|
{0, 0, (erpd_t *){nullptr}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0},
|
||||||
{0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0}, {0.0}}, {{0.0}, {0.0}}, {{{0.0}}, {{0.0}}, {{0.0}}},
|
{0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0}, {0.0}}, {{0.0}, {0.0}}, {{{0.0}}, {{0.0}}, {{0.0}}},
|
||||||
{0.0}, {0.0}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0},
|
{0.0}, {0.0}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0},
|
||||||
{{0, 0.0}, 0.0, {0.0}, {{0.0}, {0.0}}}, pppcorr0};
|
{{0, 0.0}, 0.0, {0.0}, {{0.0}, {0.0}}}, pppcorr0};
|
||||||
@ -393,7 +393,7 @@ void decodefile(rtksvr_t *svr, int index)
|
|||||||
rtksvrunlock(svr);
|
rtksvrunlock(svr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strncpy(file, (char *)svr->buff[index], nb - 2);
|
strncpy(file, reinterpret_cast<char *>(svr->buff[index]), nb - 2);
|
||||||
file[nb - 2] = '\0';
|
file[nb - 2] = '\0';
|
||||||
svr->nb[index] = 0;
|
svr->nb[index] = 0;
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ void decodefile(rtksvr_t *svr, int index)
|
|||||||
/* rtk server thread ---------------------------------------------------------*/
|
/* rtk server thread ---------------------------------------------------------*/
|
||||||
void *rtksvrthread(void *arg)
|
void *rtksvrthread(void *arg)
|
||||||
{
|
{
|
||||||
auto *svr = (rtksvr_t *)arg;
|
auto *svr = static_cast<rtksvr_t *>(arg);
|
||||||
obs_t obs;
|
obs_t obs;
|
||||||
obsd_t data[MAXOBS * 2];
|
obsd_t data[MAXOBS * 2];
|
||||||
double tt;
|
double tt;
|
||||||
@ -518,14 +518,14 @@ void *rtksvrthread(void *arg)
|
|||||||
if (svr->rtk.sol.stat != SOLQ_NONE)
|
if (svr->rtk.sol.stat != SOLQ_NONE)
|
||||||
{
|
{
|
||||||
/* adjust current time */
|
/* adjust current time */
|
||||||
tt = (int)(tickget() - tick) / 1000.0 + DTTOL;
|
tt = static_cast<int>(tickget() - tick) / 1000.0 + DTTOL;
|
||||||
timeset(gpst2utc(timeadd(svr->rtk.sol.time, tt)));
|
timeset(gpst2utc(timeadd(svr->rtk.sol.time, tt)));
|
||||||
|
|
||||||
/* write solution */
|
/* write solution */
|
||||||
writesol(svr, i);
|
writesol(svr, i);
|
||||||
}
|
}
|
||||||
/* if cpu overload, inclement obs outage counter and break */
|
/* if cpu overload, inclement obs outage counter and break */
|
||||||
if ((int)(tickget() - tick) >= svr->cycle)
|
if (static_cast<int>(tickget() - tick) >= svr->cycle)
|
||||||
{
|
{
|
||||||
svr->prcout += fobs[0] - i - 1;
|
svr->prcout += fobs[0] - i - 1;
|
||||||
#if 0 /* omitted v.2.4.1 */
|
#if 0 /* omitted v.2.4.1 */
|
||||||
@ -539,7 +539,7 @@ void *rtksvrthread(void *arg)
|
|||||||
writesol(svr, 0);
|
writesol(svr, 0);
|
||||||
}
|
}
|
||||||
/* send nmea request to base/nrtk input stream */
|
/* send nmea request to base/nrtk input stream */
|
||||||
if (svr->nmeacycle > 0 && (int)(tick - ticknmea) >= svr->nmeacycle)
|
if (svr->nmeacycle > 0 && static_cast<int>(tick - ticknmea) >= svr->nmeacycle)
|
||||||
{
|
{
|
||||||
if (svr->stream[1].state == 1)
|
if (svr->stream[1].state == 1)
|
||||||
{
|
{
|
||||||
@ -554,7 +554,7 @@ void *rtksvrthread(void *arg)
|
|||||||
}
|
}
|
||||||
ticknmea = tick;
|
ticknmea = tick;
|
||||||
}
|
}
|
||||||
if ((cputime = (int)(tickget() - tick)) > 0) svr->cputime = cputime;
|
if ((cputime = static_cast<int>(tickget() - tick)) > 0) svr->cputime = cputime;
|
||||||
|
|
||||||
/* sleep until next cycle */
|
/* sleep until next cycle */
|
||||||
sleepms(svr->cycle - cputime);
|
sleepms(svr->cycle - cputime);
|
||||||
@ -564,9 +564,9 @@ void *rtksvrthread(void *arg)
|
|||||||
{
|
{
|
||||||
svr->nb[i] = svr->npb[i] = 0;
|
svr->nb[i] = svr->npb[i] = 0;
|
||||||
free(svr->buff[i]);
|
free(svr->buff[i]);
|
||||||
svr->buff[i] = NULL;
|
svr->buff[i] = nullptr;
|
||||||
free(svr->pbuf[i]);
|
free(svr->pbuf[i]);
|
||||||
svr->pbuf[i] = NULL;
|
svr->pbuf[i] = nullptr;
|
||||||
//free_raw (svr->raw +i);
|
//free_raw (svr->raw +i);
|
||||||
free_rtcm(svr->rtcm + i);
|
free_rtcm(svr->rtcm + i);
|
||||||
}
|
}
|
||||||
@ -574,9 +574,9 @@ void *rtksvrthread(void *arg)
|
|||||||
{
|
{
|
||||||
svr->nsb[i] = 0;
|
svr->nsb[i] = 0;
|
||||||
free(svr->sbuf[i]);
|
free(svr->sbuf[i]);
|
||||||
svr->sbuf[i] = NULL;
|
svr->sbuf[i] = nullptr;
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -610,22 +610,22 @@ int rtksvrinit(rtksvr_t *svr)
|
|||||||
for (i = 0; i < 3; i++) svr->nb[i] = 0;
|
for (i = 0; i < 3; i++) svr->nb[i] = 0;
|
||||||
for (i = 0; i < 2; i++) svr->nsb[i] = 0;
|
for (i = 0; i < 2; i++) svr->nsb[i] = 0;
|
||||||
for (i = 0; i < 3; i++) svr->npb[i] = 0;
|
for (i = 0; i < 3; i++) svr->npb[i] = 0;
|
||||||
for (i = 0; i < 3; i++) svr->buff[i] = NULL;
|
for (i = 0; i < 3; i++) svr->buff[i] = nullptr;
|
||||||
for (i = 0; i < 2; i++) svr->sbuf[i] = NULL;
|
for (i = 0; i < 2; i++) svr->sbuf[i] = nullptr;
|
||||||
for (i = 0; i < 3; i++) svr->pbuf[i] = NULL;
|
for (i = 0; i < 3; i++) svr->pbuf[i] = nullptr;
|
||||||
for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0;
|
for (i = 0; i < MAXSOLBUF; i++) svr->solbuf[i] = sol0;
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0;
|
for (j = 0; j < 10; j++) svr->nmsg[i][j] = 0;
|
||||||
for (i = 0; i < 3; i++) svr->ftime[i] = time0;
|
for (i = 0; i < 3; i++) svr->ftime[i] = time0;
|
||||||
for (i = 0; i < 3; i++) svr->files[i][0] = '\0';
|
for (i = 0; i < 3; i++) svr->files[i][0] = '\0';
|
||||||
svr->moni = NULL;
|
svr->moni = nullptr;
|
||||||
svr->tick = 0;
|
svr->tick = 0;
|
||||||
svr->thread = 0;
|
svr->thread = 0; // NOLINT
|
||||||
svr->cputime = svr->prcout = 0;
|
svr->cputime = svr->prcout = 0;
|
||||||
|
|
||||||
if (!(svr->nav.eph = (eph_t *)malloc(sizeof(eph_t) * MAXSAT * 2)) ||
|
if (!(svr->nav.eph = static_cast<eph_t *>(malloc(sizeof(eph_t) * MAXSAT * 2))) ||
|
||||||
!(svr->nav.geph = (geph_t *)malloc(sizeof(geph_t) * NSATGLO * 2)) ||
|
!(svr->nav.geph = static_cast<geph_t *>(malloc(sizeof(geph_t) * NSATGLO * 2))) ||
|
||||||
!(svr->nav.seph = (seph_t *)malloc(sizeof(seph_t) * NSATSBS * 2)))
|
!(svr->nav.seph = static_cast<seph_t *>(malloc(sizeof(seph_t) * NSATSBS * 2))))
|
||||||
{
|
{
|
||||||
tracet(1, "rtksvrinit: malloc error\n");
|
tracet(1, "rtksvrinit: malloc error\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -640,7 +640,7 @@ int rtksvrinit(rtksvr_t *svr)
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
for (j = 0; j < MAXOBSBUF; j++)
|
for (j = 0; j < MAXOBSBUF; j++)
|
||||||
{
|
{
|
||||||
if (!(svr->obs[i][j].data = (obsd_t *)malloc(sizeof(obsd_t) * MAXOBS)))
|
if (!(svr->obs[i][j].data = static_cast<obsd_t *>(malloc(sizeof(obsd_t) * MAXOBS))))
|
||||||
{
|
{
|
||||||
tracet(1, "rtksvrinit: malloc error\n");
|
tracet(1, "rtksvrinit: malloc error\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -760,8 +760,8 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
|
|||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{ /* input/log streams */
|
{ /* input/log streams */
|
||||||
svr->nb[i] = svr->npb[i] = 0;
|
svr->nb[i] = svr->npb[i] = 0;
|
||||||
if (!(svr->buff[i] = (unsigned char *)malloc(buffsize)) ||
|
if (!(svr->buff[i] = static_cast<unsigned char *>(malloc(buffsize))) ||
|
||||||
!(svr->pbuf[i] = (unsigned char *)malloc(buffsize)))
|
!(svr->pbuf[i] = static_cast<unsigned char *>(malloc(buffsize))))
|
||||||
{
|
{
|
||||||
tracet(1, "rtksvrstart: malloc error\n");
|
tracet(1, "rtksvrstart: malloc error\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -782,7 +782,7 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{ /* output peek buffer */
|
{ /* output peek buffer */
|
||||||
if (!(svr->sbuf[i] = (unsigned char *)malloc(buffsize)))
|
if (!(svr->sbuf[i] = static_cast<unsigned char *>(malloc(buffsize))))
|
||||||
{
|
{
|
||||||
tracet(1, "rtksvrstart: malloc error\n");
|
tracet(1, "rtksvrstart: malloc error\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -840,7 +840,7 @@ int rtksvrstart(rtksvr_t *svr, int cycle, int buffsize, int *strs,
|
|||||||
writesolhead(svr->stream + i, svr->solopt + i - 3);
|
writesolhead(svr->stream + i, svr->solopt + i - 3);
|
||||||
}
|
}
|
||||||
/* create rtk server thread */
|
/* create rtk server thread */
|
||||||
if (pthread_create(&svr->thread, NULL, rtksvrthread, svr))
|
if (pthread_create(&svr->thread, nullptr, rtksvrthread, svr))
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream + i);
|
for (i = 0; i < MAXSTRRTK; i++) strclose(svr->stream + i);
|
||||||
return 0;
|
return 0;
|
||||||
@ -876,7 +876,7 @@ void rtksvrstop(rtksvr_t *svr, char **cmds)
|
|||||||
svr->state = 0;
|
svr->state = 0;
|
||||||
|
|
||||||
/* free rtk server thread */
|
/* free rtk server thread */
|
||||||
pthread_join(svr->thread, NULL);
|
pthread_join(svr->thread, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -979,7 +979,7 @@ int rtksvrostat(rtksvr_t *svr, int rcv, gtime_t *time, int *sat,
|
|||||||
el[i] = svr->rtk.ssat[sat[i] - 1].azel[1];
|
el[i] = svr->rtk.ssat[sat[i] - 1].azel[1];
|
||||||
for (j = 0; j < NFREQ; j++)
|
for (j = 0; j < NFREQ; j++)
|
||||||
{
|
{
|
||||||
snr[i][j] = (int)(svr->obs[rcv][0].data[i].SNR[j] * 0.25);
|
snr[i][j] = static_cast<int>(svr->obs[rcv][0].data[i].SNR[j] * 0.25);
|
||||||
}
|
}
|
||||||
if (svr->rtk.sol.stat == SOLQ_NONE || svr->rtk.sol.stat == SOLQ_SINGLE)
|
if (svr->rtk.sol.stat == SOLQ_NONE || svr->rtk.sol.stat == SOLQ_SINGLE)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ int decode_sbstype2(const sbsmsg_t *msg, sbssat_t *sbssat)
|
|||||||
|
|
||||||
trace(4, "decode_sbstype2:\n");
|
trace(4, "decode_sbstype2:\n");
|
||||||
|
|
||||||
if (sbssat->iodp != (int)getbitu(msg->msg, 16, 2)) return 0;
|
if (sbssat->iodp != static_cast<int>(getbitu(msg->msg, 16, 2))) return 0;
|
||||||
|
|
||||||
type = getbitu(msg->msg, 8, 6);
|
type = getbitu(msg->msg, 8, 6);
|
||||||
iodf = getbitu(msg->msg, 14, 2);
|
iodf = getbitu(msg->msg, 14, 2);
|
||||||
@ -209,7 +209,7 @@ int decode_sbstype7(const sbsmsg_t *msg, sbssat_t *sbssat)
|
|||||||
|
|
||||||
trace(4, "decode_sbstype7\n");
|
trace(4, "decode_sbstype7\n");
|
||||||
|
|
||||||
if (sbssat->iodp != (int)getbitu(msg->msg, 18, 2)) return 0;
|
if (sbssat->iodp != static_cast<int>(getbitu(msg->msg, 18, 2))) return 0;
|
||||||
|
|
||||||
sbssat->tlat = getbitu(msg->msg, 14, 4);
|
sbssat->tlat = getbitu(msg->msg, 14, 4);
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ int decode_sbstype9(const sbsmsg_t *msg, nav_t *nav)
|
|||||||
trace(2, "invalid prn in sbas type 9: prn=%3d\n", msg->prn);
|
trace(2, "invalid prn in sbas type 9: prn=%3d\n", msg->prn);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
t = (int)getbitu(msg->msg, 22, 13) * 16 - (int)msg->tow % 86400;
|
t = static_cast<int>(getbitu(msg->msg, 22, 13)) * 16 - msg->tow % 86400;
|
||||||
if (t <= -43200)
|
if (t <= -43200)
|
||||||
t += 86400;
|
t += 86400;
|
||||||
else if (t > 43200)
|
else if (t > 43200)
|
||||||
@ -292,7 +292,7 @@ int decode_sbstype18(const sbsmsg_t *msg, sbsion_t *sbsion)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sbsion[band].iodi = (short)getbitu(msg->msg, 22, 2);
|
sbsion[band].iodi = static_cast<int16_t>(getbitu(msg->msg, 22, 2));
|
||||||
|
|
||||||
for (i = 1, n = 0; i <= 201; i++)
|
for (i = 1, n = 0; i <= 201; i++)
|
||||||
{
|
{
|
||||||
@ -355,7 +355,7 @@ int decode_longcorr1(const sbsmsg_t *msg, int p, sbssat_t *sbssat)
|
|||||||
}
|
}
|
||||||
sbssat->sat[n - 1].lcorr.daf0 = getbits(msg->msg, p + 47, 11) * TWO_N31;
|
sbssat->sat[n - 1].lcorr.daf0 = getbits(msg->msg, p + 47, 11) * TWO_N31;
|
||||||
sbssat->sat[n - 1].lcorr.daf1 = getbits(msg->msg, p + 82, 8) * TWO_N39;
|
sbssat->sat[n - 1].lcorr.daf1 = getbits(msg->msg, p + 82, 8) * TWO_N39;
|
||||||
t = (int)getbitu(msg->msg, p + 90, 13) * 16 - (int)msg->tow % 86400;
|
t = static_cast<int>(getbitu(msg->msg, p + 90, 13)) * 16 - msg->tow % 86400;
|
||||||
if (t <= -43200)
|
if (t <= -43200)
|
||||||
t += 86400;
|
t += 86400;
|
||||||
else if (t > 43200)
|
else if (t > 43200)
|
||||||
@ -374,13 +374,13 @@ int decode_longcorrh(const sbsmsg_t *msg, int p, sbssat_t *sbssat)
|
|||||||
|
|
||||||
if (getbitu(msg->msg, p, 1) == 0)
|
if (getbitu(msg->msg, p, 1) == 0)
|
||||||
{ /* vel code=0 */
|
{ /* vel code=0 */
|
||||||
if (sbssat->iodp == (int)getbitu(msg->msg, p + 103, 2))
|
if (sbssat->iodp == static_cast<int>(getbitu(msg->msg, p + 103, 2)))
|
||||||
{
|
{
|
||||||
return decode_longcorr0(msg, p + 1, sbssat) &&
|
return decode_longcorr0(msg, p + 1, sbssat) &&
|
||||||
decode_longcorr0(msg, p + 52, sbssat);
|
decode_longcorr0(msg, p + 52, sbssat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sbssat->iodp == (int)getbitu(msg->msg, p + 104, 2))
|
else if (sbssat->iodp == static_cast<int>(getbitu(msg->msg, p + 104, 2)))
|
||||||
{
|
{
|
||||||
return decode_longcorr1(msg, p + 1, sbssat);
|
return decode_longcorr1(msg, p + 1, sbssat);
|
||||||
}
|
}
|
||||||
@ -395,7 +395,7 @@ int decode_sbstype24(const sbsmsg_t *msg, sbssat_t *sbssat)
|
|||||||
|
|
||||||
trace(4, "decode_sbstype24:\n");
|
trace(4, "decode_sbstype24:\n");
|
||||||
|
|
||||||
if (sbssat->iodp != (int)getbitu(msg->msg, 110, 2)) return 0; /* check IODP */
|
if (sbssat->iodp != static_cast<int>(getbitu(msg->msg, 110, 2))) return 0; /* check IODP */
|
||||||
|
|
||||||
blk = getbitu(msg->msg, 112, 2);
|
blk = getbitu(msg->msg, 112, 2);
|
||||||
iodf = getbitu(msg->msg, 114, 2);
|
iodf = getbitu(msg->msg, 114, 2);
|
||||||
@ -430,7 +430,7 @@ int decode_sbstype26(const sbsmsg_t *msg, sbsion_t *sbsion)
|
|||||||
|
|
||||||
trace(4, "decode_sbstype26:\n");
|
trace(4, "decode_sbstype26:\n");
|
||||||
|
|
||||||
if (band > MAXBAND || sbsion[band].iodi != (int)getbitu(msg->msg, 217, 2)) return 0;
|
if (band > MAXBAND || sbsion[band].iodi != static_cast<int>(getbitu(msg->msg, 217, 2))) return 0;
|
||||||
|
|
||||||
block = getbitu(msg->msg, 18, 4);
|
block = getbitu(msg->msg, 18, 4);
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te,
|
|||||||
|
|
||||||
trace(3, "readmsgs: file=%s sel=%d\n", file, sel);
|
trace(3, "readmsgs: file=%s sel=%d\n", file, sel);
|
||||||
|
|
||||||
if (!(fp = fopen(file, "r")))
|
if (!(fp = fopen(file, "re")))
|
||||||
{
|
{
|
||||||
trace(2, "sbas message file open error: %s\n", file);
|
trace(2, "sbas message file open error: %s\n", file);
|
||||||
return;
|
return;
|
||||||
@ -575,7 +575,7 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te,
|
|||||||
if (sbs->n >= sbs->nmax)
|
if (sbs->n >= sbs->nmax)
|
||||||
{
|
{
|
||||||
sbs->nmax = sbs->nmax == 0 ? 1024 : sbs->nmax * 2;
|
sbs->nmax = sbs->nmax == 0 ? 1024 : sbs->nmax * 2;
|
||||||
if (!(sbs_msgs = (sbsmsg_t *)realloc(sbs->msgs, sbs->nmax * sizeof(sbsmsg_t))))
|
if (!(sbs_msgs = static_cast<sbsmsg_t *>(realloc(sbs->msgs, sbs->nmax * sizeof(sbsmsg_t)))))
|
||||||
{
|
{
|
||||||
trace(1, "readsbsmsg malloc error: nmax=%d\n", sbs->nmax);
|
trace(1, "readsbsmsg malloc error: nmax=%d\n", sbs->nmax);
|
||||||
free(sbs->msgs);
|
free(sbs->msgs);
|
||||||
@ -587,12 +587,12 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te,
|
|||||||
sbs->msgs = sbs_msgs;
|
sbs->msgs = sbs_msgs;
|
||||||
}
|
}
|
||||||
sbs->msgs[sbs->n].week = week;
|
sbs->msgs[sbs->n].week = week;
|
||||||
sbs->msgs[sbs->n].tow = (int)(tow + 0.5);
|
sbs->msgs[sbs->n].tow = static_cast<int>(tow + 0.5);
|
||||||
sbs->msgs[sbs->n].prn = prn;
|
sbs->msgs[sbs->n].prn = prn;
|
||||||
for (i = 0; i < 29; i++) sbs->msgs[sbs->n].msg[i] = 0;
|
for (i = 0; i < 29; i++) sbs->msgs[sbs->n].msg[i] = 0;
|
||||||
for (i = 0; *(p - 1) && *p && i < 29; p += 2, i++)
|
for (i = 0; *(p - 1) && *p && i < 29; p += 2, i++)
|
||||||
{
|
{
|
||||||
if (sscanf(p, "%2X", &b) == 1) sbs->msgs[sbs->n].msg[i] = (unsigned char)b;
|
if (sscanf(p, "%2X", &b) == 1) sbs->msgs[sbs->n].msg[i] = static_cast<unsigned char>(b);
|
||||||
}
|
}
|
||||||
sbs->msgs[sbs->n++].msg[28] &= 0xC0;
|
sbs->msgs[sbs->n++].msg[28] &= 0xC0;
|
||||||
}
|
}
|
||||||
@ -633,7 +633,7 @@ int sbsreadmsgt(const char *file, int sel, gtime_t ts, gtime_t te,
|
|||||||
|
|
||||||
for (i = 0; i < MAXEXFILE; i++)
|
for (i = 0; i < MAXEXFILE; i++)
|
||||||
{
|
{
|
||||||
if (!(efiles[i] = (char *)malloc(1024)))
|
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
|
||||||
{
|
{
|
||||||
for (i--; i >= 0; i--) free(efiles[i]);
|
for (i--; i >= 0; i--) free(efiles[i]);
|
||||||
return 0;
|
return 0;
|
||||||
@ -645,8 +645,8 @@ int sbsreadmsgt(const char *file, int sel, gtime_t ts, gtime_t te,
|
|||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
if (!(ext = strrchr(efiles[i], '.'))) continue;
|
if (!(ext = strrchr(efiles[i], '.'))) continue;
|
||||||
if (strcmp(ext, ".sbs") && strcmp(ext, ".SBS") &&
|
if (strcmp(ext, ".sbs") != 0 && strcmp(ext, ".SBS") &&
|
||||||
strcmp(ext, ".ems") && strcmp(ext, ".EMS")) continue;
|
strcmp(ext, ".ems") != 0 && strcmp(ext, ".EMS") != 0) continue;
|
||||||
|
|
||||||
readmsgs(efiles[i], sel, ts, te, sbs);
|
readmsgs(efiles[i], sel, ts, te, sbs);
|
||||||
}
|
}
|
||||||
@ -702,38 +702,38 @@ void searchigp(gtime_t time __attribute__((unused)), const double *pos, const sb
|
|||||||
if (lon >= 180.0) lon -= 360.0;
|
if (lon >= 180.0) lon -= 360.0;
|
||||||
if (-55.0 <= lat && lat < 55.0)
|
if (-55.0 <= lat && lat < 55.0)
|
||||||
{
|
{
|
||||||
latp[0] = (int)floor(lat / 5.0) * 5;
|
latp[0] = static_cast<int>(floor(lat / 5.0)) * 5;
|
||||||
latp[1] = latp[0] + 5;
|
latp[1] = latp[0] + 5;
|
||||||
lonp[0] = lonp[1] = (int)floor(lon / 5.0) * 5;
|
lonp[0] = lonp[1] = static_cast<int>(floor(lon / 5.0)) * 5;
|
||||||
lonp[2] = lonp[3] = lonp[0] + 5;
|
lonp[2] = lonp[3] = lonp[0] + 5;
|
||||||
*x = (lon - lonp[0]) / 5.0;
|
*x = (lon - lonp[0]) / 5.0;
|
||||||
*y = (lat - latp[0]) / 5.0;
|
*y = (lat - latp[0]) / 5.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
latp[0] = (int)floor((lat - 5.0) / 10.0) * 10 + 5;
|
latp[0] = static_cast<int>(floor((lat - 5.0) / 10.0)) * 10 + 5;
|
||||||
latp[1] = latp[0] + 10;
|
latp[1] = latp[0] + 10;
|
||||||
lonp[0] = lonp[1] = (int)floor(lon / 10.0) * 10;
|
lonp[0] = lonp[1] = static_cast<int>(floor(lon / 10.0)) * 10;
|
||||||
lonp[2] = lonp[3] = lonp[0] + 10;
|
lonp[2] = lonp[3] = lonp[0] + 10;
|
||||||
*x = (lon - lonp[0]) / 10.0;
|
*x = (lon - lonp[0]) / 10.0;
|
||||||
*y = (lat - latp[0]) / 10.0;
|
*y = (lat - latp[0]) / 10.0;
|
||||||
if (75.0 <= lat && lat < 85.0)
|
if (75.0 <= lat && lat < 85.0)
|
||||||
{
|
{
|
||||||
lonp[1] = (int)floor(lon / 90.0) * 90;
|
lonp[1] = static_cast<int>(floor(lon / 90.0)) * 90;
|
||||||
lonp[3] = lonp[1] + 90;
|
lonp[3] = lonp[1] + 90;
|
||||||
}
|
}
|
||||||
else if (-85.0 <= lat && lat < -75.0)
|
else if (-85.0 <= lat && lat < -75.0)
|
||||||
{
|
{
|
||||||
lonp[0] = (int)floor((lon - 50.0) / 90.0) * 90 + 40;
|
lonp[0] = static_cast<int>(floor((lon - 50.0) / 90.0)) * 90 + 40;
|
||||||
lonp[2] = lonp[0] + 90;
|
lonp[2] = lonp[0] + 90;
|
||||||
}
|
}
|
||||||
else if (lat >= 85.0)
|
else if (lat >= 85.0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++) lonp[i] = (int)floor(lon / 90.0) * 90;
|
for (i = 0; i < 4; i++) lonp[i] = static_cast<int>(floor(lon / 90.0)) * 90;
|
||||||
}
|
}
|
||||||
else if (lat < -85.0)
|
else if (lat < -85.0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++) lonp[i] = (int)floor((lon - 50.0) / 90.0) * 90 + 40;
|
for (i = 0; i < 4; i++) lonp[i] = static_cast<int>(floor((lon - 50.0) / 90.0)) * 90 + 40;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
@ -864,7 +864,7 @@ void getmet(double lat, double *met)
|
|||||||
for (i = 0; i < 10; i++) met[i] = metprm[4][i];
|
for (i = 0; i < 10; i++) met[i] = metprm[4][i];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j = (int)(lat / 15.0);
|
j = static_cast<int>(lat / 15.0);
|
||||||
a = (lat - j * 15.0) / 15.0;
|
a = (lat - j * 15.0) / 15.0;
|
||||||
for (i = 0; i < 10; i++) met[i] = (1.0 - a) * metprm[j - 1][i] + a * metprm[j][i];
|
for (i = 0; i < 10; i++) met[i] = (1.0 - a) * metprm[j - 1][i] + a * metprm[j][i];
|
||||||
}
|
}
|
||||||
@ -1049,14 +1049,14 @@ int sbsdecodemsg(gtime_t time, int prn, const unsigned int *words,
|
|||||||
|
|
||||||
if (time.time == 0) return 0;
|
if (time.time == 0) return 0;
|
||||||
tow = time2gpst(time, &sbsmsg->week);
|
tow = time2gpst(time, &sbsmsg->week);
|
||||||
sbsmsg->tow = (int)(tow + DTTOL);
|
sbsmsg->tow = static_cast<int>(tow + DTTOL);
|
||||||
sbsmsg->prn = prn;
|
sbsmsg->prn = prn;
|
||||||
for (i = 0; i < 7; i++)
|
for (i = 0; i < 7; i++)
|
||||||
for (j = 0; j < 4; j++)
|
for (j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
sbsmsg->msg[i * 4 + j] = (unsigned char)(words[i] >> ((3 - j) * 8));
|
sbsmsg->msg[i * 4 + j] = static_cast<unsigned char>(words[i] >> ((3 - j) * 8));
|
||||||
}
|
}
|
||||||
sbsmsg->msg[28] = (unsigned char)(words[7] >> 18) & 0xC0;
|
sbsmsg->msg[28] = static_cast<unsigned char>(words[7] >> 18) & 0xC0;
|
||||||
for (i = 28; i > 0; i--) f[i] = (sbsmsg->msg[i] >> 6) + (sbsmsg->msg[i - 1] << 2);
|
for (i = 28; i > 0; i--) f[i] = (sbsmsg->msg[i] >> 6) + (sbsmsg->msg[i - 1] << 2);
|
||||||
f[0] = sbsmsg->msg[0] >> 6;
|
f[0] = sbsmsg->msg[0] >> 6;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
*
|
*
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <cctype>
|
||||||
#include "rtklib_solution.h"
|
#include "rtklib_solution.h"
|
||||||
#include "rtklib_rtkcmn.h"
|
#include "rtklib_rtkcmn.h"
|
||||||
#include "rtklib_rtksvr.h"
|
#include "rtklib_rtksvr.h"
|
||||||
@ -88,7 +88,7 @@ const char *opt2sep(const solopt_t *opt)
|
|||||||
/* separate fields -----------------------------------------------------------*/
|
/* separate fields -----------------------------------------------------------*/
|
||||||
int tonum(char *buff, const char *sep, double *v)
|
int tonum(char *buff, const char *sep, double *v)
|
||||||
{
|
{
|
||||||
int n, len = (int)strlen(sep);
|
int n, len = static_cast<int>(strlen(sep));
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
for (p = buff, n = 0; n < MAXFIELD; p = q + len)
|
for (p = buff, n = 0; n < MAXFIELD; p = q + len)
|
||||||
@ -140,12 +140,12 @@ void soltocov(const sol_t *sol, double *P)
|
|||||||
/* covariance to solution ----------------------------------------------------*/
|
/* covariance to solution ----------------------------------------------------*/
|
||||||
void covtosol(const double *P, sol_t *sol)
|
void covtosol(const double *P, sol_t *sol)
|
||||||
{
|
{
|
||||||
sol->qr[0] = (float)P[0]; /* xx or ee */
|
sol->qr[0] = static_cast<float>(P[0]); /* xx or ee */
|
||||||
sol->qr[1] = (float)P[4]; /* yy or nn */
|
sol->qr[1] = static_cast<float>(P[4]); /* yy or nn */
|
||||||
sol->qr[2] = (float)P[8]; /* zz or uu */
|
sol->qr[2] = static_cast<float>(P[8]); /* zz or uu */
|
||||||
sol->qr[3] = (float)P[1]; /* xy or en */
|
sol->qr[3] = static_cast<float>(P[1]); /* xy or en */
|
||||||
sol->qr[4] = (float)P[5]; /* yz or nu */
|
sol->qr[4] = static_cast<float>(P[5]); /* yz or nu */
|
||||||
sol->qr[5] = (float)P[2]; /* zx or ue */
|
sol->qr[5] = static_cast<float>(P[2]); /* zx or ue */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time)
|
|||||||
strcpy(s, "\t");
|
strcpy(s, "\t");
|
||||||
else if (*opt->sep)
|
else if (*opt->sep)
|
||||||
strcpy(s, opt->sep);
|
strcpy(s, opt->sep);
|
||||||
len = (int)strlen(s);
|
len = static_cast<int>(strlen(s));
|
||||||
|
|
||||||
/* yyyy/mm/dd hh:mm:ss or yyyy mm dd hh:mm:ss */
|
/* yyyy/mm/dd hh:mm:ss or yyyy mm dd hh:mm:ss */
|
||||||
if (sscanf(buff, "%lf/%lf/%lf %lf:%lf:%lf", v, v + 1, v + 2, v + 3, v + 4, v + 5) >= 6)
|
if (sscanf(buff, "%lf/%lf/%lf %lf:%lf:%lf", v, v + 1, v + 2, v + 3, v + 4, v + 5) >= 6)
|
||||||
@ -383,7 +383,7 @@ char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time)
|
|||||||
*time = utc2gpst(timeadd(*time, -9 * 3600.0));
|
*time = utc2gpst(timeadd(*time, -9 * 3600.0));
|
||||||
}
|
}
|
||||||
if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return nullptr;
|
if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return nullptr;
|
||||||
for (p++; isdigit((int)*p) || *p == '.';) p++;
|
for (p++; isdigit(static_cast<int>(*p)) || *p == '.';) p++;
|
||||||
return p + len;
|
return p + len;
|
||||||
}
|
}
|
||||||
if (opt->posf == SOLF_GSIF)
|
if (opt->posf == SOLF_GSIF)
|
||||||
@ -394,7 +394,7 @@ char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time)
|
|||||||
}
|
}
|
||||||
*time = timeadd(epoch2time(v), -12.0 * 3600.0);
|
*time = timeadd(epoch2time(v), -12.0 * 3600.0);
|
||||||
if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return nullptr;
|
if (!(p = strchr(buff, ':')) || !(p = strchr(p + 1, ':'))) return nullptr;
|
||||||
for (p++; isdigit((int)*p) || *p == '.';) p++;
|
for (p++; isdigit(static_cast<int>(*p)) || *p == '.';) p++;
|
||||||
return p + len;
|
return p + len;
|
||||||
}
|
}
|
||||||
/* wwww ssss */
|
/* wwww ssss */
|
||||||
@ -406,7 +406,7 @@ char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time)
|
|||||||
}
|
}
|
||||||
if (n >= 2 && 0.0 <= v[0] && v[0] <= 3000.0 && 0.0 <= v[1] && v[1] < 604800.0)
|
if (n >= 2 && 0.0 <= v[0] && v[0] <= 3000.0 && 0.0 <= v[1] && v[1] < 604800.0)
|
||||||
{
|
{
|
||||||
*time = gpst2time((int)v[0], v[1]);
|
*time = gpst2time(static_cast<int>(v[0]), v[1]);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -428,8 +428,8 @@ int decode_solxyz(char *buff, const solopt_t *opt, sol_t *sol)
|
|||||||
{
|
{
|
||||||
sol->rr[j] = val[i++]; /* xyz */
|
sol->rr[j] = val[i++]; /* xyz */
|
||||||
}
|
}
|
||||||
if (i < n) sol->stat = (unsigned char)val[i++];
|
if (i < n) sol->stat = static_cast<unsigned char>(val[i++]);
|
||||||
if (i < n) sol->ns = (unsigned char)val[i++];
|
if (i < n) sol->ns = static_cast<unsigned char>(val[i++]);
|
||||||
if (i + 3 < n)
|
if (i + 3 < n)
|
||||||
{
|
{
|
||||||
P[0] = val[i] * val[i];
|
P[0] = val[i] * val[i];
|
||||||
@ -449,8 +449,8 @@ int decode_solxyz(char *buff, const solopt_t *opt, sol_t *sol)
|
|||||||
}
|
}
|
||||||
covtosol(P, sol);
|
covtosol(P, sol);
|
||||||
}
|
}
|
||||||
if (i < n) sol->age = (float)val[i++];
|
if (i < n) sol->age = static_cast<float>(val[i++]);
|
||||||
if (i < n) sol->ratio = (float)val[i];
|
if (i < n) sol->ratio = static_cast<float>(val[i]);
|
||||||
|
|
||||||
sol->type = 0; /* position type = xyz */
|
sol->type = 0; /* position type = xyz */
|
||||||
|
|
||||||
@ -486,8 +486,8 @@ int decode_solllh(char *buff, const solopt_t *opt, sol_t *sol)
|
|||||||
i += 7;
|
i += 7;
|
||||||
}
|
}
|
||||||
pos2ecef(pos, sol->rr);
|
pos2ecef(pos, sol->rr);
|
||||||
if (i < n) sol->stat = (unsigned char)val[i++];
|
if (i < n) sol->stat = static_cast<unsigned char>(val[i++]);
|
||||||
if (i < n) sol->ns = (unsigned char)val[i++];
|
if (i < n) sol->ns = static_cast<unsigned char>(val[i++]);
|
||||||
if (i + 3 < n)
|
if (i + 3 < n)
|
||||||
{
|
{
|
||||||
Q[4] = val[i] * val[i];
|
Q[4] = val[i] * val[i];
|
||||||
@ -508,8 +508,8 @@ int decode_solllh(char *buff, const solopt_t *opt, sol_t *sol)
|
|||||||
covecef(pos, Q, P);
|
covecef(pos, Q, P);
|
||||||
covtosol(P, sol);
|
covtosol(P, sol);
|
||||||
}
|
}
|
||||||
if (i < n) sol->age = (float)val[i++];
|
if (i < n) sol->age = static_cast<float>(val[i++]);
|
||||||
if (i < n) sol->ratio = (float)val[i];
|
if (i < n) sol->ratio = static_cast<float>(val[i]);
|
||||||
|
|
||||||
sol->type = 0; /* position type = xyz */
|
sol->type = 0; /* position type = xyz */
|
||||||
|
|
||||||
@ -533,8 +533,8 @@ int decode_solenu(char *buff, const solopt_t *opt, sol_t *sol)
|
|||||||
{
|
{
|
||||||
sol->rr[j] = val[i++]; /* enu */
|
sol->rr[j] = val[i++]; /* enu */
|
||||||
}
|
}
|
||||||
if (i < n) sol->stat = (unsigned char)val[i++];
|
if (i < n) sol->stat = static_cast<unsigned char>(val[i++]);
|
||||||
if (i < n) sol->ns = (unsigned char)val[i++];
|
if (i < n) sol->ns = static_cast<unsigned char>(val[i++]);
|
||||||
if (i + 3 < n)
|
if (i + 3 < n)
|
||||||
{
|
{
|
||||||
Q[0] = val[i] * val[i];
|
Q[0] = val[i] * val[i];
|
||||||
@ -554,8 +554,8 @@ int decode_solenu(char *buff, const solopt_t *opt, sol_t *sol)
|
|||||||
}
|
}
|
||||||
covtosol(Q, sol);
|
covtosol(Q, sol);
|
||||||
}
|
}
|
||||||
if (i < n) sol->age = (float)val[i++];
|
if (i < n) sol->age = static_cast<float>(val[i++]);
|
||||||
if (i < n) sol->ratio = (float)val[i];
|
if (i < n) sol->ratio = static_cast<float>(val[i]);
|
||||||
|
|
||||||
sol->type = 1; /* position type = enu */
|
sol->type = 1; /* position type = enu */
|
||||||
|
|
||||||
@ -682,7 +682,7 @@ void decode_solopt(char *buff, solopt_t *opt)
|
|||||||
|
|
||||||
trace(4, "decode_solhead: buff=%s\n", buff);
|
trace(4, "decode_solhead: buff=%s\n", buff);
|
||||||
|
|
||||||
if (strncmp(buff, COMMENTH, 1) && strncmp(buff, "+", 1)) return;
|
if (strncmp(buff, COMMENTH, 1) != 0 && strncmp(buff, "+", 1)) return;
|
||||||
|
|
||||||
if (strstr(buff, "GPST"))
|
if (strstr(buff, "GPST"))
|
||||||
opt->times = TIMES_GPST;
|
opt->times = TIMES_GPST;
|
||||||
@ -776,13 +776,13 @@ int inputsol(unsigned char data, gtime_t ts, gtime_t te, double tint,
|
|||||||
solbuf->nb = 0;
|
solbuf->nb = 0;
|
||||||
|
|
||||||
/* check disconnect message */
|
/* check disconnect message */
|
||||||
if (!strcmp((char *)solbuf->buff, MSG_DISCONN))
|
if (!strcmp(reinterpret_cast<char *>(solbuf->buff), MSG_DISCONN))
|
||||||
{
|
{
|
||||||
trace(3, "disconnect received\n");
|
trace(3, "disconnect received\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* decode solution */
|
/* decode solution */
|
||||||
if ((stat = decode_sol((char *)solbuf->buff, opt, &sol, solbuf->rb)) > 0)
|
if ((stat = decode_sol(reinterpret_cast<char *>(solbuf->buff), opt, &sol, solbuf->rb)) > 0)
|
||||||
{
|
{
|
||||||
solbuf->time = sol.time; /* update current time */
|
solbuf->time = sol.time; /* update current time */
|
||||||
}
|
}
|
||||||
@ -806,7 +806,7 @@ int readsoldata(FILE *fp, gtime_t ts, gtime_t te, double tint, int qflag,
|
|||||||
while ((c = fgetc(fp)) != EOF)
|
while ((c = fgetc(fp)) != EOF)
|
||||||
{
|
{
|
||||||
/* input solution */
|
/* input solution */
|
||||||
inputsol((unsigned char)c, ts, te, tint, qflag, opt, solbuf);
|
inputsol(static_cast<unsigned char>(c), ts, te, tint, qflag, opt, solbuf);
|
||||||
}
|
}
|
||||||
return solbuf->n > 0;
|
return solbuf->n > 0;
|
||||||
}
|
}
|
||||||
@ -830,7 +830,7 @@ int sort_solbuf(solbuf_t *solbuf)
|
|||||||
|
|
||||||
if (solbuf->n <= 0) return 0;
|
if (solbuf->n <= 0) return 0;
|
||||||
|
|
||||||
if (!(solbuf_data = (sol_t *)realloc(solbuf->data, sizeof(sol_t) * solbuf->n)))
|
if (!(solbuf_data = static_cast<sol_t *>(realloc(solbuf->data, sizeof(sol_t) * solbuf->n))))
|
||||||
{
|
{
|
||||||
trace(1, "sort_solbuf: memory allocation error\n");
|
trace(1, "sort_solbuf: memory allocation error\n");
|
||||||
free(solbuf->data);
|
free(solbuf->data);
|
||||||
@ -871,7 +871,7 @@ int readsolt(char *files[], int nfile, gtime_t ts, gtime_t te,
|
|||||||
|
|
||||||
for (i = 0; i < nfile; i++)
|
for (i = 0; i < nfile; i++)
|
||||||
{
|
{
|
||||||
if (!(fp = fopen(files[i], "rb")))
|
if (!(fp = fopen(files[i], "rbe")))
|
||||||
{
|
{
|
||||||
trace(1, "readsolt: file open error %s\n", files[i]);
|
trace(1, "readsolt: file open error %s\n", files[i]);
|
||||||
continue;
|
continue;
|
||||||
@ -931,7 +931,7 @@ int addsol(solbuf_t *solbuf, const sol_t *sol)
|
|||||||
if (solbuf->n >= solbuf->nmax)
|
if (solbuf->n >= solbuf->nmax)
|
||||||
{
|
{
|
||||||
solbuf->nmax = solbuf->nmax == 0 ? 8192 : solbuf->nmax * 2;
|
solbuf->nmax = solbuf->nmax == 0 ? 8192 : solbuf->nmax * 2;
|
||||||
if (!(solbuf_data = (sol_t *)realloc(solbuf->data, sizeof(sol_t) * solbuf->nmax)))
|
if (!(solbuf_data = static_cast<sol_t *>(realloc(solbuf->data, sizeof(sol_t) * solbuf->nmax))))
|
||||||
{
|
{
|
||||||
trace(1, "addsol: memory allocation error\n");
|
trace(1, "addsol: memory allocation error\n");
|
||||||
free(solbuf->data);
|
free(solbuf->data);
|
||||||
@ -985,7 +985,7 @@ void initsolbuf(solbuf_t *solbuf, int cyclic, int nmax)
|
|||||||
if (cyclic)
|
if (cyclic)
|
||||||
{
|
{
|
||||||
if (nmax <= 2) nmax = 2;
|
if (nmax <= 2) nmax = 2;
|
||||||
if (!(solbuf->data = (sol_t *)malloc(sizeof(sol_t) * nmax)))
|
if (!(solbuf->data = static_cast<sol_t *>(malloc(sizeof(sol_t) * nmax))))
|
||||||
{
|
{
|
||||||
trace(1, "initsolbuf: memory allocation error\n");
|
trace(1, "initsolbuf: memory allocation error\n");
|
||||||
return;
|
return;
|
||||||
@ -1038,7 +1038,7 @@ int sort_solstat(solstatbuf_t *statbuf)
|
|||||||
|
|
||||||
if (statbuf->n <= 0) return 0;
|
if (statbuf->n <= 0) return 0;
|
||||||
|
|
||||||
if (!(statbuf_data = (solstat_t *)realloc(statbuf->data, sizeof(solstat_t) * statbuf->n)))
|
if (!(statbuf_data = static_cast<solstat_t *>(realloc(statbuf->data, sizeof(solstat_t) * statbuf->n))))
|
||||||
{
|
{
|
||||||
trace(1, "sort_solstat: memory allocation error\n");
|
trace(1, "sort_solstat: memory allocation error\n");
|
||||||
free(statbuf->data);
|
free(statbuf->data);
|
||||||
@ -1084,18 +1084,18 @@ int decode_solstat(char *buff, solstat_t *stat)
|
|||||||
}
|
}
|
||||||
*stat = stat0;
|
*stat = stat0;
|
||||||
stat->time = gpst2time(week, tow);
|
stat->time = gpst2time(week, tow);
|
||||||
stat->sat = (unsigned char)sat;
|
stat->sat = static_cast<unsigned char>(sat);
|
||||||
stat->frq = (unsigned char)frq;
|
stat->frq = static_cast<unsigned char>(frq);
|
||||||
stat->az = (float)(az * D2R);
|
stat->az = static_cast<float>(az * D2R);
|
||||||
stat->el = (float)(el * D2R);
|
stat->el = static_cast<float>(el * D2R);
|
||||||
stat->resp = (float)resp;
|
stat->resp = static_cast<float>(resp);
|
||||||
stat->resc = (float)resc;
|
stat->resc = static_cast<float>(resc);
|
||||||
stat->flag = (unsigned char)((vsat << 5) + (slip << 3) + fix);
|
stat->flag = static_cast<unsigned char>((vsat << 5) + (slip << 3) + fix);
|
||||||
stat->snr = (unsigned char)(snr * 4.0 + 0.5);
|
stat->snr = static_cast<unsigned char>(snr * 4.0 + 0.5);
|
||||||
stat->lock = (unsigned short)lock;
|
stat->lock = static_cast<uint16_t>(lock);
|
||||||
stat->outc = (unsigned short)outc;
|
stat->outc = static_cast<uint16_t>(outc);
|
||||||
stat->slipc = (unsigned short)slipc;
|
stat->slipc = static_cast<uint16_t>(slipc);
|
||||||
stat->rejc = (unsigned short)rejc;
|
stat->rejc = static_cast<uint16_t>(rejc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1110,8 +1110,8 @@ void addsolstat(solstatbuf_t *statbuf, const solstat_t *stat)
|
|||||||
if (statbuf->n >= statbuf->nmax)
|
if (statbuf->n >= statbuf->nmax)
|
||||||
{
|
{
|
||||||
statbuf->nmax = statbuf->nmax == 0 ? 8192 : statbuf->nmax * 2;
|
statbuf->nmax = statbuf->nmax == 0 ? 8192 : statbuf->nmax * 2;
|
||||||
if (!(statbuf_data = (solstat_t *)realloc(statbuf->data, sizeof(solstat_t) *
|
if (!(statbuf_data = static_cast<solstat_t *>(realloc(statbuf->data, sizeof(solstat_t) *
|
||||||
statbuf->nmax)))
|
statbuf->nmax))))
|
||||||
{
|
{
|
||||||
trace(1, "addsolstat: memory allocation error\n");
|
trace(1, "addsolstat: memory allocation error\n");
|
||||||
free(statbuf->data);
|
free(statbuf->data);
|
||||||
@ -1174,7 +1174,7 @@ int readsolstatt(char *files[], int nfile, gtime_t ts, gtime_t te,
|
|||||||
for (i = 0; i < nfile; i++)
|
for (i = 0; i < nfile; i++)
|
||||||
{
|
{
|
||||||
sprintf(path, "%s.stat", files[i]);
|
sprintf(path, "%s.stat", files[i]);
|
||||||
if (!(fp = fopen(path, "r")))
|
if (!(fp = fopen(path, "re")))
|
||||||
{
|
{
|
||||||
trace(1, "readsolstatt: file open error %s\n", path);
|
trace(1, "readsolstatt: file open error %s\n", path);
|
||||||
continue;
|
continue;
|
||||||
@ -1205,7 +1205,7 @@ int outecef(unsigned char *buff, const char *s, const sol_t *sol,
|
|||||||
const solopt_t *opt)
|
const solopt_t *opt)
|
||||||
{
|
{
|
||||||
const char *sep = opt2sep(opt);
|
const char *sep = opt2sep(opt);
|
||||||
char *p = (char *)buff;
|
char *p = reinterpret_cast<char *>(buff);
|
||||||
|
|
||||||
trace(3, "outecef:\n");
|
trace(3, "outecef:\n");
|
||||||
|
|
||||||
@ -1214,7 +1214,7 @@ int outecef(unsigned char *buff, const char *s, const sol_t *sol,
|
|||||||
sol->ns, sep, SQRT_SOL(sol->qr[0]), sep, SQRT_SOL(sol->qr[1]), sep, SQRT_SOL(sol->qr[2]),
|
sol->ns, sep, SQRT_SOL(sol->qr[0]), sep, SQRT_SOL(sol->qr[1]), sep, SQRT_SOL(sol->qr[2]),
|
||||||
sep, sqvar(sol->qr[3]), sep, sqvar(sol->qr[4]), sep, sqvar(sol->qr[5]),
|
sep, sqvar(sol->qr[3]), sep, sqvar(sol->qr[4]), sep, sqvar(sol->qr[5]),
|
||||||
sep, sol->age, sep, sol->ratio);
|
sep, sol->age, sep, sol->ratio);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1224,7 +1224,7 @@ int outpos(unsigned char *buff, const char *s, const sol_t *sol,
|
|||||||
{
|
{
|
||||||
double pos[3], dms1[3], dms2[3], P[9], Q[9];
|
double pos[3], dms1[3], dms2[3], P[9], Q[9];
|
||||||
const char *sep = opt2sep(opt);
|
const char *sep = opt2sep(opt);
|
||||||
char *p = (char *)buff;
|
char *p = reinterpret_cast<char *>(buff);
|
||||||
|
|
||||||
trace(3, "outpos :\n");
|
trace(3, "outpos :\n");
|
||||||
|
|
||||||
@ -1249,7 +1249,7 @@ int outpos(unsigned char *buff, const char *s, const sol_t *sol,
|
|||||||
sep, pos[2], sep, sol->stat, sep, sol->ns, sep, SQRT_SOL(Q[4]), sep,
|
sep, pos[2], sep, sol->stat, sep, sol->ns, sep, SQRT_SOL(Q[4]), sep,
|
||||||
SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]), sep, sqvar(Q[2]),
|
SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]), sep, sqvar(Q[2]),
|
||||||
sep, sqvar(Q[5]), sep, sol->age, sep, sol->ratio);
|
sep, sqvar(Q[5]), sep, sol->age, sep, sol->ratio);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1260,7 +1260,7 @@ int outenu(unsigned char *buff, const char *s, const sol_t *sol,
|
|||||||
double pos[3], rr[3], enu[3], P[9], Q[9];
|
double pos[3], rr[3], enu[3], P[9], Q[9];
|
||||||
int i;
|
int i;
|
||||||
const char *sep = opt2sep(opt);
|
const char *sep = opt2sep(opt);
|
||||||
char *p = (char *)buff;
|
char *p = reinterpret_cast<char *>(buff);
|
||||||
|
|
||||||
trace(3, "outenu :\n");
|
trace(3, "outenu :\n");
|
||||||
|
|
||||||
@ -1273,7 +1273,7 @@ int outenu(unsigned char *buff, const char *s, const sol_t *sol,
|
|||||||
s, sep, enu[0], sep, enu[1], sep, enu[2], sep, sol->stat, sep, sol->ns, sep,
|
s, sep, enu[0], sep, enu[1], sep, enu[2], sep, sol->stat, sep, sol->ns, sep,
|
||||||
SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[4]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]),
|
SQRT_SOL(Q[0]), sep, SQRT_SOL(Q[4]), sep, SQRT_SOL(Q[8]), sep, sqvar(Q[1]),
|
||||||
sep, sqvar(Q[5]), sep, sqvar(Q[2]), sep, sol->age, sep, sol->ratio);
|
sep, sqvar(Q[5]), sep, sqvar(Q[2]), sep, sol->age, sep, sol->ratio);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1283,16 +1283,16 @@ int outnmea_rmc(unsigned char *buff, const sol_t *sol)
|
|||||||
static double dirp = 0.0;
|
static double dirp = 0.0;
|
||||||
gtime_t time;
|
gtime_t time;
|
||||||
double ep[6], pos[3], enuv[3], dms1[3], dms2[3], vel, dir, amag = 0.0;
|
double ep[6], pos[3], enuv[3], dms1[3], dms2[3], vel, dir, amag = 0.0;
|
||||||
char *p = (char *)buff, *q, sum, *emag = (char *)"E";
|
char *p = reinterpret_cast<char *>(buff), *q, sum, *emag = (char *)"E";
|
||||||
|
|
||||||
trace(3, "outnmea_rmc:\n");
|
trace(3, "outnmea_rmc:\n");
|
||||||
|
|
||||||
if (sol->stat <= SOLQ_NONE)
|
if (sol->stat <= SOLQ_NONE)
|
||||||
{
|
{
|
||||||
p += sprintf(p, "$GPRMC,,,,,,,,,,,,");
|
p += sprintf(p, "$GPRMC,,,,,,,,,,,,");
|
||||||
for (q = (char *)buff + 1, sum = 0; *q; q++) sum ^= *q;
|
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) sum ^= *q;
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
time = gpst2utc(sol->time);
|
time = gpst2utc(sol->time);
|
||||||
if (time.sec >= 0.995)
|
if (time.sec >= 0.995)
|
||||||
@ -1317,11 +1317,11 @@ int outnmea_rmc(unsigned char *buff, const sol_t *sol)
|
|||||||
p += sprintf(p, "$GPRMC,%02.0f%02.0f%05.2f,A,%02.0f%010.7f,%s,%03.0f%010.7f,%s,%4.2f,%4.2f,%02.0f%02.0f%02d,%.1f,%s,%s",
|
p += sprintf(p, "$GPRMC,%02.0f%02.0f%05.2f,A,%02.0f%010.7f,%s,%03.0f%010.7f,%s,%4.2f,%4.2f,%02.0f%02.0f%02d,%.1f,%s,%s",
|
||||||
ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S",
|
ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S",
|
||||||
dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", vel / KNOT2M, dir,
|
dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", vel / KNOT2M, dir,
|
||||||
ep[2], ep[1], (int)ep[0] % 100, amag, emag,
|
ep[2], ep[1], static_cast<int>(ep[0]) % 100, amag, emag,
|
||||||
sol->stat == SOLQ_DGPS || sol->stat == SOLQ_FLOAT || sol->stat == SOLQ_FIX ? "D" : "A");
|
sol->stat == SOLQ_DGPS || sol->stat == SOLQ_FLOAT || sol->stat == SOLQ_FIX ? "D" : "A");
|
||||||
for (q = (char *)buff + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1331,16 +1331,16 @@ int outnmea_gga(unsigned char *buff, const sol_t *sol)
|
|||||||
gtime_t time;
|
gtime_t time;
|
||||||
double h, ep[6], pos[3], dms1[3], dms2[3], dop = 1.0;
|
double h, ep[6], pos[3], dms1[3], dms2[3], dop = 1.0;
|
||||||
int solq;
|
int solq;
|
||||||
char *p = (char *)buff, *q, sum;
|
char *p = reinterpret_cast<char *>(buff), *q, sum;
|
||||||
|
|
||||||
trace(3, "outnmea_gga:\n");
|
trace(3, "outnmea_gga:\n");
|
||||||
|
|
||||||
if (sol->stat <= SOLQ_NONE)
|
if (sol->stat <= SOLQ_NONE)
|
||||||
{
|
{
|
||||||
p += sprintf(p, "$GPGGA,,,,,,,,,,,,,,");
|
p += sprintf(p, "$GPGGA,,,,,,,,,,,,,,");
|
||||||
for (q = (char *)buff + 1, sum = 0; *q; q++) sum ^= *q;
|
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) sum ^= *q;
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
for (solq = 0; solq < 8; solq++)
|
for (solq = 0; solq < 8; solq++)
|
||||||
if (solq_nmea[solq] == sol->stat) break;
|
if (solq_nmea[solq] == sol->stat) break;
|
||||||
@ -1360,9 +1360,9 @@ int outnmea_gga(unsigned char *buff, const sol_t *sol)
|
|||||||
ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S",
|
ep[3], ep[4], ep[5], dms1[0], dms1[1] + dms1[2] / 60.0, pos[0] >= 0 ? "N" : "S",
|
||||||
dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", solq,
|
dms2[0], dms2[1] + dms2[2] / 60.0, pos[1] >= 0 ? "E" : "W", solq,
|
||||||
sol->ns, dop, pos[2] - h, h, sol->age);
|
sol->ns, dop, pos[2] - h, h, sol->age);
|
||||||
for (q = (char *)buff + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1372,16 +1372,16 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
|
|||||||
{
|
{
|
||||||
double azel[MAXSAT * 2], dop[4];
|
double azel[MAXSAT * 2], dop[4];
|
||||||
int i, sat, sys, nsat, prn[MAXSAT];
|
int i, sat, sys, nsat, prn[MAXSAT];
|
||||||
char *p = (char *)buff, *q, *s, sum;
|
char *p = reinterpret_cast<char *>(buff), *q, *s, sum;
|
||||||
|
|
||||||
trace(3, "outnmea_gsa:\n");
|
trace(3, "outnmea_gsa:\n");
|
||||||
|
|
||||||
if (sol->stat <= SOLQ_NONE)
|
if (sol->stat <= SOLQ_NONE)
|
||||||
{
|
{
|
||||||
p += sprintf(p, "$GPGSA,A,1,,,,,,,,,,,,,,,");
|
p += sprintf(p, "$GPGSA,A,1,,,,,,,,,,,,,,,");
|
||||||
for (q = (char *)buff + 1, sum = 0; *q; q++) sum ^= *q;
|
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) sum ^= *q;
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GPGSA: gps/sbas */
|
/* GPGSA: gps/sbas */
|
||||||
@ -1458,7 +1458,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol,
|
|||||||
for (q = s + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
for (q = s + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
}
|
}
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1468,16 +1468,16 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
|
|||||||
{
|
{
|
||||||
double az, el, snr;
|
double az, el, snr;
|
||||||
int i, j, k, n, sat, prn, sys, nmsg, sats[MAXSAT];
|
int i, j, k, n, sat, prn, sys, nmsg, sats[MAXSAT];
|
||||||
char *p = (char *)buff, *q, *s, sum;
|
char *p = reinterpret_cast<char *>(buff), *q, *s, sum;
|
||||||
|
|
||||||
trace(3, "outnmea_gsv:\n");
|
trace(3, "outnmea_gsv:\n");
|
||||||
|
|
||||||
if (sol->stat <= SOLQ_NONE)
|
if (sol->stat <= SOLQ_NONE)
|
||||||
{
|
{
|
||||||
p += sprintf(p, "$GPGSV,1,1,0,,,,,,,,,,,,,,,,");
|
p += sprintf(p, "$GPGSV,1,1,0,,,,,,,,,,,,,,,,");
|
||||||
for (q = (char *)buff + 1, sum = 0; *q; q++) sum ^= *q;
|
for (q = reinterpret_cast<char *>(buff) + 1, sum = 0; *q; q++) sum ^= *q;
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
/* GPGSV: gps/sbas */
|
/* GPGSV: gps/sbas */
|
||||||
for (sat = 1, n = 0; sat < MAXSAT && n < 12; sat++)
|
for (sat = 1, n = 0; sat < MAXSAT && n < 12; sat++)
|
||||||
@ -1574,7 +1574,7 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol,
|
|||||||
for (q = s + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
for (q = s + 1, sum = 0; *q; q++) sum ^= *q; /* check-sum */
|
||||||
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
p += sprintf(p, "*%02X%c%c", sum, 0x0D, 0x0A);
|
||||||
}
|
}
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1601,7 +1601,7 @@ int outprcopts(unsigned char *buff, const prcopt_t *opt)
|
|||||||
const char *s8[] = {"off", "continuous", "instantaneous", "fix and hold", ""};
|
const char *s8[] = {"off", "continuous", "instantaneous", "fix and hold", ""};
|
||||||
const char *s9[] = {"off", "on", "auto calib", "external calib", ""};
|
const char *s9[] = {"off", "on", "auto calib", "external calib", ""};
|
||||||
int i;
|
int i;
|
||||||
char *p = (char *)buff;
|
char *p = reinterpret_cast<char *>(buff);
|
||||||
|
|
||||||
trace(3, "outprcopts:\n");
|
trace(3, "outprcopts:\n");
|
||||||
|
|
||||||
@ -1660,7 +1660,7 @@ int outprcopts(unsigned char *buff, const prcopt_t *opt)
|
|||||||
i + 1, opt->anttype[i], opt->antdel[i][0], opt->antdel[i][1],
|
i + 1, opt->anttype[i], opt->antdel[i][0], opt->antdel[i][1],
|
||||||
opt->antdel[i][2]);
|
opt->antdel[i][2]);
|
||||||
}
|
}
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1674,7 +1674,7 @@ int outsolheads(unsigned char *buff, const solopt_t *opt)
|
|||||||
{
|
{
|
||||||
const char *s1[] = {"WGS84", "Tokyo"}, *s2[] = {"ellipsoidal", "geodetic"};
|
const char *s1[] = {"WGS84", "Tokyo"}, *s2[] = {"ellipsoidal", "geodetic"};
|
||||||
const char *s3[] = {"GPST", "UTC ", "JST "}, *sep = opt2sep(opt);
|
const char *s3[] = {"GPST", "UTC ", "JST "}, *sep = opt2sep(opt);
|
||||||
char *p = (char *)buff;
|
char *p = reinterpret_cast<char *>(buff);
|
||||||
int timeu = opt->timeu < 0 ? 0 : (opt->timeu > 20 ? 20 : opt->timeu);
|
int timeu = opt->timeu < 0 ? 0 : (opt->timeu > 20 ? 20 : opt->timeu);
|
||||||
|
|
||||||
trace(3, "outsolheads:\n");
|
trace(3, "outsolheads:\n");
|
||||||
@ -1725,7 +1725,7 @@ int outsolheads(unsigned char *buff, const solopt_t *opt)
|
|||||||
"Q", sep, "ns", sep, "sde(m)", sep, "sdn(m)", sep, "sdu(m)", sep,
|
"Q", sep, "ns", sep, "sde(m)", sep, "sdn(m)", sep, "sdu(m)", sep,
|
||||||
"sden(m)", sep, "sdnu(m)", sep, "sdue(m)", sep, "age(s)", sep, "ratio");
|
"sden(m)", sep, "sdnu(m)", sep, "sdue(m)", sep, "age(s)", sep, "ratio");
|
||||||
}
|
}
|
||||||
return p - (char *)buff;
|
return p - reinterpret_cast<char *>(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,12 +53,12 @@
|
|||||||
#include <rtklib_stream.h>
|
#include <rtklib_stream.h>
|
||||||
#include <rtklib_rtkcmn.h>
|
#include <rtklib_rtkcmn.h>
|
||||||
#include <rtklib_solution.h>
|
#include <rtklib_solution.h>
|
||||||
#include <ctype.h>
|
#include <cctype>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <errno.h>
|
#include <cerrno>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
@ -90,13 +90,15 @@ serial_t *openserial(const char *path, int mode, char *msg)
|
|||||||
|
|
||||||
const speed_t bs[] = {
|
const speed_t bs[] = {
|
||||||
B300, B600, B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400};
|
B300, B600, B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400};
|
||||||
struct termios ios;
|
struct termios ios
|
||||||
|
{
|
||||||
|
};
|
||||||
int rw = 0;
|
int rw = 0;
|
||||||
tracet(3, "openserial: path=%s mode=%d\n", path, mode);
|
tracet(3, "openserial: path=%s mode=%d\n", path, mode);
|
||||||
|
|
||||||
if (!(serial = (serial_t *)malloc(sizeof(serial_t)))) return NULL;
|
if (!(serial = static_cast<serial_t *>(malloc(sizeof(serial_t))))) return nullptr;
|
||||||
|
|
||||||
if ((p = strchr((char *)path, ':')))
|
if ((p = strchr(const_cast<char *>(path), ':')))
|
||||||
{
|
{
|
||||||
strncpy(port, path, p - path);
|
strncpy(port, path, p - path);
|
||||||
port[p - path] = '\0';
|
port[p - path] = '\0';
|
||||||
@ -112,9 +114,9 @@ serial_t *openserial(const char *path, int mode, char *msg)
|
|||||||
sprintf(msg, "bitrate error (%d)", brate);
|
sprintf(msg, "bitrate error (%d)", brate);
|
||||||
tracet(1, "openserial: %s path=%s\n", msg, path);
|
tracet(1, "openserial: %s path=%s\n", msg, path);
|
||||||
free(serial);
|
free(serial);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
parity = (char)toupper((int)parity);
|
parity = static_cast<char>(toupper(static_cast<int>(parity)));
|
||||||
|
|
||||||
// sprintf(dev, "/dev/%s", port); This line triggers a warning. Replaced by:
|
// sprintf(dev, "/dev/%s", port); This line triggers a warning. Replaced by:
|
||||||
std::string s_aux = "/dev/" + std::string(port);
|
std::string s_aux = "/dev/" + std::string(port);
|
||||||
@ -135,7 +137,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
|
|||||||
sprintf(msg, "device open error (%d)", errno);
|
sprintf(msg, "device open error (%d)", errno);
|
||||||
tracet(1, "openserial: %s dev=%s\n", msg, dev);
|
tracet(1, "openserial: %s dev=%s\n", msg, dev);
|
||||||
free(serial);
|
free(serial);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
tcgetattr(serial->dev, &ios);
|
tcgetattr(serial->dev, &ios);
|
||||||
ios.c_iflag = 0;
|
ios.c_iflag = 0;
|
||||||
@ -277,7 +279,7 @@ int openfile_(file_t *file, gtime_t time, char *msg)
|
|||||||
}
|
}
|
||||||
else if (file->mode & STR_MODE_W)
|
else if (file->mode & STR_MODE_W)
|
||||||
{ /* remove time-tag */
|
{ /* remove time-tag */
|
||||||
if ((fp = fopen(tagpath, "rb")))
|
if ((fp = fopen(tagpath, "rbe")))
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (remove(tagpath) != 0) trace(1, "Error removing file");
|
if (remove(tagpath) != 0) trace(1, "Error removing file");
|
||||||
@ -295,7 +297,7 @@ void closefile_(file_t *file)
|
|||||||
if (file->fp_tag) fclose(file->fp_tag);
|
if (file->fp_tag) fclose(file->fp_tag);
|
||||||
if (file->fp_tmp) fclose(file->fp_tmp);
|
if (file->fp_tmp) fclose(file->fp_tmp);
|
||||||
if (file->fp_tag_tmp) fclose(file->fp_tag_tmp);
|
if (file->fp_tag_tmp) fclose(file->fp_tag_tmp);
|
||||||
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = NULL;
|
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -310,10 +312,10 @@ file_t *openfile(const char *path, int mode, char *msg)
|
|||||||
|
|
||||||
tracet(3, "openfile: path=%s mode=%d\n", path, mode);
|
tracet(3, "openfile: path=%s mode=%d\n", path, mode);
|
||||||
|
|
||||||
if (!(mode & (STR_MODE_R | STR_MODE_W))) return NULL;
|
if (!(mode & (STR_MODE_R | STR_MODE_W))) return nullptr;
|
||||||
|
|
||||||
/* file options */
|
/* file options */
|
||||||
for (p = (char *)path; (p = strstr(p, "::")); p += 2)
|
for (p = const_cast<char *>(path); (p = strstr(p, "::")); p += 2)
|
||||||
{ /* file options */
|
{ /* file options */
|
||||||
if (*(p + 2) == 'T')
|
if (*(p + 2) == 'T')
|
||||||
timetag = 1;
|
timetag = 1;
|
||||||
@ -327,9 +329,9 @@ file_t *openfile(const char *path, int mode, char *msg)
|
|||||||
if (start <= 0.0) start = 0.0;
|
if (start <= 0.0) start = 0.0;
|
||||||
if (swapintv <= 0.0) swapintv = 0.0;
|
if (swapintv <= 0.0) swapintv = 0.0;
|
||||||
|
|
||||||
if (!(file = (file_t *)malloc(sizeof(file_t)))) return NULL;
|
if (!(file = static_cast<file_t *>(malloc(sizeof(file_t))))) return nullptr;
|
||||||
|
|
||||||
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = NULL;
|
file->fp = file->fp_tag = file->fp_tmp = file->fp_tag_tmp = nullptr;
|
||||||
if (strlen(path) < MAXSTRPATH) strcpy(file->path, path);
|
if (strlen(path) < MAXSTRPATH) strcpy(file->path, path);
|
||||||
if ((p = strstr(file->path, "::"))) *p = '\0';
|
if ((p = strstr(file->path, "::"))) *p = '\0';
|
||||||
file->openpath[0] = '\0';
|
file->openpath[0] = '\0';
|
||||||
@ -350,7 +352,7 @@ file_t *openfile(const char *path, int mode, char *msg)
|
|||||||
if (!openfile_(file, time, msg))
|
if (!openfile_(file, time, msg))
|
||||||
{
|
{
|
||||||
free(file);
|
free(file);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
@ -399,7 +401,7 @@ void swapclose(file_t *file)
|
|||||||
tracet(3, "swapclose: fp_tmp=%d\n", file->fp_tmp);
|
tracet(3, "swapclose: fp_tmp=%d\n", file->fp_tmp);
|
||||||
if (file->fp_tmp) fclose(file->fp_tmp);
|
if (file->fp_tmp) fclose(file->fp_tmp);
|
||||||
if (file->fp_tag_tmp) fclose(file->fp_tag_tmp);
|
if (file->fp_tag_tmp) fclose(file->fp_tag_tmp);
|
||||||
file->fp_tmp = file->fp_tag_tmp = NULL;
|
file->fp_tmp = file->fp_tag_tmp = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -427,7 +429,7 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
|
|||||||
/* input from stdin */
|
/* input from stdin */
|
||||||
FD_ZERO(&rs);
|
FD_ZERO(&rs);
|
||||||
FD_SET(0, &rs);
|
FD_SET(0, &rs);
|
||||||
if (!select(1, &rs, NULL, NULL, &tv)) return 0;
|
if (!select(1, &rs, nullptr, nullptr, &tv)) return 0;
|
||||||
if ((nr = read(0, buff, nmax)) < 0) return 0;
|
if ((nr = read(0, buff, nmax)) < 0) return 0;
|
||||||
return nr;
|
return nr;
|
||||||
}
|
}
|
||||||
@ -435,11 +437,11 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
|
|||||||
{
|
{
|
||||||
if (file->repmode)
|
if (file->repmode)
|
||||||
{ /* slave */
|
{ /* slave */
|
||||||
t = (unsigned int)(tick_master + file->offset);
|
t = (tick_master + file->offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* master */
|
{ /* master */
|
||||||
t = (unsigned int)((tickget() - file->tick) * file->speed + file->start * 1000.0);
|
t = static_cast<unsigned int>((tickget() - file->tick) * file->speed + file->start * 1000.0);
|
||||||
}
|
}
|
||||||
for (;;)
|
for (;;)
|
||||||
{ /* seek file position */
|
{ /* seek file position */
|
||||||
@ -452,23 +454,23 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
|
|||||||
}
|
}
|
||||||
if (file->repmode || file->speed > 0.0)
|
if (file->repmode || file->speed > 0.0)
|
||||||
{
|
{
|
||||||
if ((int)(tick - t) < 1) continue;
|
if (static_cast<int>(tick - t) < 1) continue;
|
||||||
}
|
}
|
||||||
if (!file->repmode) tick_master = tick;
|
if (!file->repmode) tick_master = tick;
|
||||||
|
|
||||||
sprintf(msg, "T%+.1fs", (int)tick < 0 ? 0.0 : (int)tick / 1000.0);
|
sprintf(msg, "T%+.1fs", static_cast<int>(tick) < 0 ? 0.0 : static_cast<int>(tick) / 1000.0);
|
||||||
|
|
||||||
if ((int)(fpos - file->fpos) >= nmax)
|
if (static_cast<int>(fpos - file->fpos) >= nmax)
|
||||||
{
|
{
|
||||||
if (fseek(file->fp, fpos, SEEK_SET) != 0) trace(1, "Error fseek");
|
if (fseek(file->fp, fpos, SEEK_SET) != 0) trace(1, "Error fseek");
|
||||||
file->fpos = fpos;
|
file->fpos = fpos;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
nmax = (int)(fpos - file->fpos);
|
nmax = static_cast<int>(fpos - file->fpos);
|
||||||
|
|
||||||
if (file->repmode || file->speed > 0.0)
|
if (file->repmode || file->speed > 0.0)
|
||||||
{
|
{
|
||||||
if (fseek(file->fp_tag, -(long)(sizeof(tick) + sizeof(fpos)), SEEK_CUR) != 0) trace(1, "Error fseek");
|
if (fseek(file->fp_tag, -static_cast<int64_t>(sizeof(tick) + sizeof(fpos)), SEEK_CUR) != 0) trace(1, "Error fseek");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -480,7 +482,7 @@ int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
|
|||||||
if (nr <= 0) sprintf(msg, "end");
|
if (nr <= 0) sprintf(msg, "end");
|
||||||
}
|
}
|
||||||
tracet(5, "readfile: fp=%d nr=%d fpos=%d\n", file->fp, nr, file->fpos);
|
tracet(5, "readfile: fp=%d nr=%d fpos=%d\n", file->fp, nr, file->fpos);
|
||||||
return (int)nr;
|
return nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -546,7 +548,7 @@ int writefile(file_t *file, unsigned char *buff, int n, char *msg)
|
|||||||
}
|
}
|
||||||
tracet(5, "writefile: fp=%d ns=%d tick=%5d fpos=%d\n", file->fp, ns, tick, fpos);
|
tracet(5, "writefile: fp=%d ns=%d tick=%5d fpos=%d\n", file->fp, ns, tick, fpos);
|
||||||
|
|
||||||
return (int)ns;
|
return static_cast<int>(ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -556,7 +558,7 @@ void syncfile(file_t *file1, file_t *file2)
|
|||||||
if (!file1->fp_tag || !file2->fp_tag) return;
|
if (!file1->fp_tag || !file2->fp_tag) return;
|
||||||
file1->repmode = 0;
|
file1->repmode = 0;
|
||||||
file2->repmode = 1;
|
file2->repmode = 1;
|
||||||
file2->offset = (int)(file1->tick_f - file2->tick_f);
|
file2->offset = static_cast<int>(file1->tick_f - file2->tick_f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -622,21 +624,21 @@ int setsock(socket_t sock, char *msg)
|
|||||||
|
|
||||||
tracet(3, "setsock: sock=%d\n", sock);
|
tracet(3, "setsock: sock=%d\n", sock);
|
||||||
|
|
||||||
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(tv)) == -1 ||
|
if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv)) == -1 ||
|
||||||
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char *)&tv, sizeof(tv)) == -1)
|
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv)) == -1)
|
||||||
{
|
{
|
||||||
sprintf(msg, "sockopt error: notimeo");
|
sprintf(msg, "sockopt error: notimeo");
|
||||||
tracet(1, "setsock: setsockopt error 1 sock=%d err=%d\n", sock, errsock());
|
tracet(1, "setsock: setsockopt error 1 sock=%d err=%d\n", sock, errsock());
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (const char *)&bs, sizeof(bs)) == -1 ||
|
if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<const char *>(&bs), sizeof(bs)) == -1 ||
|
||||||
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (const char *)&bs, sizeof(bs)) == -1)
|
setsockopt(sock, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<const char *>(&bs), sizeof(bs)) == -1)
|
||||||
{
|
{
|
||||||
tracet(1, "setsock: setsockopt error 2 sock=%d err=%d bs=%d\n", sock, errsock(), bs);
|
tracet(1, "setsock: setsockopt error 2 sock=%d err=%d bs=%d\n", sock, errsock(), bs);
|
||||||
sprintf(msg, "sockopt error: bufsiz");
|
sprintf(msg, "sockopt error: bufsiz");
|
||||||
}
|
}
|
||||||
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&mode, sizeof(mode)) == -1)
|
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const char *>(&mode), sizeof(mode)) == -1)
|
||||||
{
|
{
|
||||||
tracet(1, "setsock: setsockopt error 3 sock=%d err=%d\n", sock, errsock());
|
tracet(1, "setsock: setsockopt error 3 sock=%d err=%d\n", sock, errsock());
|
||||||
sprintf(msg, "sockopt error: nodelay");
|
sprintf(msg, "sockopt error: nodelay");
|
||||||
@ -652,7 +654,7 @@ socket_t accept_nb(socket_t sock, struct sockaddr *addr, socklen_t *len)
|
|||||||
fd_set rs;
|
fd_set rs;
|
||||||
FD_ZERO(&rs);
|
FD_ZERO(&rs);
|
||||||
FD_SET(sock, &rs);
|
FD_SET(sock, &rs);
|
||||||
if (!select(sock + 1, &rs, NULL, NULL, &tv)) return 0;
|
if (!select(sock + 1, &rs, nullptr, nullptr, &tv)) return 0;
|
||||||
return accept(sock, addr, len);
|
return accept(sock, addr, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,7 +675,7 @@ int connect_nb(socket_t sock, struct sockaddr *addr, socklen_t len)
|
|||||||
FD_ZERO(&rs);
|
FD_ZERO(&rs);
|
||||||
FD_SET(sock, &rs);
|
FD_SET(sock, &rs);
|
||||||
ws = rs;
|
ws = rs;
|
||||||
if (select(sock + 1, &rs, &ws, NULL, &tv) == 0) return 0;
|
if (select(sock + 1, &rs, &ws, nullptr, &tv) == 0) return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -686,8 +688,8 @@ int recv_nb(socket_t sock, unsigned char *buff, int n)
|
|||||||
fd_set rs;
|
fd_set rs;
|
||||||
FD_ZERO(&rs);
|
FD_ZERO(&rs);
|
||||||
FD_SET(sock, &rs);
|
FD_SET(sock, &rs);
|
||||||
if (!select(sock + 1, &rs, NULL, NULL, &tv)) return 0;
|
if (!select(sock + 1, &rs, nullptr, nullptr, &tv)) return 0;
|
||||||
return recv(sock, (char *)buff, n, 0);
|
return recv(sock, reinterpret_cast<char *>(buff), n, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -698,8 +700,8 @@ int send_nb(socket_t sock, unsigned char *buff, int n)
|
|||||||
fd_set ws;
|
fd_set ws;
|
||||||
FD_ZERO(&ws);
|
FD_ZERO(&ws);
|
||||||
FD_SET(sock, &ws);
|
FD_SET(sock, &ws);
|
||||||
if (!select(sock + 1, NULL, &ws, NULL, &tv)) return 0;
|
if (!select(sock + 1, nullptr, &ws, nullptr, &tv)) return 0;
|
||||||
return send(sock, (char *)buff, n, 0);
|
return send(sock, reinterpret_cast<char *>(buff), n, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -714,7 +716,7 @@ int gentcp(tcp_t *tcp, int type, char *msg)
|
|||||||
tracet(3, "gentcp: type=%d\n", type);
|
tracet(3, "gentcp: type=%d\n", type);
|
||||||
|
|
||||||
/* generate socket */
|
/* generate socket */
|
||||||
if ((tcp->sock = socket(AF_INET, SOCK_STREAM, 0)) == (socket_t)-1)
|
if ((tcp->sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
|
||||||
{
|
{
|
||||||
sprintf(msg, "socket error (%d)", errsock());
|
sprintf(msg, "socket error (%d)", errsock());
|
||||||
tracet(1, "gentcp: socket error err=%d\n", errsock());
|
tracet(1, "gentcp: socket error err=%d\n", errsock());
|
||||||
@ -738,7 +740,7 @@ int gentcp(tcp_t *tcp, int type, char *msg)
|
|||||||
setsockopt(tcp->sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt,
|
setsockopt(tcp->sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt,
|
||||||
sizeof(opt));
|
sizeof(opt));
|
||||||
#endif
|
#endif
|
||||||
if (bind(tcp->sock, (struct sockaddr *)&tcp->addr, sizeof(tcp->addr)) == -1)
|
if (bind(tcp->sock, reinterpret_cast<struct sockaddr *>(&tcp->addr), sizeof(tcp->addr)) == -1)
|
||||||
{
|
{
|
||||||
sprintf(msg, "bind error (%d) : %d", errsock(), tcp->port);
|
sprintf(msg, "bind error (%d) : %d", errsock(), tcp->port);
|
||||||
tracet(1, "gentcp: bind error port=%d err=%d\n", tcp->port, errsock());
|
tracet(1, "gentcp: bind error port=%d err=%d\n", tcp->port, errsock());
|
||||||
@ -788,20 +790,20 @@ tcpsvr_t *opentcpsvr(const char *path, char *msg)
|
|||||||
tcpsvr0 = {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}, {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}}};
|
tcpsvr0 = {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}, {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}}};
|
||||||
tracet(3, "opentcpsvr: path=%s\n", path);
|
tracet(3, "opentcpsvr: path=%s\n", path);
|
||||||
|
|
||||||
if (!(tcpsvr = (tcpsvr_t *)malloc(sizeof(tcpsvr_t)))) return NULL;
|
if (!(tcpsvr = static_cast<tcpsvr_t *>(malloc(sizeof(tcpsvr_t))))) return nullptr;
|
||||||
*tcpsvr = tcpsvr0;
|
*tcpsvr = tcpsvr0;
|
||||||
decodetcppath(path, tcpsvr->svr.saddr, port, NULL, NULL, NULL, NULL);
|
decodetcppath(path, tcpsvr->svr.saddr, port, nullptr, nullptr, nullptr, nullptr);
|
||||||
if (sscanf(port, "%d", &tcpsvr->svr.port) < 1)
|
if (sscanf(port, "%d", &tcpsvr->svr.port) < 1)
|
||||||
{
|
{
|
||||||
sprintf(msg, "port error: %s", port);
|
sprintf(msg, "port error: %s", port);
|
||||||
tracet(1, "opentcpsvr: port error port=%s\n", port);
|
tracet(1, "opentcpsvr: port error port=%s\n", port);
|
||||||
free(tcpsvr);
|
free(tcpsvr);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!gentcp(&tcpsvr->svr, 0, msg))
|
if (!gentcp(&tcpsvr->svr, 0, msg))
|
||||||
{
|
{
|
||||||
free(tcpsvr);
|
free(tcpsvr);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
tcpsvr->svr.tcon = 0;
|
tcpsvr->svr.tcon = 0;
|
||||||
return tcpsvr;
|
return tcpsvr;
|
||||||
@ -866,7 +868,9 @@ void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg)
|
|||||||
/* accept client connection --------------------------------------------------*/
|
/* accept client connection --------------------------------------------------*/
|
||||||
int accsock(tcpsvr_t *tcpsvr, char *msg)
|
int accsock(tcpsvr_t *tcpsvr, char *msg)
|
||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr
|
||||||
|
{
|
||||||
|
};
|
||||||
socket_t sock;
|
socket_t sock;
|
||||||
socklen_t len = sizeof(addr);
|
socklen_t len = sizeof(addr);
|
||||||
int i, err;
|
int i, err;
|
||||||
@ -877,7 +881,7 @@ int accsock(tcpsvr_t *tcpsvr, char *msg)
|
|||||||
if (tcpsvr->cli[i].state == 0) break;
|
if (tcpsvr->cli[i].state == 0) break;
|
||||||
if (i >= MAXCLI) return 0; /* too many client */
|
if (i >= MAXCLI) return 0; /* too many client */
|
||||||
|
|
||||||
if ((sock = accept_nb(tcpsvr->svr.sock, (struct sockaddr *)&addr, &len)) == (socket_t)-1)
|
if ((sock = accept_nb(tcpsvr->svr.sock, reinterpret_cast<struct sockaddr *>(&addr), &len)) == -1)
|
||||||
{
|
{
|
||||||
err = errsock();
|
err = errsock();
|
||||||
sprintf(msg, "accept error (%d)", err);
|
sprintf(msg, "accept error (%d)", err);
|
||||||
@ -981,12 +985,12 @@ int consock(tcpcli_t *tcpcli, char *msg)
|
|||||||
|
|
||||||
/* wait re-connect */
|
/* wait re-connect */
|
||||||
if (tcpcli->svr.tcon < 0 || (tcpcli->svr.tcon > 0 &&
|
if (tcpcli->svr.tcon < 0 || (tcpcli->svr.tcon > 0 &&
|
||||||
(int)(tickget() - tcpcli->svr.tdis) < tcpcli->svr.tcon))
|
static_cast<int>(tickget() - tcpcli->svr.tdis) < tcpcli->svr.tcon))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* non-block connect */
|
/* non-block connect */
|
||||||
if ((stat = connect_nb(tcpcli->svr.sock, (struct sockaddr *)&tcpcli->svr.addr,
|
if ((stat = connect_nb(tcpcli->svr.sock, reinterpret_cast<struct sockaddr *>(&tcpcli->svr.addr),
|
||||||
sizeof(tcpcli->svr.addr))) == -1)
|
sizeof(tcpcli->svr.addr))) == -1)
|
||||||
{
|
{
|
||||||
err = errsock();
|
err = errsock();
|
||||||
@ -1018,15 +1022,15 @@ tcpcli_t *opentcpcli(const char *path, char *msg)
|
|||||||
|
|
||||||
tracet(3, "opentcpcli: path=%s\n", path);
|
tracet(3, "opentcpcli: path=%s\n", path);
|
||||||
|
|
||||||
if (!(tcpcli = (tcpcli_t *)malloc(sizeof(tcpcli_t)))) return NULL;
|
if (!(tcpcli = static_cast<tcpcli_t *>(malloc(sizeof(tcpcli_t))))) return nullptr;
|
||||||
*tcpcli = tcpcli0;
|
*tcpcli = tcpcli0;
|
||||||
decodetcppath(path, tcpcli->svr.saddr, port, NULL, NULL, NULL, NULL);
|
decodetcppath(path, tcpcli->svr.saddr, port, nullptr, nullptr, nullptr, nullptr);
|
||||||
if (sscanf(port, "%d", &tcpcli->svr.port) < 1)
|
if (sscanf(port, "%d", &tcpcli->svr.port) < 1)
|
||||||
{
|
{
|
||||||
sprintf(msg, "port error: %s", port);
|
sprintf(msg, "port error: %s", port);
|
||||||
tracet(1, "opentcp: port error port=%s\n", port);
|
tracet(1, "opentcp: port error port=%s\n", port);
|
||||||
free(tcpcli);
|
free(tcpcli);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
tcpcli->svr.tcon = 0;
|
tcpcli->svr.tcon = 0;
|
||||||
tcpcli->toinact = toinact;
|
tcpcli->toinact = toinact;
|
||||||
@ -1062,7 +1066,7 @@ int waittcpcli(tcpcli_t *tcpcli, char *msg)
|
|||||||
if (tcpcli->svr.state == 2)
|
if (tcpcli->svr.state == 2)
|
||||||
{ /* connect */
|
{ /* connect */
|
||||||
if (tcpcli->toinact > 0 &&
|
if (tcpcli->toinact > 0 &&
|
||||||
(int)(tickget() - tcpcli->svr.tact) > tcpcli->toinact)
|
static_cast<int>(tickget() - tcpcli->svr.tact) > tcpcli->toinact)
|
||||||
{
|
{
|
||||||
sprintf(msg, "timeout");
|
sprintf(msg, "timeout");
|
||||||
tracet(2, "waittcpcli: inactive timeout sock=%d\n", tcpcli->svr.sock);
|
tracet(2, "waittcpcli: inactive timeout sock=%d\n", tcpcli->svr.sock);
|
||||||
@ -1164,7 +1168,7 @@ int reqntrip_s(ntrip_t *ntrip, char *msg)
|
|||||||
p += sprintf(p, "STR: %s\r\n", ntrip->str);
|
p += sprintf(p, "STR: %s\r\n", ntrip->str);
|
||||||
p += sprintf(p, "\r\n");
|
p += sprintf(p, "\r\n");
|
||||||
|
|
||||||
if (writetcpcli(ntrip->tcp, (unsigned char *)buff, p - buff, msg) != p - buff) return 0;
|
if (writetcpcli(ntrip->tcp, reinterpret_cast<unsigned char *>(buff), p - buff, msg) != p - buff) return 0;
|
||||||
|
|
||||||
tracet(2, "reqntrip_s: send request state=%d ns=%d\n", ntrip->state, p - buff);
|
tracet(2, "reqntrip_s: send request state=%d ns=%d\n", ntrip->state, p - buff);
|
||||||
tracet(5, "reqntrip_s: n=%d buff=\n%s\n", p - buff, buff);
|
tracet(5, "reqntrip_s: n=%d buff=\n%s\n", p - buff, buff);
|
||||||
@ -1192,12 +1196,12 @@ int reqntrip_c(ntrip_t *ntrip, char *msg)
|
|||||||
{
|
{
|
||||||
sprintf(user, "%s:%s", ntrip->user, ntrip->passwd);
|
sprintf(user, "%s:%s", ntrip->user, ntrip->passwd);
|
||||||
p += sprintf(p, "Authorization: Basic ");
|
p += sprintf(p, "Authorization: Basic ");
|
||||||
p += encbase64(p, (unsigned char *)user, strlen(user));
|
p += encbase64(p, reinterpret_cast<unsigned char *>(user), strlen(user));
|
||||||
p += sprintf(p, "\r\n");
|
p += sprintf(p, "\r\n");
|
||||||
}
|
}
|
||||||
p += sprintf(p, "\r\n");
|
p += sprintf(p, "\r\n");
|
||||||
|
|
||||||
if (writetcpcli(ntrip->tcp, (unsigned char *)buff, p - buff, msg) != p - buff) return 0;
|
if (writetcpcli(ntrip->tcp, reinterpret_cast<unsigned char *>(buff), p - buff, msg) != p - buff) return 0;
|
||||||
|
|
||||||
tracet(2, "reqntrip_c: send request state=%d ns=%d\n", ntrip->state, p - buff);
|
tracet(2, "reqntrip_c: send request state=%d ns=%d\n", ntrip->state, p - buff);
|
||||||
tracet(5, "reqntrip_c: n=%d buff=\n%s\n", p - buff, buff);
|
tracet(5, "reqntrip_c: n=%d buff=\n%s\n", p - buff, buff);
|
||||||
@ -1216,9 +1220,9 @@ int rspntrip_s(ntrip_t *ntrip, char *msg)
|
|||||||
ntrip->buff[ntrip->nb] = '0';
|
ntrip->buff[ntrip->nb] = '0';
|
||||||
tracet(5, "rspntrip_s: n=%d buff=\n%s\n", ntrip->nb, ntrip->buff);
|
tracet(5, "rspntrip_s: n=%d buff=\n%s\n", ntrip->nb, ntrip->buff);
|
||||||
|
|
||||||
if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_OK_SVR)))
|
if ((p = strstr(reinterpret_cast<char *>(ntrip->buff), NTRIP_RSP_OK_SVR)))
|
||||||
{ /* ok */
|
{ /* ok */
|
||||||
q = (char *)ntrip->buff;
|
q = reinterpret_cast<char *>(ntrip->buff);
|
||||||
p += strlen(NTRIP_RSP_OK_SVR);
|
p += strlen(NTRIP_RSP_OK_SVR);
|
||||||
ntrip->nb -= p - q;
|
ntrip->nb -= p - q;
|
||||||
for (i = 0; i < ntrip->nb; i++) *q++ = *p++;
|
for (i = 0; i < ntrip->nb; i++) *q++ = *p++;
|
||||||
@ -1227,11 +1231,11 @@ int rspntrip_s(ntrip_t *ntrip, char *msg)
|
|||||||
tracet(2, "rspntrip_s: response ok nb=%d\n", ntrip->nb);
|
tracet(2, "rspntrip_s: response ok nb=%d\n", ntrip->nb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_ERROR)))
|
if ((p = strstr(reinterpret_cast<char *>(ntrip->buff), NTRIP_RSP_ERROR)))
|
||||||
{ /* error */
|
{ /* error */
|
||||||
nb = ntrip->nb < MAXSTATMSG ? ntrip->nb : MAXSTATMSG;
|
nb = ntrip->nb < MAXSTATMSG ? ntrip->nb : MAXSTATMSG;
|
||||||
// strncpy(msg, (char *)ntrip->buff, nb); This line triggers a warning. Replaced by;
|
// strncpy(msg, (char *)ntrip->buff, nb); This line triggers a warning. Replaced by;
|
||||||
std::string s_aux((char *)ntrip->buff);
|
std::string s_aux(reinterpret_cast<char *>(ntrip->buff));
|
||||||
s_aux.resize(nb, '\0');
|
s_aux.resize(nb, '\0');
|
||||||
for (int i = 0; i < nb; i++) msg[i] = s_aux[i];
|
for (int i = 0; i < nb; i++) msg[i] = s_aux[i];
|
||||||
|
|
||||||
@ -1266,9 +1270,9 @@ int rspntrip_c(ntrip_t *ntrip, char *msg)
|
|||||||
ntrip->buff[ntrip->nb] = '0';
|
ntrip->buff[ntrip->nb] = '0';
|
||||||
tracet(5, "rspntrip_c: n=%d buff=\n%s\n", ntrip->nb, ntrip->buff);
|
tracet(5, "rspntrip_c: n=%d buff=\n%s\n", ntrip->nb, ntrip->buff);
|
||||||
|
|
||||||
if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_OK_CLI)))
|
if ((p = strstr(reinterpret_cast<char *>(ntrip->buff), NTRIP_RSP_OK_CLI)))
|
||||||
{ /* ok */
|
{ /* ok */
|
||||||
q = (char *)ntrip->buff;
|
q = reinterpret_cast<char *>(ntrip->buff);
|
||||||
p += strlen(NTRIP_RSP_OK_CLI);
|
p += strlen(NTRIP_RSP_OK_CLI);
|
||||||
ntrip->nb -= p - q;
|
ntrip->nb -= p - q;
|
||||||
for (i = 0; i < ntrip->nb; i++) *q++ = *p++;
|
for (i = 0; i < ntrip->nb; i++) *q++ = *p++;
|
||||||
@ -1277,7 +1281,7 @@ int rspntrip_c(ntrip_t *ntrip, char *msg)
|
|||||||
tracet(2, "rspntrip_c: response ok nb=%d\n", ntrip->nb);
|
tracet(2, "rspntrip_c: response ok nb=%d\n", ntrip->nb);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_SRCTBL)))
|
if ((p = strstr(reinterpret_cast<char *>(ntrip->buff), NTRIP_RSP_SRCTBL)))
|
||||||
{ /* source table */
|
{ /* source table */
|
||||||
if (!*ntrip->mntpnt)
|
if (!*ntrip->mntpnt)
|
||||||
{ /* source table request */
|
{ /* source table request */
|
||||||
@ -1293,7 +1297,7 @@ int rspntrip_c(ntrip_t *ntrip, char *msg)
|
|||||||
ntrip->state = 0;
|
ntrip->state = 0;
|
||||||
discontcp(&ntrip->tcp->svr, ntrip->tcp->tirecon);
|
discontcp(&ntrip->tcp->svr, ntrip->tcp->tirecon);
|
||||||
}
|
}
|
||||||
else if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_HTTP)))
|
else if ((p = strstr(reinterpret_cast<char *>(ntrip->buff), NTRIP_RSP_HTTP)))
|
||||||
{ /* http response */
|
{ /* http response */
|
||||||
if ((q = strchr(p, '\r')))
|
if ((q = strchr(p, '\r')))
|
||||||
*q = '\0';
|
*q = '\0';
|
||||||
@ -1342,8 +1346,8 @@ int waitntrip(ntrip_t *ntrip, char *msg)
|
|||||||
}
|
}
|
||||||
if (ntrip->state == 1)
|
if (ntrip->state == 1)
|
||||||
{ /* read response */
|
{ /* read response */
|
||||||
p = (char *)ntrip->buff + ntrip->nb;
|
p = reinterpret_cast<char *>(ntrip->buff) + ntrip->nb;
|
||||||
if ((n = readtcpcli(ntrip->tcp, (unsigned char *)p, NTRIP_MAXRSP - ntrip->nb - 1, msg)) == 0)
|
if ((n = readtcpcli(ntrip->tcp, reinterpret_cast<unsigned char *>(p), NTRIP_MAXRSP - ntrip->nb - 1, msg)) == 0)
|
||||||
{
|
{
|
||||||
tracet(5, "waitntrip: readtcp n=%d\n", n);
|
tracet(5, "waitntrip: readtcp n=%d\n", n);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1367,7 +1371,7 @@ ntrip_t *openntrip(const char *path, int type, char *msg)
|
|||||||
|
|
||||||
tracet(3, "openntrip: path=%s type=%d\n", path, type);
|
tracet(3, "openntrip: path=%s type=%d\n", path, type);
|
||||||
|
|
||||||
if (!(ntrip = (ntrip_t *)malloc(sizeof(ntrip_t)))) return NULL;
|
if (!(ntrip = static_cast<ntrip_t *>(malloc(sizeof(ntrip_t))))) return nullptr;
|
||||||
|
|
||||||
ntrip->state = 0;
|
ntrip->state = 0;
|
||||||
ntrip->type = type; /* 0:server, 1:client */
|
ntrip->type = type; /* 0:server, 1:client */
|
||||||
@ -1402,7 +1406,7 @@ ntrip_t *openntrip(const char *path, int type, char *msg)
|
|||||||
{
|
{
|
||||||
tracet(1, "openntrip: opentcp error\n");
|
tracet(1, "openntrip: opentcp error\n");
|
||||||
free(ntrip);
|
free(ntrip);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return ntrip;
|
return ntrip;
|
||||||
}
|
}
|
||||||
@ -1534,7 +1538,7 @@ gtime_t nextdltime(const int *topts, int stat)
|
|||||||
/* ftp thread ----------------------------------------------------------------*/
|
/* ftp thread ----------------------------------------------------------------*/
|
||||||
void *ftpthread(void *arg)
|
void *ftpthread(void *arg)
|
||||||
{
|
{
|
||||||
auto *ftp = (ftp_t *)arg;
|
auto *ftp = static_cast<ftp_t *>(arg);
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
gtime_t time;
|
gtime_t time;
|
||||||
char remote[1024], local[1024], tmpfile[1024], errfile[1024], *p;
|
char remote[1024], local[1024], tmpfile[1024], errfile[1024], *p;
|
||||||
@ -1548,7 +1552,7 @@ void *ftpthread(void *arg)
|
|||||||
tracet(1, "no local directory\n");
|
tracet(1, "no local directory\n");
|
||||||
ftp->error = 11;
|
ftp->error = 11;
|
||||||
ftp->state = 3;
|
ftp->state = 3;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
/* replace keyword in file path and local path */
|
/* replace keyword in file path and local path */
|
||||||
time = timeadd(utc2gpst(timeget()), ftp->topts[0]);
|
time = timeadd(utc2gpst(timeget()), ftp->topts[0]);
|
||||||
@ -1578,13 +1582,13 @@ void *ftpthread(void *arg)
|
|||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
if ((fp = fopen(tmpfile, "rb")))
|
if ((fp = fopen(tmpfile, "rbe")))
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
strcpy(ftp->local, tmpfile);
|
strcpy(ftp->local, tmpfile);
|
||||||
tracet(3, "ftpthread: file exists %s\n", ftp->local);
|
tracet(3, "ftpthread: file exists %s\n", ftp->local);
|
||||||
ftp->state = 2;
|
ftp->state = 2;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
/* proxy settings for wget (ref [2]) */
|
/* proxy settings for wget (ref [2]) */
|
||||||
if (*proxyaddr)
|
if (*proxyaddr)
|
||||||
@ -1633,7 +1637,7 @@ void *ftpthread(void *arg)
|
|||||||
tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret);
|
tracet(1, "execcmd error: cmd=%s ret=%d\n", cmd, ret);
|
||||||
ftp->error = ret;
|
ftp->error = ret;
|
||||||
ftp->state = 3;
|
ftp->state = 3;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (remove(errfile) != 0) trace(1, "Error removing file");
|
if (remove(errfile) != 0) trace(1, "Error removing file");
|
||||||
|
|
||||||
@ -1652,14 +1656,14 @@ void *ftpthread(void *arg)
|
|||||||
tracet(1, "file uncompact error: %s\n", local);
|
tracet(1, "file uncompact error: %s\n", local);
|
||||||
ftp->error = 12;
|
ftp->error = 12;
|
||||||
ftp->state = 3;
|
ftp->state = 3;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen(local) < 1024) strcpy(ftp->local, local);
|
if (strlen(local) < 1024) strcpy(ftp->local, local);
|
||||||
ftp->state = 2; /* ftp completed */
|
ftp->state = 2; /* ftp completed */
|
||||||
|
|
||||||
tracet(3, "ftpthread: complete cmd=%s\n", cmd);
|
tracet(3, "ftpthread: complete cmd=%s\n", cmd);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1672,12 +1676,12 @@ ftp_t *openftp(const char *path, int type, char *msg)
|
|||||||
|
|
||||||
msg[0] = '\0';
|
msg[0] = '\0';
|
||||||
|
|
||||||
if (!(ftp = (ftp_t *)malloc(sizeof(ftp_t)))) return NULL;
|
if (!(ftp = static_cast<ftp_t *>(malloc(sizeof(ftp_t))))) return nullptr;
|
||||||
|
|
||||||
ftp->state = 0;
|
ftp->state = 0;
|
||||||
ftp->proto = type;
|
ftp->proto = type;
|
||||||
ftp->error = 0;
|
ftp->error = 0;
|
||||||
ftp->thread = 0;
|
ftp->thread = 0; // NOLINT
|
||||||
ftp->local[0] = '\0';
|
ftp->local[0] = '\0';
|
||||||
|
|
||||||
/* decode ftp path */
|
/* decode ftp path */
|
||||||
@ -1718,7 +1722,7 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
|
|||||||
ftp->state = 1;
|
ftp->state = 1;
|
||||||
sprintf(msg, "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr);
|
sprintf(msg, "%s://%s", ftp->proto ? "http" : "ftp", ftp->addr);
|
||||||
|
|
||||||
if (pthread_create(&ftp->thread, NULL, ftpthread, ftp))
|
if (pthread_create(&ftp->thread, nullptr, ftpthread, ftp))
|
||||||
{
|
{
|
||||||
tracet(1, "readftp: ftp thread create error\n");
|
tracet(1, "readftp: ftp thread create error\n");
|
||||||
ftp->state = 3;
|
ftp->state = 3;
|
||||||
@ -1739,9 +1743,9 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
|
|||||||
}
|
}
|
||||||
/* return local file path if ftp completed */
|
/* return local file path if ftp completed */
|
||||||
p = buff;
|
p = buff;
|
||||||
q = (unsigned char *)ftp->local;
|
q = reinterpret_cast<unsigned char *>(ftp->local);
|
||||||
while (*q && (int)(p - buff) < n) *p++ = *q++;
|
while (*q && static_cast<int>(p - buff) < n) *p++ = *q++;
|
||||||
p += sprintf((char *)p, "\r\n");
|
p += sprintf(reinterpret_cast<char *>(p), "\r\n");
|
||||||
|
|
||||||
/* set next download time */
|
/* set next download time */
|
||||||
ftp->tnext = nextdltime(ftp->topts, 1);
|
ftp->tnext = nextdltime(ftp->topts, 1);
|
||||||
@ -1749,7 +1753,7 @@ int readftp(ftp_t *ftp, unsigned char *buff, int n, char *msg)
|
|||||||
|
|
||||||
strcpy(msg, "");
|
strcpy(msg, "");
|
||||||
|
|
||||||
return (int)(p - buff);
|
return static_cast<int>(p - buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1786,7 +1790,7 @@ void strinit(stream_t *stream)
|
|||||||
stream->inb = stream->inr = stream->outb = stream->outr = 0;
|
stream->inb = stream->inr = stream->outb = stream->outr = 0;
|
||||||
stream->tick = stream->tact = stream->inbt = stream->outbt = 0;
|
stream->tick = stream->tact = stream->inbt = stream->outbt = 0;
|
||||||
initlock(&stream->lock);
|
initlock(&stream->lock);
|
||||||
stream->port = NULL;
|
stream->port = nullptr;
|
||||||
stream->path[0] = '\0';
|
stream->path[0] = '\0';
|
||||||
stream->msg[0] = '\0';
|
stream->msg[0] = '\0';
|
||||||
}
|
}
|
||||||
@ -1838,7 +1842,7 @@ int stropen(stream_t *stream, int type, int mode, const char *path)
|
|||||||
stream->tick = tickget();
|
stream->tick = tickget();
|
||||||
stream->inbt = stream->outbt = 0;
|
stream->inbt = stream->outbt = 0;
|
||||||
stream->msg[0] = '\0';
|
stream->msg[0] = '\0';
|
||||||
stream->port = NULL;
|
stream->port = nullptr;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case STR_SERIAL:
|
case STR_SERIAL:
|
||||||
@ -1870,7 +1874,7 @@ int stropen(stream_t *stream, int type, int mode, const char *path)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
stream->state = !stream->port ? -1 : 1;
|
stream->state = !stream->port ? -1 : 1;
|
||||||
return stream->port != NULL;
|
return stream->port != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1888,28 +1892,28 @@ void strclose(stream_t *stream)
|
|||||||
switch (stream->type)
|
switch (stream->type)
|
||||||
{
|
{
|
||||||
case STR_SERIAL:
|
case STR_SERIAL:
|
||||||
closeserial((serial_t *)stream->port);
|
closeserial(static_cast<serial_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_FILE:
|
case STR_FILE:
|
||||||
closefile((file_t *)stream->port);
|
closefile(static_cast<file_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_TCPSVR:
|
case STR_TCPSVR:
|
||||||
closetcpsvr((tcpsvr_t *)stream->port);
|
closetcpsvr(static_cast<tcpsvr_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_TCPCLI:
|
case STR_TCPCLI:
|
||||||
closetcpcli((tcpcli_t *)stream->port);
|
closetcpcli(static_cast<tcpcli_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_NTRIPSVR:
|
case STR_NTRIPSVR:
|
||||||
closentrip((ntrip_t *)stream->port);
|
closentrip(static_cast<ntrip_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_NTRIPCLI:
|
case STR_NTRIPCLI:
|
||||||
closentrip((ntrip_t *)stream->port);
|
closentrip(static_cast<ntrip_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_FTP:
|
case STR_FTP:
|
||||||
closeftp((ftp_t *)stream->port);
|
closeftp(static_cast<ftp_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_HTTP:
|
case STR_HTTP:
|
||||||
closeftp((ftp_t *)stream->port);
|
closeftp(static_cast<ftp_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1923,7 +1927,7 @@ void strclose(stream_t *stream)
|
|||||||
stream->inr = stream->outr = 0;
|
stream->inr = stream->outr = 0;
|
||||||
stream->path[0] = '\0';
|
stream->path[0] = '\0';
|
||||||
stream->msg[0] = '\0';
|
stream->msg[0] = '\0';
|
||||||
stream->port = NULL;
|
stream->port = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1938,8 +1942,8 @@ void strsync(stream_t *stream1, stream_t *stream2)
|
|||||||
{
|
{
|
||||||
file_t *file1, *file2;
|
file_t *file1, *file2;
|
||||||
if (stream1->type != STR_FILE || stream2->type != STR_FILE) return;
|
if (stream1->type != STR_FILE || stream2->type != STR_FILE) return;
|
||||||
file1 = (file_t *)stream1->port;
|
file1 = static_cast<file_t *>(stream1->port);
|
||||||
file2 = (file_t *)stream2->port;
|
file2 = static_cast<file_t *>(stream2->port);
|
||||||
if (file1 && file2) syncfile(file1, file2);
|
if (file1 && file2) syncfile(file1, file2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1977,25 +1981,25 @@ int strread(stream_t *stream, unsigned char *buff, int n)
|
|||||||
switch (stream->type)
|
switch (stream->type)
|
||||||
{
|
{
|
||||||
case STR_SERIAL:
|
case STR_SERIAL:
|
||||||
nr = readserial((serial_t *)stream->port, buff, n, msg);
|
nr = readserial(static_cast<serial_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_FILE:
|
case STR_FILE:
|
||||||
nr = readfile((file_t *)stream->port, buff, n, msg);
|
nr = readfile(static_cast<file_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_TCPSVR:
|
case STR_TCPSVR:
|
||||||
nr = readtcpsvr((tcpsvr_t *)stream->port, buff, n, msg);
|
nr = readtcpsvr(static_cast<tcpsvr_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_TCPCLI:
|
case STR_TCPCLI:
|
||||||
nr = readtcpcli((tcpcli_t *)stream->port, buff, n, msg);
|
nr = readtcpcli(static_cast<tcpcli_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_NTRIPCLI:
|
case STR_NTRIPCLI:
|
||||||
nr = readntrip((ntrip_t *)stream->port, buff, n, msg);
|
nr = readntrip(static_cast<ntrip_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_FTP:
|
case STR_FTP:
|
||||||
nr = readftp((ftp_t *)stream->port, buff, n, msg);
|
nr = readftp(static_cast<ftp_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_HTTP:
|
case STR_HTTP:
|
||||||
nr = readftp((ftp_t *)stream->port, buff, n, msg);
|
nr = readftp(static_cast<ftp_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strunlock(stream);
|
strunlock(stream);
|
||||||
@ -2005,7 +2009,7 @@ int strread(stream_t *stream, unsigned char *buff, int n)
|
|||||||
tick = tickget();
|
tick = tickget();
|
||||||
if (nr > 0) stream->tact = tick;
|
if (nr > 0) stream->tact = tick;
|
||||||
|
|
||||||
if ((int)(tick - stream->tick) >= tirate)
|
if (static_cast<int>(tick - stream->tick) >= tirate)
|
||||||
{
|
{
|
||||||
stream->inr = (stream->inb - stream->inbt) * 8000 / (tick - stream->tick);
|
stream->inr = (stream->inb - stream->inbt) * 8000 / (tick - stream->tick);
|
||||||
stream->tick = tick;
|
stream->tick = tick;
|
||||||
@ -2039,20 +2043,20 @@ int strwrite(stream_t *stream, unsigned char *buff, int n)
|
|||||||
switch (stream->type)
|
switch (stream->type)
|
||||||
{
|
{
|
||||||
case STR_SERIAL:
|
case STR_SERIAL:
|
||||||
ns = writeserial((serial_t *)stream->port, buff, n, msg);
|
ns = writeserial(static_cast<serial_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_FILE:
|
case STR_FILE:
|
||||||
ns = writefile((file_t *)stream->port, buff, n, msg);
|
ns = writefile(static_cast<file_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_TCPSVR:
|
case STR_TCPSVR:
|
||||||
ns = writetcpsvr((tcpsvr_t *)stream->port, buff, n, msg);
|
ns = writetcpsvr(static_cast<tcpsvr_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_TCPCLI:
|
case STR_TCPCLI:
|
||||||
ns = writetcpcli((tcpcli_t *)stream->port, buff, n, msg);
|
ns = writetcpcli(static_cast<tcpcli_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_NTRIPCLI:
|
case STR_NTRIPCLI:
|
||||||
case STR_NTRIPSVR:
|
case STR_NTRIPSVR:
|
||||||
ns = writentrip((ntrip_t *)stream->port, buff, n, msg);
|
ns = writentrip(static_cast<ntrip_t *>(stream->port), buff, n, msg);
|
||||||
break;
|
break;
|
||||||
case STR_FTP:
|
case STR_FTP:
|
||||||
case STR_HTTP:
|
case STR_HTTP:
|
||||||
@ -2064,7 +2068,7 @@ int strwrite(stream_t *stream, unsigned char *buff, int n)
|
|||||||
tick = tickget();
|
tick = tickget();
|
||||||
if (ns > 0) stream->tact = tick;
|
if (ns > 0) stream->tact = tick;
|
||||||
|
|
||||||
if ((int)(tick - stream->tick) > tirate)
|
if (static_cast<int>(tick - stream->tick) > tirate)
|
||||||
{
|
{
|
||||||
stream->outr = (stream->outb - stream->outbt) * 8000 / (tick - stream->tick);
|
stream->outr = (stream->outb - stream->outbt) * 8000 / (tick - stream->tick);
|
||||||
stream->tick = tick;
|
stream->tick = tick;
|
||||||
@ -2104,32 +2108,32 @@ int strstat(stream_t *stream, char *msg)
|
|||||||
switch (stream->type)
|
switch (stream->type)
|
||||||
{
|
{
|
||||||
case STR_SERIAL:
|
case STR_SERIAL:
|
||||||
state = stateserial((serial_t *)stream->port);
|
state = stateserial(static_cast<serial_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_FILE:
|
case STR_FILE:
|
||||||
state = statefile((file_t *)stream->port);
|
state = statefile(static_cast<file_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_TCPSVR:
|
case STR_TCPSVR:
|
||||||
state = statetcpsvr((tcpsvr_t *)stream->port);
|
state = statetcpsvr(static_cast<tcpsvr_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_TCPCLI:
|
case STR_TCPCLI:
|
||||||
state = statetcpcli((tcpcli_t *)stream->port);
|
state = statetcpcli(static_cast<tcpcli_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_NTRIPSVR:
|
case STR_NTRIPSVR:
|
||||||
case STR_NTRIPCLI:
|
case STR_NTRIPCLI:
|
||||||
state = statentrip((ntrip_t *)stream->port);
|
state = statentrip(static_cast<ntrip_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_FTP:
|
case STR_FTP:
|
||||||
state = stateftp((ftp_t *)stream->port);
|
state = stateftp(static_cast<ftp_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
case STR_HTTP:
|
case STR_HTTP:
|
||||||
state = stateftp((ftp_t *)stream->port);
|
state = stateftp(static_cast<ftp_t *>(stream->port));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strunlock(stream);
|
strunlock(stream);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (state == 2 && (int)(tickget() - stream->tact) <= TINTACT) state = 3;
|
if (state == 2 && static_cast<int>(tickget() - stream->tact) <= TINTACT) state = 3;
|
||||||
strunlock(stream);
|
strunlock(stream);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@ -2198,11 +2202,11 @@ void strsettimeout(stream_t *stream, int toinact, int tirecon)
|
|||||||
|
|
||||||
if (stream->type == STR_TCPCLI)
|
if (stream->type == STR_TCPCLI)
|
||||||
{
|
{
|
||||||
tcpcli = (tcpcli_t *)stream->port;
|
tcpcli = static_cast<tcpcli_t *>(stream->port);
|
||||||
}
|
}
|
||||||
else if (stream->type == STR_NTRIPCLI || stream->type == STR_NTRIPSVR)
|
else if (stream->type == STR_NTRIPCLI || stream->type == STR_NTRIPSVR)
|
||||||
{
|
{
|
||||||
tcpcli = ((ntrip_t *)stream->port)->tcp;
|
tcpcli = (static_cast<ntrip_t *>(stream->port))->tcp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
@ -2245,7 +2249,7 @@ gtime_t strgettime(stream_t *stream)
|
|||||||
{
|
{
|
||||||
file_t *file;
|
file_t *file;
|
||||||
if (stream->type == STR_FILE && (stream->mode & STR_MODE_R) &&
|
if (stream->type == STR_FILE && (stream->mode & STR_MODE_R) &&
|
||||||
(file = (file_t *)stream->port))
|
(file = static_cast<file_t *>(stream->port)))
|
||||||
{
|
{
|
||||||
return timeadd(file->time, file->start); /* replay start time */
|
return timeadd(file->time, file->start); /* replay start time */
|
||||||
}
|
}
|
||||||
@ -2286,15 +2290,15 @@ int gen_hex(const char *msg, unsigned char *buff)
|
|||||||
trace(4, "gen_hex: msg=%s\n", msg);
|
trace(4, "gen_hex: msg=%s\n", msg);
|
||||||
|
|
||||||
strncpy(mbuff, msg, 1023);
|
strncpy(mbuff, msg, 1023);
|
||||||
for (p = strtok(mbuff, " "); p && narg < 256; p = strtok(NULL, " "))
|
for (p = strtok(mbuff, " "); p && narg < 256; p = strtok(nullptr, " "))
|
||||||
{
|
{
|
||||||
args[narg++] = p;
|
args[narg++] = p;
|
||||||
}
|
}
|
||||||
for (i = 0; i < narg; i++)
|
for (i = 0; i < narg; i++)
|
||||||
{
|
{
|
||||||
if (sscanf(args[i], "%x", &byte)) *q++ = (unsigned char)byte;
|
if (sscanf(args[i], "%x", &byte)) *q++ = static_cast<unsigned char>(byte);
|
||||||
}
|
}
|
||||||
return (int)(q - buff);
|
return static_cast<int>(q - buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2317,7 +2321,7 @@ void strsendcmd(stream_t *str, const char *cmd)
|
|||||||
{
|
{
|
||||||
for (q = p;; q++)
|
for (q = p;; q++)
|
||||||
if (*q == '\r' || *q == '\n' || *q == '\0') break;
|
if (*q == '\r' || *q == '\n' || *q == '\0') break;
|
||||||
n = (int)(q - p);
|
n = static_cast<int>(q - p);
|
||||||
strncpy(msg, p, n);
|
strncpy(msg, p, n);
|
||||||
msg[n] = '\0';
|
msg[n] = '\0';
|
||||||
|
|
||||||
@ -2357,8 +2361,8 @@ void strsendcmd(stream_t *str, const char *cmd)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strwrite(str, (unsigned char *)msg, n);
|
strwrite(str, reinterpret_cast<unsigned char *>(msg), n);
|
||||||
strwrite(str, (unsigned char *)cmdend, 2);
|
strwrite(str, reinterpret_cast<unsigned char *>(cmdend), 2);
|
||||||
}
|
}
|
||||||
if (*q == '\0')
|
if (*q == '\0')
|
||||||
break;
|
break;
|
||||||
|
@ -41,8 +41,8 @@ short_x2_to_cshort_sptr make_short_x2_to_cshort()
|
|||||||
|
|
||||||
|
|
||||||
short_x2_to_cshort::short_x2_to_cshort() : sync_block("short_x2_to_cshort",
|
short_x2_to_cshort::short_x2_to_cshort() : sync_block("short_x2_to_cshort",
|
||||||
gr::io_signature::make(2, 2, sizeof(short)),
|
gr::io_signature::make(2, 2, sizeof(int16_t)),
|
||||||
gr::io_signature::make(1, 1, sizeof(lv_16sc_t))) // lv_8sc_t is a Volk's typedef for std::complex<signed char>
|
gr::io_signature::make(1, 1, sizeof(lv_16sc_t)))
|
||||||
{
|
{
|
||||||
const int alignment_multiple = volk_get_alignment() / sizeof(lv_16sc_t);
|
const int alignment_multiple = volk_get_alignment() / sizeof(lv_16sc_t);
|
||||||
set_alignment(std::max(1, alignment_multiple));
|
set_alignment(std::max(1, alignment_multiple));
|
||||||
@ -53,12 +53,12 @@ int short_x2_to_cshort::work(int noutput_items,
|
|||||||
gr_vector_const_void_star &input_items,
|
gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items)
|
gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
const auto *in0 = reinterpret_cast<const short *>(input_items[0]);
|
const auto *in0 = reinterpret_cast<const int16_t *>(input_items[0]);
|
||||||
const auto *in1 = reinterpret_cast<const short *>(input_items[1]);
|
const auto *in1 = reinterpret_cast<const int16_t *>(input_items[1]);
|
||||||
auto *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
|
auto *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
|
||||||
// This could be put into a volk kernel
|
// This could be put into a volk kernel
|
||||||
short real_part;
|
int16_t real_part;
|
||||||
short imag_part;
|
int16_t imag_part;
|
||||||
for (int number = 0; number < noutput_items; number++)
|
for (int number = 0; number < noutput_items; number++)
|
||||||
{
|
{
|
||||||
// lv_cmake(r, i) defined at volk/volk_complex.h
|
// lv_cmake(r, i) defined at volk/volk_complex.h
|
||||||
|
@ -411,19 +411,12 @@ bool hybrid_observables_cc::interp_trk_obs(Gnss_Synchro &interpolated_obs, const
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// std::cout << "ALERT: Channel " << ch << " interp buff idx " << nearest_element
|
// std::cout << "ALERT: Channel " << ch << " interp buff idx " << nearest_element
|
||||||
// << " ,diff: " << old_abs_diff << " samples (" << static_cast<double>(old_abs_diff) / static_cast<double>(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n";
|
// << " ,diff: " << old_abs_diff << " samples (" << static_cast<double>(old_abs_diff) / static_cast<double>(d_gnss_synchro_history->at(ch, nearest_element).fs) << " s)\n";
|
||||||
// usleep(1000);
|
// usleep(1000);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void hybrid_observables_cc::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
void hybrid_observables_cc::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||||
@ -549,7 +542,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused)
|
|||||||
int32_t n_valid = 0;
|
int32_t n_valid = 0;
|
||||||
for (uint32_t n = 0; n < d_nchannels_out; n++)
|
for (uint32_t n = 0; n < d_nchannels_out; n++)
|
||||||
{
|
{
|
||||||
Gnss_Synchro interpolated_gnss_synchro;
|
Gnss_Synchro interpolated_gnss_synchro{};
|
||||||
if (!interp_trk_obs(interpolated_gnss_synchro, n, d_Rx_clock_buffer.front() + T_rx_TOW_offset_ms * T_rx_clock_step_samples))
|
if (!interp_trk_obs(interpolated_gnss_synchro, n, d_Rx_clock_buffer.front() + T_rx_TOW_offset_ms * T_rx_clock_step_samples))
|
||||||
{
|
{
|
||||||
// Produce an empty observation
|
// Produce an empty observation
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <gnuradio/blocks/file_sink.h>
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
#include <volk/volk.h>
|
#include <volk/volk.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
@ -94,7 +95,7 @@ DirectResamplerConditioner::DirectResamplerConditioner(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(WARNING) << item_type_ << " unrecognized item type for resampler";
|
LOG(WARNING) << item_type_ << " unrecognized item type for resampler";
|
||||||
item_size_ = sizeof(short);
|
item_size_ = sizeof(int16_t);
|
||||||
}
|
}
|
||||||
if (dump_)
|
if (dump_)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "Galileo_E5a.h"
|
#include "Galileo_E5a.h"
|
||||||
#include "GLONASS_L1_L2_CA.h"
|
#include "GLONASS_L1_L2_CA.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
@ -104,11 +104,11 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
|
|||||||
{
|
{
|
||||||
if (signal1[0].at(0) == '1')
|
if (signal1[0].at(0) == '1')
|
||||||
{
|
{
|
||||||
vector_length = round((float)fs_in / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
vector_length = round(static_cast<float>(fs_in) / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vector_length = round((float)fs_in / (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
vector_length = round(static_cast<float>(fs_in) / (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(WARNING) << item_type_ << " unrecognized item type for resampler";
|
LOG(WARNING) << item_type_ << " unrecognized item type for resampler";
|
||||||
item_size_ = sizeof(short);
|
item_size_ = sizeof(int16_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dump_)
|
if (dump_)
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "configuration_interface.h"
|
#include "configuration_interface.h"
|
||||||
#include "labsat23_source.h"
|
#include "labsat23_source.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(WARNING) << item_type_ << " unrecognized item type for LabSat source";
|
LOG(WARNING) << item_type_ << " unrecognized item type for LabSat source";
|
||||||
item_size_ = sizeof(short);
|
item_size_ = sizeof(int16_t);
|
||||||
}
|
}
|
||||||
if (dump_)
|
if (dump_)
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
|||||||
|
|
||||||
// rtl_tcp PARAMETERS
|
// rtl_tcp PARAMETERS
|
||||||
std::string default_address = "127.0.0.1";
|
std::string default_address = "127.0.0.1";
|
||||||
short default_port = 1234;
|
int16_t default_port = 1234;
|
||||||
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
|
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
|
||||||
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||||
gain_ = configuration->property(role + ".gain", 40.0);
|
gain_ = configuration->property(role + ".gain", 40.0);
|
||||||
@ -77,7 +78,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
|||||||
|
|
||||||
if (item_type_ == "short")
|
if (item_type_ == "short")
|
||||||
{
|
{
|
||||||
item_size_ = sizeof(short);
|
item_size_ = sizeof(int16_t);
|
||||||
}
|
}
|
||||||
else if (item_type_ == "gr_complex")
|
else if (item_type_ == "gr_complex")
|
||||||
{
|
{
|
||||||
@ -118,7 +119,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(WARNING) << item_type_ << " unrecognized item type. Using short.";
|
LOG(WARNING) << item_type_ << " unrecognized item type. Using short.";
|
||||||
item_size_ = sizeof(short);
|
item_size_ = sizeof(int16_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (samples_ != 0)
|
if (samples_ != 0)
|
||||||
|
@ -90,7 +90,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
|||||||
// well read them in as bytes.
|
// well read them in as bytes.
|
||||||
if (big_endian_items_)
|
if (big_endian_items_)
|
||||||
{
|
{
|
||||||
item_size_ = sizeof(short);
|
item_size_ = sizeof(int16_t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -369,14 +369,11 @@ int labsat23_source::general_work(int noutput_items,
|
|||||||
std::cout << "Labsat file header error: section 2 is not available." << std::endl;
|
std::cout << "Labsat file header error: section 2 is not available." << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cout << "Labsat file read error: file is empty." << std::endl;
|
std::cout << "Labsat file read error: file is empty." << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// ready to start reading samples
|
// ready to start reading samples
|
||||||
switch (d_bits_per_sample)
|
switch (d_bits_per_sample)
|
||||||
{
|
{
|
||||||
@ -483,7 +480,7 @@ int labsat23_source::general_work(int noutput_items,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
std::cout << "Warning!!" << std::endl;
|
std::cout << "Warning!!" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ enum
|
|||||||
|
|
||||||
rtl_tcp_signal_source_c_sptr
|
rtl_tcp_signal_source_c_sptr
|
||||||
rtl_tcp_make_signal_source_c(const std::string &address,
|
rtl_tcp_make_signal_source_c(const std::string &address,
|
||||||
short port,
|
int16_t port,
|
||||||
bool flip_iq)
|
bool flip_iq)
|
||||||
{
|
{
|
||||||
return gnuradio::get_initial_sptr(new rtl_tcp_signal_source_c(address,
|
return gnuradio::get_initial_sptr(new rtl_tcp_signal_source_c(address,
|
||||||
@ -61,7 +61,7 @@ rtl_tcp_make_signal_source_c(const std::string &address,
|
|||||||
|
|
||||||
|
|
||||||
rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
|
rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
|
||||||
short port,
|
int16_t port,
|
||||||
bool flip_iq)
|
bool flip_iq)
|
||||||
: gr::sync_block("rtl_tcp_signal_source_c",
|
: gr::sync_block("rtl_tcp_signal_source_c",
|
||||||
gr::io_signature::make(0, 0, 0),
|
gr::io_signature::make(0, 0, 0),
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <gnuradio/sync_block.h>
|
#include <gnuradio/sync_block.h>
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class rtl_tcp_signal_source_c;
|
class rtl_tcp_signal_source_c;
|
||||||
@ -54,7 +55,7 @@ typedef boost::shared_ptr<rtl_tcp_signal_source_c>
|
|||||||
|
|
||||||
rtl_tcp_signal_source_c_sptr
|
rtl_tcp_signal_source_c_sptr
|
||||||
rtl_tcp_make_signal_source_c(const std::string &address,
|
rtl_tcp_make_signal_source_c(const std::string &address,
|
||||||
short port,
|
int16_t port,
|
||||||
bool flip_iq = false);
|
bool flip_iq = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -81,11 +82,11 @@ private:
|
|||||||
|
|
||||||
friend rtl_tcp_signal_source_c_sptr
|
friend rtl_tcp_signal_source_c_sptr
|
||||||
rtl_tcp_make_signal_source_c(const std::string &address,
|
rtl_tcp_make_signal_source_c(const std::string &address,
|
||||||
short port,
|
int16_t port,
|
||||||
bool flip_iq);
|
bool flip_iq);
|
||||||
|
|
||||||
rtl_tcp_signal_source_c(const std::string &address,
|
rtl_tcp_signal_source_c(const std::string &address,
|
||||||
short port,
|
int16_t port,
|
||||||
bool flip_iq);
|
bool flip_iq);
|
||||||
|
|
||||||
rtl_tcp_dongle_info info_;
|
rtl_tcp_dongle_info info_;
|
||||||
|
@ -62,9 +62,9 @@ bool systemIsBigEndian()
|
|||||||
|
|
||||||
bool systemBytesAreBigEndian()
|
bool systemBytesAreBigEndian()
|
||||||
{
|
{
|
||||||
byte_and_samples b;
|
byte_and_samples b{};
|
||||||
b.byte = static_cast<int8_t>(0x01);
|
b.byte = static_cast<int8_t>(0x01);
|
||||||
if (*(char *)&b.byte == 1)
|
if (*reinterpret_cast<char *>(&b.byte) == 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -158,7 +158,7 @@ int unpack_2bit_samples::work(int noutput_items,
|
|||||||
// 1) The samples in a byte are in big endian order
|
// 1) The samples in a byte are in big endian order
|
||||||
// 2) The samples in a byte are in little endian order
|
// 2) The samples in a byte are in little endian order
|
||||||
|
|
||||||
byte_and_samples raw_byte;
|
byte_and_samples raw_byte{};
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
if (!reverse_interleaving_)
|
if (!reverse_interleaving_)
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "unpack_byte_2bit_cpx_samples.h"
|
#include "unpack_byte_2bit_cpx_samples.h"
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
struct byte_2bit_struct
|
struct byte_2bit_struct
|
||||||
{
|
{
|
||||||
@ -49,8 +50,8 @@ unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples()
|
|||||||
|
|
||||||
|
|
||||||
unpack_byte_2bit_cpx_samples::unpack_byte_2bit_cpx_samples() : sync_interpolator("unpack_byte_2bit_cpx_samples",
|
unpack_byte_2bit_cpx_samples::unpack_byte_2bit_cpx_samples() : sync_interpolator("unpack_byte_2bit_cpx_samples",
|
||||||
gr::io_signature::make(1, 1, sizeof(signed char)),
|
gr::io_signature::make(1, 1, sizeof(int8_t)),
|
||||||
gr::io_signature::make(1, 1, sizeof(short)),
|
gr::io_signature::make(1, 1, sizeof(int16_t)),
|
||||||
4)
|
4)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -63,10 +64,10 @@ int unpack_byte_2bit_cpx_samples::work(int noutput_items,
|
|||||||
gr_vector_const_void_star &input_items,
|
gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items)
|
gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
const auto *in = reinterpret_cast<const signed char *>(input_items[0]);
|
const auto *in = reinterpret_cast<const int8_t *>(input_items[0]);
|
||||||
auto *out = reinterpret_cast<short *>(output_items[0]);
|
auto *out = reinterpret_cast<int16_t *>(output_items[0]);
|
||||||
|
|
||||||
byte_2bit_struct sample;
|
byte_2bit_struct sample{};
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i = 0; i < noutput_items / 4; i++)
|
for (int i = 0; i < noutput_items / 4; i++)
|
||||||
{
|
{
|
||||||
@ -76,34 +77,34 @@ int unpack_byte_2bit_cpx_samples::work(int noutput_items,
|
|||||||
//* Least Significant Nibble - Sample n+1
|
//* Least Significant Nibble - Sample n+1
|
||||||
//* Packing order in Nibble Q1 Q0 I1 I0
|
//* Packing order in Nibble Q1 Q0 I1 I0
|
||||||
//normal
|
//normal
|
||||||
// signed char c = in[i];
|
// int8_t c = in[i];
|
||||||
// //Q[n]
|
// //Q[n]
|
||||||
// sample.two_bit_sample = (c>>6) & 3;
|
// sample.two_bit_sample = (c>>6) & 3;
|
||||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||||
// //I[n]
|
// //I[n]
|
||||||
// sample.two_bit_sample = (c>>4) & 3;
|
// sample.two_bit_sample = (c>>4) & 3;
|
||||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||||
// //Q[n+1]
|
// //Q[n+1]
|
||||||
// sample.two_bit_sample = (c>>2) & 3;
|
// sample.two_bit_sample = (c>>2) & 3;
|
||||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||||
// //I[n+1]
|
// //I[n+1]
|
||||||
// sample.two_bit_sample = c & 3;
|
// sample.two_bit_sample = c & 3;
|
||||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||||
|
|
||||||
//I/Q swap
|
//I/Q swap
|
||||||
signed char c = in[i];
|
int8_t c = in[i];
|
||||||
//I[n]
|
//I[n]
|
||||||
sample.two_bit_sample = (c >> 4) & 3;
|
sample.two_bit_sample = (c >> 4) & 3;
|
||||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||||
//Q[n]
|
//Q[n]
|
||||||
sample.two_bit_sample = (c >> 6) & 3;
|
sample.two_bit_sample = (c >> 6) & 3;
|
||||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||||
//I[n+1]
|
//I[n+1]
|
||||||
sample.two_bit_sample = c & 3;
|
sample.two_bit_sample = c & 3;
|
||||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||||
//Q[n+1]
|
//Q[n+1]
|
||||||
sample.two_bit_sample = (c >> 2) & 3;
|
sample.two_bit_sample = (c >> 2) & 3;
|
||||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||||
}
|
}
|
||||||
return noutput_items;
|
return noutput_items;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ int unpack_byte_2bit_samples::work(int noutput_items,
|
|||||||
const auto *in = reinterpret_cast<const signed char *>(input_items[0]);
|
const auto *in = reinterpret_cast<const signed char *>(input_items[0]);
|
||||||
auto *out = reinterpret_cast<float *>(output_items[0]);
|
auto *out = reinterpret_cast<float *>(output_items[0]);
|
||||||
|
|
||||||
byte_2bit_struct sample;
|
byte_2bit_struct sample{};
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i = 0; i < noutput_items / 4; i++)
|
for (int i = 0; i < noutput_items / 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
class rtl_tcp_dongle_info
|
class rtl_tcp_dongle_info
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
char magic_[4];
|
char magic_[4]{};
|
||||||
uint32_t tuner_type_;
|
uint32_t tuner_type_;
|
||||||
uint32_t tuner_gain_count_;
|
uint32_t tuner_gain_count_;
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ int galileo_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_symbol{}; // structure to save the synchronization information and send the output object to the next block
|
||||||
// 1. Copy the current tracking output
|
// 1. Copy the current tracking output
|
||||||
current_symbol = in[0][0];
|
current_symbol = in[0][0];
|
||||||
// add new symbol to the symbol queue
|
// add new symbol to the symbol queue
|
||||||
|
@ -125,7 +125,7 @@ private:
|
|||||||
|
|
||||||
// vars for Viterbi decoder
|
// vars for Viterbi decoder
|
||||||
int32_t *out0, *out1, *state0, *state1;
|
int32_t *out0, *out1, *state0, *state1;
|
||||||
int32_t g_encoder[2];
|
int32_t g_encoder[2]{};
|
||||||
const int32_t nn = 2; // Coding rate 1/n
|
const int32_t nn = 2; // Coding rate 1/n
|
||||||
const int32_t KK = 7; // Constraint Length
|
const int32_t KK = 7; // Constraint Length
|
||||||
int32_t mm = KK - 1;
|
int32_t mm = KK - 1;
|
||||||
|
@ -74,7 +74,7 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
|||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
for (unsigned short d_preambles_bit : d_preambles_bits)
|
for (uint16_t d_preambles_bit : d_preambles_bits)
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
||||||
{
|
{
|
||||||
@ -268,7 +268,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_symbol{}; // structure to save the synchronization information and send the output object to the next block
|
||||||
// 1. Copy the current tracking output
|
// 1. Copy the current tracking output
|
||||||
current_symbol = in[0][0];
|
current_symbol = in[0][0];
|
||||||
d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue
|
d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue
|
||||||
|
@ -82,7 +82,7 @@ private:
|
|||||||
double d_preamble_time_samples;
|
double d_preamble_time_samples;
|
||||||
|
|
||||||
//!< Preamble decoding
|
//!< Preamble decoding
|
||||||
uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS];
|
uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS]{};
|
||||||
int32_t *d_preambles_symbols;
|
int32_t *d_preambles_symbols;
|
||||||
uint32_t d_samples_per_symbol;
|
uint32_t d_samples_per_symbol;
|
||||||
int32_t d_symbols_per_preamble;
|
int32_t d_symbols_per_preamble;
|
||||||
|
@ -74,7 +74,7 @@ glonass_l2_ca_telemetry_decoder_cc::glonass_l2_ca_telemetry_decoder_cc(
|
|||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
for (unsigned short d_preambles_bit : d_preambles_bits)
|
for (uint16_t d_preambles_bit : d_preambles_bits)
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
||||||
{
|
{
|
||||||
@ -268,7 +268,7 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_symbol{}; // structure to save the synchronization information and send the output object to the next block
|
||||||
// 1. Copy the current tracking output
|
// 1. Copy the current tracking output
|
||||||
current_symbol = in[0][0];
|
current_symbol = in[0][0];
|
||||||
d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue
|
d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue
|
||||||
|
@ -80,7 +80,7 @@ private:
|
|||||||
double d_preamble_time_samples;
|
double d_preamble_time_samples;
|
||||||
|
|
||||||
//!< Preamble decoding
|
//!< Preamble decoding
|
||||||
uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS];
|
uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS]{};
|
||||||
int32_t *d_preambles_symbols;
|
int32_t *d_preambles_symbols;
|
||||||
uint32_t d_samples_per_symbol;
|
uint32_t d_samples_per_symbol;
|
||||||
int32_t d_symbols_per_preamble;
|
int32_t d_symbols_per_preamble;
|
||||||
|
@ -67,7 +67,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
|||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
d_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
for (unsigned short preambles_bit : preambles_bits)
|
for (uint16_t preambles_bit : preambles_bits)
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
||||||
{
|
{
|
||||||
@ -316,7 +316,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_symbol{}; // structure to save the synchronization information and send the output object to the next block
|
||||||
// 1. Copy the current tracking output
|
// 1. Copy the current tracking output
|
||||||
current_symbol = in[0][0];
|
current_symbol = in[0][0];
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ private:
|
|||||||
|
|
||||||
// symbols
|
// symbols
|
||||||
boost::circular_buffer<Gnss_Synchro> d_symbol_history;
|
boost::circular_buffer<Gnss_Synchro> d_symbol_history;
|
||||||
float d_subframe_symbols[GPS_SUBFRAME_MS]; // symbols per subframe
|
float d_subframe_symbols[GPS_SUBFRAME_MS]{}; // symbols per subframe
|
||||||
int d_current_subframe_symbol;
|
int d_current_subframe_symbol;
|
||||||
|
|
||||||
// bits and frame
|
// bits and frame
|
||||||
|
@ -143,7 +143,7 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
consume_each(1); // one by one
|
consume_each(1); // one by one
|
||||||
|
|
||||||
// UPDATE GNSS SYNCHRO DATA
|
// UPDATE GNSS SYNCHRO DATA
|
||||||
Gnss_Synchro current_synchro_data; // structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_synchro_data{}; // structure to save the synchronization information and send the output object to the next block
|
||||||
|
|
||||||
// 1. Copy the current tracking output
|
// 1. Copy the current tracking output
|
||||||
current_synchro_data = in[0];
|
current_synchro_data = in[0];
|
||||||
|
@ -91,7 +91,7 @@ private:
|
|||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
cnav_msg_decoder_t d_cnav_decoder;
|
cnav_msg_decoder_t d_cnav_decoder{};
|
||||||
|
|
||||||
int32_t d_state;
|
int32_t d_state;
|
||||||
int32_t d_crc_error_count;
|
int32_t d_crc_error_count;
|
||||||
|
@ -145,7 +145,7 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u
|
|||||||
const auto *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
const auto *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
// UPDATE GNSS SYNCHRO DATA
|
// UPDATE GNSS SYNCHRO DATA
|
||||||
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_synchro_data{}; //structure to save the synchronization information and send the output object to the next block
|
||||||
// 1. Copy the current tracking output
|
// 1. Copy the current tracking output
|
||||||
current_synchro_data = in[0];
|
current_synchro_data = in[0];
|
||||||
consume_each(1); //one by one
|
consume_each(1); //one by one
|
||||||
|
@ -83,14 +83,14 @@ private:
|
|||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
cnav_msg_decoder_t d_cnav_decoder;
|
cnav_msg_decoder_t d_cnav_decoder{};
|
||||||
|
|
||||||
uint32_t d_TOW_at_current_symbol_ms;
|
uint32_t d_TOW_at_current_symbol_ms;
|
||||||
uint32_t d_TOW_at_Preamble_ms;
|
uint32_t d_TOW_at_Preamble_ms;
|
||||||
bool d_flag_valid_word;
|
bool d_flag_valid_word;
|
||||||
|
|
||||||
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
||||||
double bits_NH[GPS_L5i_NH_CODE_LENGTH];
|
double bits_NH[GPS_L5i_NH_CODE_LENGTH]{};
|
||||||
std::deque<double> sym_hist;
|
std::deque<double> sym_hist;
|
||||||
bool sync_NH;
|
bool sync_NH;
|
||||||
bool new_sym;
|
bool new_sym;
|
||||||
|
@ -425,7 +425,7 @@ int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
auto *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
|
auto *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
|
||||||
const auto *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
const auto *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_symbol{}; // structure to save the synchronization information and send the output object to the next block
|
||||||
// 1. Copy the current tracking output
|
// 1. Copy the current tracking output
|
||||||
current_symbol = in[0];
|
current_symbol = in[0];
|
||||||
// copy correlation samples into samples vector
|
// copy correlation samples into samples vector
|
||||||
|
@ -224,12 +224,9 @@ gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_left_block()
|
|||||||
{
|
{
|
||||||
return tracking_sc;
|
return tracking_sc;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_right_block()
|
gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_right_block()
|
||||||
@ -242,9 +239,8 @@ gr::basic_block_sptr GlonassL1CaDllPllCAidTracking::get_right_block()
|
|||||||
{
|
{
|
||||||
return tracking_sc;
|
return tracking_sc;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -222,12 +222,9 @@ gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_left_block()
|
|||||||
{
|
{
|
||||||
return tracking_sc;
|
return tracking_sc;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_right_block()
|
gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_right_block()
|
||||||
@ -240,9 +237,6 @@ gr::basic_block_sptr GlonassL2CaDllPllCAidTracking::get_right_block()
|
|||||||
{
|
{
|
||||||
return tracking_sc;
|
return tracking_sc;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -218,12 +218,9 @@ gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_left_block()
|
|||||||
{
|
{
|
||||||
return tracking_sc;
|
return tracking_sc;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_right_block()
|
gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_right_block()
|
||||||
{
|
{
|
||||||
@ -235,9 +232,6 @@ gr::basic_block_sptr GpsL1CaDllPllCAidTracking::get_right_block()
|
|||||||
{
|
{
|
||||||
return tracking_sc;
|
return tracking_sc;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
LOG(WARNING) << item_type_ << " unknown tracking item type";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -133,7 +133,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
|||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_gps_l1ca_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
d_gps_l1ca_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
for (unsigned short preambles_bit : preambles_bits)
|
for (uint16_t preambles_bit : preambles_bits)
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
||||||
{
|
{
|
||||||
|
@ -572,9 +572,9 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel)
|
|||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -913,9 +913,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
|||||||
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,9 +563,9 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel)
|
|||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -902,9 +902,9 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
|||||||
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,9 +569,9 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel)
|
|||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -910,9 +910,9 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
|
|||||||
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,9 +562,9 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel)
|
|||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl;
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -901,9 +901,9 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
|
|||||||
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,9 +551,9 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel)
|
|||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what() << std::endl;
|
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -891,9 +891,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
|
|||||||
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,9 +553,9 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel)
|
|||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e->what();
|
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -892,9 +892,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
|
|||||||
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure *e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception writing trk dump file " << e->what();
|
LOG(WARNING) << "Exception writing trk dump file " << e.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ int32_t Gps_L1_Ca_Kf_Tracking_cc::save_matfile()
|
|||||||
filename.erase(filename.length() - 4, 4);
|
filename.erase(filename.length() - 4, 4);
|
||||||
filename.append(".mat");
|
filename.append(".mat");
|
||||||
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73);
|
||||||
if (reinterpret_cast<long *>(matfp) != nullptr)
|
if (reinterpret_cast<int64_t *>(matfp) != nullptr)
|
||||||
{
|
{
|
||||||
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
size_t dims[2] = {1, static_cast<size_t>(num_epoch)};
|
||||||
matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0);
|
matvar = Mat_VarCreate("abs_VE", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, abs_VE, 0);
|
||||||
|
@ -65,7 +65,7 @@ public:
|
|||||||
double carrier_lock_th;
|
double carrier_lock_th;
|
||||||
bool track_pilot;
|
bool track_pilot;
|
||||||
char system;
|
char system;
|
||||||
char signal[3];
|
char signal[3]{};
|
||||||
|
|
||||||
Dll_Pll_Conf();
|
Dll_Pll_Conf();
|
||||||
};
|
};
|
||||||
|
@ -35,9 +35,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
tcp_communication::tcp_communication() : tcp_socket_(io_service_)
|
tcp_communication::tcp_communication() : tcp_socket_(io_service_) {} // NOLINT
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
tcp_communication::~tcp_communication() = default;
|
tcp_communication::~tcp_communication() = default;
|
||||||
|
@ -52,6 +52,7 @@ Tracking_loop_filter::Tracking_loop_filter(float update_interval,
|
|||||||
update_coefficients();
|
update_coefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tracking_loop_filter::Tracking_loop_filter()
|
Tracking_loop_filter::Tracking_loop_filter()
|
||||||
: d_loop_order(2),
|
: d_loop_order(2),
|
||||||
d_current_index(0),
|
d_current_index(0),
|
||||||
@ -64,10 +65,9 @@ Tracking_loop_filter::Tracking_loop_filter()
|
|||||||
update_coefficients();
|
update_coefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
Tracking_loop_filter::~Tracking_loop_filter()
|
|
||||||
{
|
Tracking_loop_filter::~Tracking_loop_filter() = default;
|
||||||
// Don't need to do anything here
|
|
||||||
}
|
|
||||||
|
|
||||||
float Tracking_loop_filter::apply(float current_input)
|
float Tracking_loop_filter::apply(float current_input)
|
||||||
{
|
{
|
||||||
@ -108,6 +108,7 @@ float Tracking_loop_filter::apply(float current_input)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tracking_loop_filter::update_coefficients(void)
|
void Tracking_loop_filter::update_coefficients(void)
|
||||||
{
|
{
|
||||||
// Analog gains:
|
// Analog gains:
|
||||||
@ -216,17 +217,20 @@ void Tracking_loop_filter::update_coefficients(void)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tracking_loop_filter::set_noise_bandwidth(float noise_bandwidth)
|
void Tracking_loop_filter::set_noise_bandwidth(float noise_bandwidth)
|
||||||
{
|
{
|
||||||
d_noise_bandwidth = noise_bandwidth;
|
d_noise_bandwidth = noise_bandwidth;
|
||||||
update_coefficients();
|
update_coefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float Tracking_loop_filter::get_noise_bandwidth(void) const
|
float Tracking_loop_filter::get_noise_bandwidth(void) const
|
||||||
{
|
{
|
||||||
return d_noise_bandwidth;
|
return d_noise_bandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tracking_loop_filter::set_update_interval(float update_interval)
|
void Tracking_loop_filter::set_update_interval(float update_interval)
|
||||||
{
|
{
|
||||||
d_update_interval = update_interval;
|
d_update_interval = update_interval;
|
||||||
@ -238,17 +242,20 @@ float Tracking_loop_filter::get_update_interval(void) const
|
|||||||
return d_update_interval;
|
return d_update_interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tracking_loop_filter::set_include_last_integrator(bool include_last_integrator)
|
void Tracking_loop_filter::set_include_last_integrator(bool include_last_integrator)
|
||||||
{
|
{
|
||||||
d_include_last_integrator = include_last_integrator;
|
d_include_last_integrator = include_last_integrator;
|
||||||
update_coefficients();
|
update_coefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Tracking_loop_filter::get_include_last_integrator(void) const
|
bool Tracking_loop_filter::get_include_last_integrator(void) const
|
||||||
{
|
{
|
||||||
return d_include_last_integrator;
|
return d_include_last_integrator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tracking_loop_filter::set_order(int loop_order)
|
void Tracking_loop_filter::set_order(int loop_order)
|
||||||
{
|
{
|
||||||
if (loop_order < 1 or loop_order > MAX_LOOP_ORDER)
|
if (loop_order < 1 or loop_order > MAX_LOOP_ORDER)
|
||||||
@ -264,11 +271,13 @@ void Tracking_loop_filter::set_order(int loop_order)
|
|||||||
update_coefficients();
|
update_coefficients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Tracking_loop_filter::get_order(void) const
|
int Tracking_loop_filter::get_order(void) const
|
||||||
{
|
{
|
||||||
return d_loop_order;
|
return d_loop_order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tracking_loop_filter::initialize(float initial_output)
|
void Tracking_loop_filter::initialize(float initial_output)
|
||||||
{
|
{
|
||||||
d_inputs.assign(MAX_LOOP_HISTORY_LENGTH, 0.0);
|
d_inputs.assign(MAX_LOOP_HISTORY_LENGTH, 0.0);
|
||||||
|
@ -64,16 +64,16 @@ int INIReader::ParseError()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string INIReader::Get(std::string section, std::string name, std::string default_value)
|
std::string INIReader::Get(const std::string& section, const std::string& name, std::string default_value)
|
||||||
{
|
{
|
||||||
std::string key = MakeKey(std::move(section), std::move(name));
|
std::string key = MakeKey(section, name);
|
||||||
return _values.count(key) ? _values[key] : default_value;
|
return _values.count(key) ? _values[key] : default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int64_t INIReader::GetInteger(std::string section, std::string name, int64_t default_value)
|
int64_t INIReader::GetInteger(const std::string& section, const std::string& name, int64_t default_value)
|
||||||
{
|
{
|
||||||
std::string valstr = Get(std::move(section), std::move(name), "");
|
std::string valstr = Get(section, name, "");
|
||||||
const char* value = valstr.c_str();
|
const char* value = valstr.c_str();
|
||||||
char* end;
|
char* end;
|
||||||
// This parses "1234" (decimal) and also "0x4D2" (hex)
|
// This parses "1234" (decimal) and also "0x4D2" (hex)
|
||||||
|
@ -66,11 +66,11 @@ public:
|
|||||||
int ParseError();
|
int ParseError();
|
||||||
|
|
||||||
//! Get a string value from INI file, returning default_value if not found.
|
//! Get a string value from INI file, returning default_value if not found.
|
||||||
std::string Get(std::string section, std::string name,
|
std::string Get(const std::string& section, const std::string& name,
|
||||||
std::string default_value);
|
std::string default_value);
|
||||||
|
|
||||||
//! Get an integer (long) value from INI file, returning default_value if not found.
|
//! Get an integer (long) value from INI file, returning default_value if not found.
|
||||||
int64_t GetInteger(std::string section, std::string name, int64_t default_value);
|
int64_t GetInteger(const std::string& section, const std::string& name, int64_t default_value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _error;
|
int _error;
|
||||||
|
@ -74,9 +74,9 @@ private:
|
|||||||
int lac;
|
int lac;
|
||||||
int ci;
|
int ci;
|
||||||
// assistance protocol structure
|
// assistance protocol structure
|
||||||
supl_ctx_t ctx;
|
supl_ctx_t ctx{};
|
||||||
// assistance data
|
// assistance data
|
||||||
supl_assist_t assist;
|
supl_assist_t assist{};
|
||||||
bool read_gal_almanac_from_gsa(const std::string& file_name);
|
bool read_gal_almanac_from_gsa(const std::string& file_name);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -50,11 +50,9 @@ bool StringConverter::convert(const std::string& value, bool default_value)
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return default_value;
|
return default_value;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int64_t StringConverter::convert(const std::string& value, int64_t default_value)
|
int64_t StringConverter::convert(const std::string& value, int64_t default_value)
|
||||||
|
@ -788,7 +788,7 @@ static int argument_is_stdin(char *av[], int idx) {
|
|||||||
static FILE *argument_to_file(char *av[], int idx) {
|
static FILE *argument_to_file(char *av[], int idx) {
|
||||||
return argument_is_stdin(av, idx)
|
return argument_is_stdin(av, idx)
|
||||||
? stdin
|
? stdin
|
||||||
: fopen(av[idx], "r");
|
: fopen(av[idx], "re");
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *argument_to_name(char *av[], int idx) {
|
static char *argument_to_name(char *av[], int idx) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <asn_internal.h>
|
#include <asn_internal.h>
|
||||||
#include <per_encoder.h>
|
#include <per_encoder.h>
|
||||||
|
|
||||||
static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
|
static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t * /*constraints*/, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
|
||||||
|
|
||||||
asn_enc_rval_t
|
asn_enc_rval_t
|
||||||
uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
|
uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
|
||||||
|
@ -17,7 +17,7 @@ typedef struct uper_ugot_key
|
|||||||
|
|
||||||
static int uper_ugot_refill(asn_per_data_t *pd);
|
static int uper_ugot_refill(asn_per_data_t *pd);
|
||||||
static int per_skip_bits(asn_per_data_t *pd, int skip_nbits);
|
static int per_skip_bits(asn_per_data_t *pd, int skip_nbits);
|
||||||
static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd);
|
static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t * /*ctx*/, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd);
|
||||||
|
|
||||||
int asn_debug_indent;
|
int asn_debug_indent;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <asn_internal.h>
|
#include <asn_internal.h>
|
||||||
#include <per_encoder.h>
|
#include <per_encoder.h>
|
||||||
|
|
||||||
static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
|
static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t * /*constraints*/, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
|
||||||
|
|
||||||
asn_enc_rval_t
|
asn_enc_rval_t
|
||||||
uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
|
uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
|
||||||
|
@ -17,7 +17,7 @@ typedef struct uper_ugot_key
|
|||||||
|
|
||||||
static int uper_ugot_refill(asn_per_data_t *pd);
|
static int uper_ugot_refill(asn_per_data_t *pd);
|
||||||
static int per_skip_bits(asn_per_data_t *pd, int skip_nbits);
|
static int per_skip_bits(asn_per_data_t *pd, int skip_nbits);
|
||||||
static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd);
|
static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t * /*ctx*/, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd);
|
||||||
|
|
||||||
int asn_debug_indent;
|
int asn_debug_indent;
|
||||||
|
|
||||||
|
@ -949,4 +949,3 @@ void EXPORT supl_set_debug(FILE *log, int flags) {
|
|||||||
if (flags & SUPL_DEBUG_DEBUG) debug.debug = 1;
|
if (flags & SUPL_DEBUG_DEBUG) debug.debug = 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const unsigned short& port) : socket{io_service}
|
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port) : socket{io_service}
|
||||||
{
|
{
|
||||||
for (auto address : addresses)
|
for (auto address : addresses)
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user