1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-09 03:20:01 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2019-05-08 21:05:24 +02:00
commit c6e419c527
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
22 changed files with 174 additions and 49 deletions

View File

@ -4,6 +4,7 @@
- Fixed bug that caused a random deadlock in the Observables block, preventing the computation of PVT fixes.
- Fixed bug in Galileo INAV message decoding when PLL is locked at 180 degrees, which prevented from correct navigation message decoding in some situations.
- Fixed PVT computation continuity through the TOW rollover.
### Improvements in Efficiency
@ -27,6 +28,8 @@
- Added a custom UDP/IP output for PVT data streaming.
- Improved Monitor block with UDP/IP output for internal receiver's data streaming.
- Custom output formats described with .proto files, making easier to other applications reading them in a forward and backward-compatible fashion upon future format changes.
- Fixes in RINEX generation: week rollover, annotations are not repeated anymore in navigation files. Parameter rinexnav_rate_ms has been removed, annotations are made as new ephemeris arrive.
- Fixes in RTCM messages generation: week rollover.
### Improvements in Maintainability:
@ -34,6 +37,7 @@
- Usage of clang-tidy integrated into CMake scripts. New option -DENABLE_CLANG_TIDY=ON executes clang-tidy along with compilation. Requires clang compiler.
- Applied clang-tidy checks and fixes related to readability: readability-container-size-empty, readability-identifier-naming, readability-inconsistent-declaration-parameter-name, readability-named-parameter, readability-non-const-parameter, readability-string-compare.
- Improved includes selection following suggestions by include-what-you-use (see https://include-what-you-use.org/), allowing faster compiles, fewer recompiles and making refactoring easier.
- Deprecated boost::asio::io_service replaced by boost::asio::io_context if Boost > 1.65
### Improvements in Portability:

View File

@ -87,6 +87,13 @@ target_include_directories(pvt_libs
target_compile_definitions(pvt_libs PRIVATE -DGNSS_SDR_VERSION="${VERSION}")
if(Boost_VERSION VERSION_GREATER "106500")
target_compile_definitions(pvt_libs
PUBLIC
-DBOOST_GREATER_1_65
)
endif()
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # not AppleClang
target_compile_definitions(pvt_libs

View File

@ -35,7 +35,7 @@
#include <sstream>
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_service}
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
{
for (const auto& address : addresses)
{

View File

@ -36,6 +36,12 @@
#include "serdes_monitor_pvt.h"
#include <boost/asio.hpp>
#if BOOST_GREATER_1_65
using b_io_context = boost::asio::io_context;
#else
using b_io_context = boost::asio::io_service;
#endif
class Monitor_Pvt_Udp_Sink
{
public:
@ -43,7 +49,7 @@ public:
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt);
private:
boost::asio::io_service io_service;
b_io_context io_context;
boost::asio::ip::udp::socket socket;
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;

View File

@ -3402,6 +3402,13 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
@ -3411,6 +3418,13 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}

View File

@ -56,6 +56,12 @@
#include <utility>
#include <vector>
#if BOOST_GREATER_1_65
using b_io_context = boost::asio::io_context;
#else
using b_io_context = boost::asio::io_service;
#endif
/*!
* \brief This class implements the generation and reading of some Message Types
@ -757,7 +763,7 @@ private:
: public std::enable_shared_from_this<Tcp_Internal_Client>
{
public:
Tcp_Internal_Client(boost::asio::io_service& io_context,
Tcp_Internal_Client(b_io_context& io_context,
boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
: io_context_(io_context), socket_(io_context)
{
@ -835,7 +841,7 @@ private:
});
}
boost::asio::io_service& io_context_;
b_io_context& io_context_;
boost::asio::ip::tcp::socket socket_;
Rtcm_Message read_msg_;
std::deque<Rtcm_Message> write_msgs_;
@ -845,7 +851,7 @@ private:
class Queue_Reader
{
public:
Queue_Reader(boost::asio::io_service& io_context, std::shared_ptr<Concurrent_Queue<std::string> >& queue, int32_t port) : queue_(queue)
Queue_Reader(b_io_context& io_context, std::shared_ptr<Concurrent_Queue<std::string> >& queue, int32_t port) : queue_(queue)
{
boost::asio::ip::tcp::resolver resolver(io_context);
std::string host("localhost");
@ -883,7 +889,7 @@ private:
class Tcp_Server
{
public:
Tcp_Server(boost::asio::io_service& io_context, const boost::asio::ip::tcp::endpoint& endpoint)
Tcp_Server(b_io_context& io_context, const boost::asio::ip::tcp::endpoint& endpoint)
: acceptor_(io_context), socket_(io_context)
{
acceptor_.open(endpoint.protocol());
@ -950,7 +956,7 @@ private:
bool start_session = true;
};
boost::asio::io_service io_context;
b_io_context io_context;
std::shared_ptr<Concurrent_Queue<std::string> > rtcm_message_queue;
std::thread t;
std::thread tq;

View File

@ -128,7 +128,7 @@ void alm2pos(gtime_t time, const alm_t *alm, double *rs, double *dts)
trace(4, "alm2pos : time=%s sat=%2d\n", time_str(time, 3), alm->sat);
tk = timediff(time, alm->toa);
tk = timediffweekcrossover(time, alm->toa);
if (alm->A <= 0.0)
{
@ -181,7 +181,7 @@ double eph2clk(gtime_t time, const eph_t *eph)
trace(4, "eph2clk : time=%s sat=%2d\n", time_str(time, 3), eph->sat);
t = timediff(time, eph->toc);
t = timediffweekcrossover(time, eph->toc);
for (i = 0; i < 2; i++)
{
@ -218,7 +218,7 @@ void eph2pos(gtime_t time, const eph_t *eph, double *rs, double *dts,
rs[0] = rs[1] = rs[2] = *dts = *var = 0.0;
return;
}
tk = timediff(time, eph->toe);
tk = timediffweekcrossover(time, eph->toe);
switch ((sys = satsys(eph->sat, &prn)))
{
@ -288,7 +288,7 @@ void eph2pos(gtime_t time, const eph_t *eph, double *rs, double *dts,
rs[1] = x * sinO + y * cosi * cosO;
rs[2] = y * sin(i);
}
tk = timediff(time, eph->toc);
tk = timediffweekcrossover(time, eph->toc);
*dts = eph->f0 + eph->f1 * tk + eph->f2 * tk * tk;
/* relativity correction */
@ -433,7 +433,7 @@ double seph2clk(gtime_t time, const seph_t *seph)
trace(4, "seph2clk: time=%s sat=%2d\n", time_str(time, 3), seph->sat);
t = timediff(time, seph->t0);
t = timediffweekcrossover(time, seph->t0);
for (i = 0; i < 2; i++)
{
@ -461,7 +461,7 @@ void seph2pos(gtime_t time, const seph_t *seph, double *rs, double *dts,
trace(4, "seph2pos: time=%s sat=%2d\n", time_str(time, 3), seph->sat);
t = timediff(time, seph->t0);
t = timediffweekcrossover(time, seph->t0);
for (i = 0; i < 3; i++)
{
@ -508,7 +508,7 @@ eph_t *seleph(gtime_t time, int sat, int iode, const nav_t *nav)
{
continue;
}
if ((t = fabs(timediff(nav->eph[i].toe, time))) > tmax)
if ((t = fabs(timediffweekcrossover(nav->eph[i].toe, time))) > tmax)
{
continue;
}
@ -588,7 +588,7 @@ seph_t *selseph(gtime_t time, int sat, const nav_t *nav)
{
continue;
}
if ((t = fabs(timediff(nav->seph[i].t0, time))) > tmax)
if ((t = fabs(timediffweekcrossover(nav->seph[i].t0, time))) > tmax)
{
continue;
}
@ -792,9 +792,9 @@ int satpos_ssr(gtime_t time, gtime_t teph, int sat, const nav_t *nav,
*svh = -1;
return 0;
}
t1 = timediff(time, ssr->t0[0]);
t2 = timediff(time, ssr->t0[1]);
t3 = timediff(time, ssr->t0[2]);
t1 = timediffweekcrossover(time, ssr->t0[0]);
t2 = timediffweekcrossover(time, ssr->t0[1]);
t3 = timediffweekcrossover(time, ssr->t0[2]);
/* ssr orbit and clock correction (ref [4]) */
if (fabs(t1) > MAXAGESSR || fabs(t2) > MAXAGESSR)
@ -847,7 +847,7 @@ int satpos_ssr(gtime_t time, gtime_t teph, int sat, const nav_t *nav,
}
/* satellite clock by clock parameters */
tk = timediff(time, eph->toc);
tk = timediffweekcrossover(time, eph->toc);
dts[0] = eph->f0 + eph->f1 * tk + eph->f2 * tk * tk;
dts[1] = eph->f1 + 2.0 * eph->f2 * tk;

View File

@ -223,12 +223,11 @@ const unsigned int TBL_CR_C24_Q[] = {
0x42FA2F, 0xC4B6D4, 0xC82F22, 0x4E63D9, 0xD11CCE, 0x575035, 0x5BC9C3, 0xDD8538};
extern "C"
{
void dgemm_(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
extern void dgetrf_(int *, int *, double *, int *, int *, int *);
extern void dgetri_(int *, double *, int *, int *, double *, int *, int *);
extern void dgetrs_(char *, int *, int *, double *, int *, int *, double *, int *, int *);
extern "C" {
void dgemm_(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *);
extern void dgetrf_(int *, int *, double *, int *, int *, int *);
extern void dgetri_(int *, double *, int *, int *, double *, int *, int *);
extern void dgetrs_(char *, int *, int *, double *, int *, int *, double *, int *, int *);
}
@ -1690,7 +1689,28 @@ double timediff(gtime_t t1, gtime_t t2)
return difftime(t1.time, t2.time) + t1.sec - t2.sec;
}
/* time difference accounting with week crossovers -------------------------------------------------------------
* difference between gtime_t structs
* args : gtime_t t1,t2 I gtime_t structs
* return : time difference (t1-t2) (s)
*-----------------------------------------------------------------------------*/
double timediffweekcrossover(gtime_t t1, gtime_t t2)
{
//as stated in IS-GPS-200J table 20-IV footnote among other parts of the ICD,
//if tk=(t - toe) > 302400s then tk = tk - s
//if tk=(t - toe) < -302400s then tk = tk + 604800s
double tk = difftime(t1.time, t2.time) + t1.sec - t2.sec;
if (tk > 302400.0)
{
tk -= 604800.0;
}
else if (tk < -302400.0)
{
tk += 604800.0;
}
return tk;
}
/* get current time in utc -----------------------------------------------------
* get current time in utc
* args : none

View File

@ -173,6 +173,7 @@ gtime_t bdt2time(int week, double sec);
double time2bdt(gtime_t t, int *week);
gtime_t timeadd(gtime_t t, double sec);
double timediff(gtime_t t1, gtime_t t2);
double timediffweekcrossover(gtime_t t1, gtime_t t2);
gtime_t timeget(void);
void timeset(gtime_t t);
int read_leaps_text(FILE *fp);

View File

@ -441,8 +441,16 @@ bool hybrid_observables_gs::interp_trk_obs(Gnss_Synchro &interpolated_obs, const
// CARRIER DOPPLER INTERPOLATION
interpolated_obs.Carrier_Doppler_hz = d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz + (d_gnss_synchro_history->at(ch, t2_idx).Carrier_Doppler_hz - d_gnss_synchro_history->at(ch, t1_idx).Carrier_Doppler_hz) * time_factor;
// TOW INTERPOLATION
interpolated_obs.interp_TOW_ms = static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast<double>(d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms) - static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor;
// check TOW rollover
if ((d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms - d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) > 0)
{
interpolated_obs.interp_TOW_ms = static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast<double>(d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms) - static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor;
}
else
{
//TOW rollover situation
interpolated_obs.interp_TOW_ms = static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms) + (static_cast<double>(d_gnss_synchro_history->at(ch, t2_idx).TOW_at_current_symbol_ms + 604800000) - static_cast<double>(d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms)) * time_factor;
}
// LOG(INFO) << "Channel " << ch << " int idx: " << t1_idx << " TOW Int: " << interpolated_obs.interp_TOW_ms
// << " TOW p1 : " << d_gnss_synchro_history->at(ch, t1_idx).TOW_at_current_symbol_ms
@ -507,9 +515,9 @@ void hybrid_observables_gs::update_TOW(const std::vector<Gnss_Synchro> &data)
else
{
T_rx_TOW_ms += T_rx_step_ms; //the tow time step increment must match the ref time channel step
//todo: check what happens during the week rollover
if (T_rx_TOW_ms >= 604800000)
{
DLOG(INFO) << "TOW RX TIME rollover!";
T_rx_TOW_ms = T_rx_TOW_ms % 604800000;
}
}
@ -521,15 +529,19 @@ void hybrid_observables_gs::compute_pranges(std::vector<Gnss_Synchro> &data)
// std::cout.precision(17);
// std::cout << " T_rx_TOW_ms: " << static_cast<double>(T_rx_TOW_ms) << std::endl;
std::vector<Gnss_Synchro>::iterator it;
double current_T_rx_TOW_s = (static_cast<double>(T_rx_TOW_ms - T_rx_remnant_to_20ms) + GPS_STARTOFFSET_MS) / 1000.0;
double current_T_rx_TOW_ms = (static_cast<double>(T_rx_TOW_ms - T_rx_remnant_to_20ms));
double current_T_rx_TOW_s = current_T_rx_TOW_ms / 1000.0;
for (it = data.begin(); it != data.end(); it++)
{
if (it->Flag_valid_word)
{
double traveltime_s = current_T_rx_TOW_s - it->interp_TOW_ms / 1000.0;
//todo: check what happens during the week rollover (TOW rollover at 604800000ms)
double traveltime_ms = current_T_rx_TOW_ms - it->interp_TOW_ms;
if (fabs(traveltime_ms) > 302400) //check TOW roll over
{
traveltime_ms = 604800000.0 + current_T_rx_TOW_ms - it->interp_TOW_ms;
}
it->RX_time = current_T_rx_TOW_s;
it->Pseudorange_m = traveltime_s * SPEED_OF_LIGHT;
it->Pseudorange_m = traveltime_ms * SPEED_OF_LIGHT_MS;
it->Flag_valid_pseudorange = true;
// debug code
//

View File

@ -85,6 +85,13 @@ if(OS_IS_MACOSX)
endif()
endif()
if(Boost_VERSION VERSION_GREATER "106500")
target_compile_definitions(signal_source_gr_blocks
PUBLIC
-DBOOST_GREATER_1_65
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(signal_source_gr_blocks

View File

@ -65,7 +65,7 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
: gr::sync_block("rtl_tcp_signal_source_c",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
socket_(io_service_),
socket_(io_context_),
data_(RTL_TCP_PAYLOAD_SIZE),
flip_iq_(flip_iq),
buffer_(RTL_TCP_BUFFER_SIZE),
@ -147,14 +147,14 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
boost::asio::async_read(socket_, boost::asio::buffer(data_),
boost::bind(&rtl_tcp_signal_source_c::handle_read,
this, _1, _2));
boost::thread(boost::bind(&boost::asio::io_service::run, &io_service_));
boost::thread(boost::bind(&b_io_context::run, &io_context_));
}
rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c() // NOLINT(modernize-use-equals-default)
{
mutex_.unlock();
io_service_.stop();
io_context_.stop();
not_empty_.notify_one();
not_full_.notify_one();
}
@ -289,7 +289,7 @@ void rtl_tcp_signal_source_c::handle_read(const boost::system::error_code &ec,
std::cout << "Error during read: " << ec << std::endl;
LOG(WARNING) << "Error during read: " << ec;
boost::mutex::scoped_lock lock(mutex_);
io_service_.stop();
io_context_.stop();
not_empty_.notify_one();
}
else
@ -334,7 +334,7 @@ int rtl_tcp_signal_source_c::work(int noutput_items,
{
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
int i = 0;
if (io_service_.stopped())
if (io_context_.stopped())
{
return -1;
}

View File

@ -52,6 +52,12 @@ class rtl_tcp_signal_source_c;
using rtl_tcp_signal_source_c_sptr = boost::shared_ptr<rtl_tcp_signal_source_c>;
#if BOOST_GREATER_1_65
using b_io_context = boost::asio::io_context;
#else
using b_io_context = boost::asio::io_service;
#endif
rtl_tcp_signal_source_c_sptr
rtl_tcp_make_signal_source_c(const std::string &address,
int16_t port,
@ -91,7 +97,7 @@ private:
Rtl_Tcp_Dongle_Info info_;
// IO members
boost::asio::io_service io_service_;
b_io_context io_context_;
boost::asio::ip::tcp::socket socket_;
std::vector<unsigned char> data_;
bool flip_iq_;
@ -117,7 +123,7 @@ private:
inline bool not_empty() const
{
return unread_ > 0 || io_service_.stopped();
return unread_ > 0 || io_context_.stopped();
}
};

View File

@ -93,6 +93,13 @@ target_include_directories(tracking_libs
${OPT_TRACKING_INCLUDES}
)
if(Boost_VERSION VERSION_GREATER "106500")
target_compile_definitions(tracking_libs
PUBLIC
-DBOOST_GREATER_1_65
)
endif()
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # not AppleClang
target_compile_definitions(tracking_libs

View File

@ -35,7 +35,7 @@
#include <string>
Tcp_Communication::Tcp_Communication() : tcp_socket_(io_service_) {} // NOLINT
Tcp_Communication::Tcp_Communication() : tcp_socket_(io_context_) {} // NOLINT
Tcp_Communication::~Tcp_Communication() = default;
@ -47,7 +47,7 @@ int Tcp_Communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_)
{
// Specify IP type and port
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), d_port_);
boost::asio::ip::tcp::acceptor acceptor(io_service_, endpoint);
boost::asio::ip::tcp::acceptor acceptor(io_context_, endpoint);
if (d_port_ == d_port_ch0_)
{

View File

@ -36,6 +36,12 @@
#include <boost/array.hpp>
#include <boost/asio.hpp>
#if BOOST_GREATER_1_65
using b_io_context = boost::asio::io_context;
#else
using b_io_context = boost::asio::io_service;
#endif
#define NUM_TX_VARIABLES_GALILEO_E1 13
#define NUM_TX_VARIABLES_GPS_L1_CA 9
#define NUM_RX_VARIABLES 4
@ -55,7 +61,7 @@ public:
void close_tcp_connection(size_t d_port_);
private:
boost::asio::io_service io_service_;
b_io_context io_context_;
boost::asio::ip::tcp::socket tcp_socket_;
};

View File

@ -59,6 +59,15 @@ target_include_directories(core_monitor
${PROTO_INCLUDE_HEADERS}
)
if(Boost_VERSION VERSION_GREATER "106500")
target_compile_definitions(core_monitor
PUBLIC
-DBOOST_GREATER_1_65
)
endif()
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # not AppleClang
target_compile_definitions(core_monitor

View File

@ -35,7 +35,7 @@
#include <iostream>
#include <sstream>
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf) : socket{io_service}
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf) : socket{io_context}
{
use_protobuf = enable_protobuf;
if (enable_protobuf)

View File

@ -40,6 +40,11 @@
#include <string>
#include <vector>
#if BOOST_GREATER_1_65
using b_io_context = boost::asio::io_context;
#else
using b_io_context = boost::asio::io_service;
#endif
/*!
* \brief This class sends serialized Gnss_Synchro objects
@ -52,7 +57,7 @@ public:
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
private:
boost::asio::io_service io_service;
b_io_context io_context;
boost::asio::ip::udp::socket socket;
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;

View File

@ -129,6 +129,12 @@ if(ENABLE_CUDA)
target_compile_definitions(core_receiver PRIVATE -DCUDA_GPU_ACCEL=1)
endif()
if(Boost_VERSION VERSION_GREATER "106500")
target_compile_definitions(core_receiver
PRIVATE
-DBOOST_GREATER_1_65
)
endif()
target_link_libraries(core_receiver
PUBLIC

View File

@ -39,6 +39,11 @@
#include <sstream> // for stringstream
#include <utility> // for move
#if BOOST_GREATER_1_65
using b_io_context = boost::asio::io_context;
#else
using b_io_context = boost::asio::io_service;
#endif
TcpCmdInterface::TcpCmdInterface()
{
@ -175,9 +180,11 @@ std::string TcpCmdInterface::hotstart(const std::vector<std::string> &commandLin
std::string response;
if (commandLine.size() > 5)
{
std::string tmp_str;
// Read commandline time parameter
struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr};
if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
tmp_str = commandLine.at(1) + commandLine.at(2);
if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{
response = "ERROR: time parameter malformed\n";
return response;
@ -224,7 +231,7 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
// Read commandline time parameter
struct tm tm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr};
tmp_str = commandLine.at(1) + commandLine.at(2);
if (strptime(commandLine.at(1).c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr)
{
response = "ERROR: time parameter malformed\n";
return response;
@ -235,6 +242,7 @@ std::string TcpCmdInterface::warmstart(const std::vector<std::string> &commandLi
rx_latitude_ = std::stod(commandLine.at(3).c_str());
rx_longitude_ = std::stod(commandLine.at(4).c_str());
rx_altitude_ = std::stod(commandLine.at(5).c_str());
if (std::isnan(rx_latitude_) || std::isnan(rx_longitude_) || std::isnan(rx_altitude_))
{
response = "ERROR: position malformed\n";
@ -302,10 +310,10 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
boost::system::error_code not_throw;
// Socket and acceptor
boost::asio::io_service service;
b_io_context context;
try
{
boost::asio::ip::tcp::acceptor acceptor(service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port));
boost::asio::ip::tcp::acceptor acceptor(context, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port));
while (keep_running_)
{
@ -313,7 +321,7 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
{
std::cout << "TcpCmdInterface: Telecommand TCP interface listening on port " << tcp_port << std::endl;
boost::asio::ip::tcp::socket socket(service);
boost::asio::ip::tcp::socket socket(context);
acceptor.accept(socket, not_throw);
if (not_throw)
{

View File

@ -115,6 +115,7 @@ const double AS2R = (D2R / 3600.0); //!< arc sec to radian
const double DEFAULT_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Default Earth rotation rate, [rad/s]
const double SPEED_OF_LIGHT = 299792458.0; //!< [m/s]
const double SPEED_OF_LIGHT_MS = 299792.4580; //!< [m/ms]
const double AU = 149597870691.0; //!< 1 Astronomical Unit AU (m) distance from Earth to the Sun.
#endif /* GNSS_SDR_MATH_CONSTANTS_H_ */