mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next
This commit is contained in:
commit
50a7b8b7ab
@ -14,6 +14,7 @@ Next release will have several improvements in different dimensions, addition of
|
||||
|
||||
- Internal Finite State Machines rewritten for improved continuity in delivering position fixes. This fixes a bug that was stalling the receiver after about six hours of continuous operation.
|
||||
- Redesign of the time counter for enhanced continuity.
|
||||
- Improved flow graph in multisystem configurations: the receiver does not get stalled anymore if no signal is found from the first system.
|
||||
- Improved acquisition and tracking sensitivity.
|
||||
- Other minor bug fixes.
|
||||
|
||||
@ -21,6 +22,7 @@ Next release will have several improvements in different dimensions, addition of
|
||||
### Improvements in Efficiency:
|
||||
|
||||
- Added the possibility of non-blocking acquisition, which works well when using real-time data from an RF front-end.
|
||||
- Improved flow graph in multiband configurations: satellites acquired in one band are immediately searched in others.
|
||||
- Complex local codes have been replaced by real codes, alleviating the computational burden.
|
||||
- New volk_gnsssdr kernels: volk_gnsssdr_16i_xn_resampler_16i_xn.h, volk_gnsssdr_16ic_16i_rotator_dot_prod_16ic_xn.h, volk_gnsssdr_32f_xn_resampler_32f_xn.h, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h
|
||||
- Some AVX2 implementations added to the volk_gnsssdr library.
|
||||
|
@ -30,9 +30,9 @@
|
||||
|
||||
#include "rtklib_pvt_cc.h"
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/math/common_factor_rt.hpp>
|
||||
#include <boost/archive/xml_oarchive.hpp>
|
||||
#include <boost/archive/xml_iarchive.hpp>
|
||||
#include <boost/integer/common_factor_rt.hpp>
|
||||
#include <boost/serialization/map.hpp>
|
||||
#include <boost/exception/all.hpp>
|
||||
#include <glog/logging.h>
|
||||
@ -304,7 +304,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels,
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MT1019_rate_ms = boost::math::lcm(5000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MT1019_rate_ms = boost::integer::lcm(5000, d_output_rate_ms); // default value if not set
|
||||
}
|
||||
if (rtcm_msg_rate_ms.find(1020) != rtcm_msg_rate_ms.end())
|
||||
{
|
||||
@ -312,7 +312,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels,
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MT1020_rate_ms = boost::math::lcm(5000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MT1020_rate_ms = boost::integer::lcm(5000, d_output_rate_ms); // default value if not set
|
||||
}
|
||||
if (rtcm_msg_rate_ms.find(1045) != rtcm_msg_rate_ms.end())
|
||||
{
|
||||
@ -320,7 +320,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels,
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MT1045_rate_ms = boost::math::lcm(5000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MT1045_rate_ms = boost::integer::lcm(5000, d_output_rate_ms); // default value if not set
|
||||
}
|
||||
if (rtcm_msg_rate_ms.find(1077) != rtcm_msg_rate_ms.end()) // whatever between 1071 and 1077
|
||||
{
|
||||
@ -328,7 +328,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels,
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MT1077_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MT1077_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
}
|
||||
if (rtcm_msg_rate_ms.find(1087) != rtcm_msg_rate_ms.end()) // whatever between 1081 and 1087
|
||||
{
|
||||
@ -336,7 +336,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels,
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MT1087_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MT1087_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
}
|
||||
if (rtcm_msg_rate_ms.find(1097) != rtcm_msg_rate_ms.end()) // whatever between 1091 and 1097
|
||||
{
|
||||
@ -345,8 +345,8 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels,
|
||||
}
|
||||
else
|
||||
{
|
||||
d_rtcm_MT1097_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MSM_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MT1097_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
d_rtcm_MSM_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set
|
||||
}
|
||||
b_rtcm_writing_started = false;
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "Galileo_E1.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "GPS_L2C.h"
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <glog/logging.h>
|
||||
|
||||
|
||||
@ -338,7 +339,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int, Gnss_Synchro> gnss_observables_map, do
|
||||
}
|
||||
|
||||
// get time string Gregorian calendar
|
||||
boost::posix_time::time_duration t = boost::posix_time::seconds(utc);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>(utc * 1000.0));
|
||||
// 22 August 1999 00:00 last Galileo start GST epoch (ICD sec 5.1.2)
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
this->set_position_UTC_time(p_time);
|
||||
|
@ -8247,7 +8247,7 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(const Gps_Navigation_Me
|
||||
// if we are processing a file -> wait to leap second to resolve the ambiguity else take the week from the local system time
|
||||
//: idea resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm
|
||||
const double utc_t = nav_msg.utc_time(nav_msg.d_TOW);
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((utc_t + 604800 * static_cast<double>(nav_msg.i_GPS_week)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((utc_t + 604800 * static_cast<double>(nav_msg.i_GPS_week)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@ -8260,7 +8260,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep
|
||||
// (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf)
|
||||
// --??? No time correction here, since it will be done in the RINEX processor
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000);
|
||||
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));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@ -8273,7 +8273,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeri
|
||||
// (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf)
|
||||
// --??? No time correction here, since it will be done in the RINEX processor
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000);
|
||||
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));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@ -8285,7 +8285,7 @@ boost::posix_time::ptime Rinex_Printer::compute_Galileo_time(const Galileo_Ephem
|
||||
// (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf)
|
||||
// --??? No time correction here, since it will be done in the RINEX processor
|
||||
double galileo_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000); //
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000)); //
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_
|
||||
gtime_t rtklib_time = gpst2time(adjgpsweek(nav_data.eph[0].week), gnss_observables_map.begin()->second.RX_time);
|
||||
gtime_t rtklib_utc_time = gpst2utc(rtklib_time);
|
||||
p_time = boost::posix_time::from_time_t(rtklib_utc_time.time);
|
||||
p_time += boost::posix_time::microseconds(round(rtklib_utc_time.sec * 1e6));
|
||||
p_time += boost::posix_time::microseconds(static_cast<long>(round(rtklib_utc_time.sec * 1e6)));
|
||||
this->set_position_UTC_time(p_time);
|
||||
cart2geo(static_cast<double>(rx_position_and_time(0)), static_cast<double>(rx_position_and_time(1)), static_cast<double>(rx_position_and_time(2)), 4);
|
||||
|
||||
|
@ -422,11 +422,59 @@ void GNSSFlowgraph::connect()
|
||||
else
|
||||
{
|
||||
std::string gnss_system;
|
||||
if ((gnss_signal.compare("1C") == 0) or (gnss_signal.compare("2S") == 0) or (gnss_signal.compare("L5") == 0)) gnss_system = "GPS";
|
||||
if ((gnss_signal.compare("1B") == 0) or (gnss_signal.compare("5X") == 0)) gnss_system = "Galileo";
|
||||
if ((gnss_signal.compare("1G") == 0) or (gnss_signal.compare("2G") == 0)) gnss_system = "Glonass";
|
||||
Gnss_Signal signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GNSS_signals_.remove(signal_value);
|
||||
Gnss_Signal signal_value;
|
||||
switch (mapStringValues_[gnss_signal])
|
||||
{
|
||||
case evGPS_1C:
|
||||
gnss_system = "GPS";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GPS_1C_signals_.remove(signal_value);
|
||||
break;
|
||||
|
||||
case evGPS_2S:
|
||||
gnss_system = "GPS";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GPS_2S_signals_.remove(signal_value);
|
||||
break;
|
||||
|
||||
case evGPS_L5:
|
||||
gnss_system = "GPS";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GPS_L5_signals_.remove(signal_value);
|
||||
break;
|
||||
|
||||
case evGAL_1B:
|
||||
gnss_system = "Galileo";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GAL_1B_signals_.remove(signal_value);
|
||||
break;
|
||||
|
||||
case evGAL_5X:
|
||||
gnss_system = "Galileo";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GAL_5X_signals_.remove(signal_value);
|
||||
break;
|
||||
|
||||
case evGLO_1G:
|
||||
gnss_system = "Glonass";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GLO_1G_signals_.remove(signal_value);
|
||||
break;
|
||||
|
||||
case evGLO_2G:
|
||||
gnss_system = "Glonass";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GLO_2G_signals_.remove(signal_value);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERROR) << "This should not happen :-(";
|
||||
gnss_system = "GPS";
|
||||
signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal);
|
||||
available_GPS_1C_signals_.remove(signal_value);
|
||||
break;
|
||||
}
|
||||
|
||||
channels_.at(i)->set_signal(signal_value);
|
||||
}
|
||||
}
|
||||
@ -755,18 +803,75 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
||||
{
|
||||
LOG(WARNING) << e.what();
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(signal_list_mutex);
|
||||
switch (what)
|
||||
{
|
||||
case 0:
|
||||
DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str();
|
||||
if (sat == 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(signal_list_mutex);
|
||||
available_GNSS_signals_.push_back(channels_[who]->get_signal());
|
||||
channels_[who]->set_signal(search_next_signal(channels_[who]->get_signal().get_signal_str(), true));
|
||||
switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()])
|
||||
{
|
||||
case evGPS_1C:
|
||||
available_GPS_1C_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGPS_2S:
|
||||
available_GPS_2S_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGPS_L5:
|
||||
available_GPS_L5_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGAL_1B:
|
||||
available_GAL_1B_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGAL_5X:
|
||||
available_GAL_5X_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGLO_1G:
|
||||
available_GLO_1G_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGLO_2G:
|
||||
available_GLO_2G_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERROR) << "This should not happen :-(";
|
||||
break;
|
||||
}
|
||||
}
|
||||
channels_state_[who] = 0;
|
||||
acq_channels_count_--;
|
||||
for (unsigned int i = 0; i < channels_count_; i++)
|
||||
{
|
||||
unsigned int ch_index = (who + i + 1) % channels_count_;
|
||||
unsigned int sat_ = 0;
|
||||
try
|
||||
{
|
||||
sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
LOG(WARNING) << e.what();
|
||||
}
|
||||
if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0))
|
||||
{
|
||||
channels_state_[ch_index] = 1;
|
||||
if (sat_ == 0)
|
||||
{
|
||||
channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true));
|
||||
}
|
||||
acq_channels_count_++;
|
||||
DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str();
|
||||
channels_[ch_index]->start_acquisition();
|
||||
}
|
||||
DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index];
|
||||
}
|
||||
DLOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str();
|
||||
channels_[who]->start_acquisition();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@ -784,13 +889,12 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
||||
{
|
||||
LOG(WARNING) << e.what();
|
||||
}
|
||||
if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0))
|
||||
if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0))
|
||||
{
|
||||
channels_state_[i] = 1;
|
||||
if (sat_ == 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(signal_list_mutex);
|
||||
channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true));
|
||||
channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true, true));
|
||||
}
|
||||
acq_channels_count_++;
|
||||
DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str();
|
||||
@ -817,8 +921,40 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
||||
LOG(INFO) << "Channel " << who << " Idle state";
|
||||
if (sat == 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(signal_list_mutex);
|
||||
available_GNSS_signals_.push_back(channels_[who]->get_signal());
|
||||
switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()])
|
||||
{
|
||||
case evGPS_1C:
|
||||
available_GPS_1C_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGPS_2S:
|
||||
available_GPS_2S_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGPS_L5:
|
||||
available_GPS_L5_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGAL_1B:
|
||||
available_GAL_1B_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGAL_5X:
|
||||
available_GAL_5X_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGLO_1G:
|
||||
available_GLO_1G_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
case evGLO_2G:
|
||||
available_GLO_2G_signals_.push_back(channels_[who]->get_signal());
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERROR) << "This should not happen :-(";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -826,7 +962,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DLOG(INFO) << "Number of available signals: " << available_GNSS_signals_.size();
|
||||
applied_actions_++;
|
||||
}
|
||||
|
||||
@ -943,7 +1078,15 @@ void GNSSFlowgraph::init()
|
||||
|
||||
top_block_ = gr::make_top_block("GNSSFlowgraph");
|
||||
|
||||
// fill the available_GNSS_signals_ queue with the satellites ID's to be searched by the acquisition
|
||||
mapStringValues_["1C"] = evGPS_1C;
|
||||
mapStringValues_["2S"] = evGPS_2S;
|
||||
mapStringValues_["L5"] = evGPS_L5;
|
||||
mapStringValues_["1B"] = evGAL_1B;
|
||||
mapStringValues_["5X"] = evGAL_5X;
|
||||
mapStringValues_["1G"] = evGLO_1G;
|
||||
mapStringValues_["2G"] = evGLO_2G;
|
||||
|
||||
// fill the signals queue with the satellites ID's to be searched by the acquisition
|
||||
set_signals_list();
|
||||
set_channels_state();
|
||||
applied_actions_ = 0;
|
||||
@ -1036,14 +1179,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_1C.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create GPS L1 C/A signals
|
||||
*/
|
||||
// Loop to create GPS L1 C/A signals
|
||||
for (available_gnss_prn_iter = available_gps_prn.cbegin();
|
||||
available_gnss_prn_iter != available_gps_prn.cend();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_GPS_1C_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter),
|
||||
std::string("1C")));
|
||||
}
|
||||
@ -1051,14 +1192,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_2S.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create GPS L2C M signals
|
||||
*/
|
||||
// Loop to create GPS L2C M signals
|
||||
for (available_gnss_prn_iter = available_gps_prn.cbegin();
|
||||
available_gnss_prn_iter != available_gps_prn.cend();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_GPS_2S_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter),
|
||||
std::string("2S")));
|
||||
}
|
||||
@ -1066,14 +1205,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_L5.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create GPS L5 signals
|
||||
*/
|
||||
// Loop to create GPS L5 signals
|
||||
for (available_gnss_prn_iter = available_gps_prn.cbegin();
|
||||
available_gnss_prn_iter != available_gps_prn.cend();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_GPS_L5_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter),
|
||||
std::string("L5")));
|
||||
}
|
||||
@ -1081,14 +1218,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_SBAS.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create SBAS L1 C/A signals
|
||||
*/
|
||||
// Loop to create SBAS L1 C/A signals
|
||||
for (available_gnss_prn_iter = available_sbas_prn.cbegin();
|
||||
available_gnss_prn_iter != available_sbas_prn.cend();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_SBAS_1C_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("SBAS"), *available_gnss_prn_iter),
|
||||
std::string("1C")));
|
||||
}
|
||||
@ -1096,14 +1231,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_1B.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create the list of Galileo E1B signals
|
||||
*/
|
||||
// Loop to create the list of Galileo E1B signals
|
||||
for (available_gnss_prn_iter = available_galileo_prn.cbegin();
|
||||
available_gnss_prn_iter != available_galileo_prn.cend();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_GAL_1B_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter),
|
||||
std::string("1B")));
|
||||
}
|
||||
@ -1111,14 +1244,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_5X.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create the list of Galileo E5a signals
|
||||
*/
|
||||
// Loop to create the list of Galileo E5a signals
|
||||
for (available_gnss_prn_iter = available_galileo_prn.cbegin();
|
||||
available_gnss_prn_iter != available_galileo_prn.cend();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_GAL_5X_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter),
|
||||
std::string("5X")));
|
||||
}
|
||||
@ -1126,14 +1257,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_1G.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create the list of GLONASS L1 C/A signals
|
||||
*/
|
||||
// Loop to create the list of GLONASS L1 C/A signals
|
||||
for (available_gnss_prn_iter = available_glonass_prn.begin();
|
||||
available_gnss_prn_iter != available_glonass_prn.end();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_GLO_1G_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter),
|
||||
std::string("1G")));
|
||||
}
|
||||
@ -1141,14 +1270,12 @@ void GNSSFlowgraph::set_signals_list()
|
||||
|
||||
if (configuration_->property("Channels_2G.count", 0) > 0)
|
||||
{
|
||||
/*
|
||||
* Loop to create the list of GLONASS L2 C/A signals
|
||||
*/
|
||||
// Loop to create the list of GLONASS L2 C/A signals
|
||||
for (available_gnss_prn_iter = available_glonass_prn.begin();
|
||||
available_gnss_prn_iter != available_glonass_prn.end();
|
||||
available_gnss_prn_iter++)
|
||||
{
|
||||
available_GNSS_signals_.push_back(Gnss_Signal(
|
||||
available_GLO_2G_signals_.push_back(Gnss_Signal(
|
||||
Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter),
|
||||
std::string("2G")));
|
||||
}
|
||||
@ -1182,17 +1309,206 @@ void GNSSFlowgraph::set_channels_state()
|
||||
}
|
||||
|
||||
|
||||
Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop)
|
||||
Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop, bool tracked)
|
||||
{
|
||||
while (searched_signal.compare(available_GNSS_signals_.front().get_signal_str()) != 0)
|
||||
Gnss_Signal result;
|
||||
bool untracked_satellite = true;
|
||||
switch (mapStringValues_[searched_signal])
|
||||
{
|
||||
available_GNSS_signals_.push_back(available_GNSS_signals_.front());
|
||||
available_GNSS_signals_.pop_front();
|
||||
}
|
||||
Gnss_Signal result = available_GNSS_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GNSS_signals_.pop_front();
|
||||
case evGPS_1C:
|
||||
result = available_GPS_1C_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GPS_1C_signals_.pop_front();
|
||||
}
|
||||
if (tracked)
|
||||
{
|
||||
if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0))
|
||||
{
|
||||
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
||||
{
|
||||
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1C") != 0)) untracked_satellite = false;
|
||||
}
|
||||
if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S");
|
||||
available_GPS_2S_signals_.remove(gs);
|
||||
available_GPS_2S_signals_.push_front(gs);
|
||||
}
|
||||
if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5");
|
||||
available_GPS_L5_signals_.remove(gs);
|
||||
available_GPS_L5_signals_.push_front(gs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case evGPS_2S:
|
||||
result = available_GPS_2S_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GPS_2S_signals_.pop_front();
|
||||
}
|
||||
if (tracked)
|
||||
{
|
||||
if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0))
|
||||
{
|
||||
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
||||
{
|
||||
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2S") != 0)) untracked_satellite = false;
|
||||
}
|
||||
if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C");
|
||||
available_GPS_1C_signals_.remove(gs);
|
||||
available_GPS_1C_signals_.push_front(gs);
|
||||
}
|
||||
if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5");
|
||||
available_GPS_L5_signals_.remove(gs);
|
||||
available_GPS_L5_signals_.push_front(gs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case evGPS_L5:
|
||||
result = available_GPS_L5_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GPS_L5_signals_.pop_front();
|
||||
}
|
||||
if (tracked)
|
||||
{
|
||||
if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_2S.count", 0) > 0))
|
||||
{
|
||||
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
||||
{
|
||||
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("L5") != 0)) untracked_satellite = false;
|
||||
}
|
||||
if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C");
|
||||
available_GPS_1C_signals_.remove(gs);
|
||||
available_GPS_1C_signals_.push_front(gs);
|
||||
}
|
||||
if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S");
|
||||
available_GPS_2S_signals_.remove(gs);
|
||||
available_GPS_2S_signals_.push_front(gs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case evGAL_1B:
|
||||
result = available_GAL_1B_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GAL_1B_signals_.pop_front();
|
||||
}
|
||||
if (tracked)
|
||||
{
|
||||
if (configuration_->property("Channels_5X.count", 0) > 0)
|
||||
{
|
||||
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
||||
{
|
||||
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1B") != 0)) untracked_satellite = false;
|
||||
}
|
||||
if (untracked_satellite)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X");
|
||||
available_GAL_5X_signals_.remove(gs);
|
||||
available_GAL_5X_signals_.push_front(gs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case evGAL_5X:
|
||||
result = available_GAL_5X_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GAL_5X_signals_.pop_front();
|
||||
}
|
||||
if (tracked)
|
||||
{
|
||||
if (configuration_->property("Channels_1B.count", 0) > 0)
|
||||
{
|
||||
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
||||
{
|
||||
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("5X") != 0)) untracked_satellite = false;
|
||||
}
|
||||
if (untracked_satellite)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B");
|
||||
available_GAL_1B_signals_.remove(gs);
|
||||
available_GAL_1B_signals_.push_front(gs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case evGLO_1G:
|
||||
result = available_GLO_1G_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GLO_1G_signals_.pop_front();
|
||||
}
|
||||
if (tracked)
|
||||
{
|
||||
if (configuration_->property("Channels_2G.count", 0) > 0)
|
||||
{
|
||||
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
||||
{
|
||||
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1G") != 0)) untracked_satellite = false;
|
||||
}
|
||||
if (untracked_satellite)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G");
|
||||
available_GLO_2G_signals_.remove(gs);
|
||||
available_GLO_2G_signals_.push_front(gs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case evGLO_2G:
|
||||
result = available_GLO_2G_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GLO_2G_signals_.pop_front();
|
||||
}
|
||||
if (tracked)
|
||||
{
|
||||
if (configuration_->property("Channels_1G.count", 0) > 0)
|
||||
{
|
||||
for (unsigned int ch = 0; ch < channels_count_; ch++)
|
||||
{
|
||||
if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2G") != 0)) untracked_satellite = false;
|
||||
}
|
||||
if (untracked_satellite)
|
||||
{
|
||||
Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G");
|
||||
available_GLO_1G_signals_.remove(gs);
|
||||
available_GLO_1G_signals_.push_front(gs);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(ERROR) << "This should not happen :-(";
|
||||
result = available_GPS_1C_signals_.front();
|
||||
if (pop)
|
||||
{
|
||||
available_GPS_1C_signals_.pop_front();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <gnuradio/blocks/null_source.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
@ -133,7 +134,7 @@ private:
|
||||
void set_signals_list();
|
||||
void set_channels_state(); // Initializes the channels state (start acquisition or keep standby)
|
||||
// using the configuration parameters (number of channels and max channels in acquisition)
|
||||
Gnss_Signal search_next_signal(std::string searched_signal, bool pop);
|
||||
Gnss_Signal search_next_signal(std::string searched_signal, bool pop, bool tracked = false);
|
||||
bool connected_;
|
||||
bool running_;
|
||||
int sources_count_;
|
||||
@ -160,7 +161,28 @@ private:
|
||||
gr::blocks::throttle::sptr throttle_;
|
||||
gr::top_block_sptr top_block_;
|
||||
gr::msg_queue::sptr queue_;
|
||||
std::list<Gnss_Signal> available_GNSS_signals_;
|
||||
|
||||
std::list<Gnss_Signal> available_GPS_1C_signals_;
|
||||
std::list<Gnss_Signal> available_GPS_2S_signals_;
|
||||
std::list<Gnss_Signal> available_GPS_L5_signals_;
|
||||
std::list<Gnss_Signal> available_SBAS_1C_signals_;
|
||||
std::list<Gnss_Signal> available_GAL_1B_signals_;
|
||||
std::list<Gnss_Signal> available_GAL_5X_signals_;
|
||||
std::list<Gnss_Signal> available_GLO_1G_signals_;
|
||||
std::list<Gnss_Signal> available_GLO_2G_signals_;
|
||||
enum StringValue
|
||||
{
|
||||
evGPS_1C,
|
||||
evGPS_2S,
|
||||
evGPS_L5,
|
||||
evSBAS_1C,
|
||||
evGAL_1B,
|
||||
evGAL_5X,
|
||||
evGLO_1G,
|
||||
evGLO_2G
|
||||
};
|
||||
std::map<std::string, StringValue> mapStringValues_;
|
||||
|
||||
std::vector<unsigned int> channels_state_;
|
||||
std::mutex signal_list_mutex;
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ Rtcm::Rtcm(unsigned short port)
|
||||
reserved_field = std::bitset<6>("000000");
|
||||
rtcm_message_queue = std::make_shared<concurrent_queue<std::string> >();
|
||||
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), RTCM_port);
|
||||
servers.emplace_back(io_service, endpoint);
|
||||
servers.emplace_back(io_context, endpoint);
|
||||
server_is_running = false;
|
||||
}
|
||||
|
||||
@ -85,13 +85,13 @@ Rtcm::~Rtcm()
|
||||
// *****************************************************************************************************
|
||||
void Rtcm::run_server()
|
||||
{
|
||||
std::cout << "Starting a TCP Server on port " << RTCM_port << std::endl;
|
||||
std::cout << "Starting a TCP/IP server of RTCM messages on port " << RTCM_port << std::endl;
|
||||
try
|
||||
{
|
||||
std::thread tq([&] { std::make_shared<Queue_Reader>(io_service, rtcm_message_queue, RTCM_port)->do_read_queue(); });
|
||||
std::thread tq([&] { std::make_shared<Queue_Reader>(io_context, rtcm_message_queue, RTCM_port)->do_read_queue(); });
|
||||
tq.detach();
|
||||
|
||||
std::thread t([&] { io_service.run(); });
|
||||
std::thread t([&] { io_context.run(); });
|
||||
server_is_running = true;
|
||||
t.detach();
|
||||
}
|
||||
@ -104,13 +104,13 @@ void Rtcm::run_server()
|
||||
|
||||
void Rtcm::stop_service()
|
||||
{
|
||||
io_service.stop();
|
||||
io_context.stop();
|
||||
}
|
||||
|
||||
|
||||
void Rtcm::stop_server()
|
||||
{
|
||||
std::cout << "Stopping TCP Server on port " << RTCM_port << std::endl;
|
||||
std::cout << "Stopping TCP/IP server on port " << RTCM_port << std::endl;
|
||||
rtcm_message_queue->push("Goodbye"); // this terminates tq
|
||||
Rtcm::stop_service();
|
||||
servers.front().close_server();
|
||||
@ -3313,7 +3313,7 @@ std::map<std::string, int> Rtcm::galileo_signal_map = [] {
|
||||
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000);
|
||||
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));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@ -3322,7 +3322,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
|
||||
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000);
|
||||
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));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@ -3331,7 +3331,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d
|
||||
boost::posix_time::ptime Rtcm::compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const
|
||||
{
|
||||
double galileo_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
return p_time;
|
||||
}
|
||||
@ -4058,7 +4058,7 @@ int Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro)
|
||||
int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
std::string now_ptime = to_iso_string(p_time);
|
||||
std::string today_ptime = now_ptime.substr(0, 8);
|
||||
@ -4072,7 +4072,7 @@ int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
|
||||
int Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time)
|
||||
{
|
||||
const double gps_t = obs_time;
|
||||
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000);
|
||||
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week % 1024)) * 1000));
|
||||
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||
std::string now_ptime = to_iso_string(p_time);
|
||||
std::string hours = now_ptime.substr(9, 2);
|
||||
|
@ -677,10 +677,10 @@ private:
|
||||
{
|
||||
if (first == true)
|
||||
{
|
||||
std::cout << "Client from " << socket_.remote_endpoint().address() << " says ";
|
||||
LOG(INFO) << "Client says:";
|
||||
first = false;
|
||||
}
|
||||
std::cout << client_says.substr(0, 80) << std::endl;
|
||||
LOG(INFO) << client_says;
|
||||
client_says = client_says.substr(80, client_says.length() - 80);
|
||||
}
|
||||
do_read_message_header();
|
||||
@ -749,21 +749,21 @@ private:
|
||||
: public std::enable_shared_from_this<Tcp_Internal_Client>
|
||||
{
|
||||
public:
|
||||
Tcp_Internal_Client(boost::asio::io_service& io_service,
|
||||
Tcp_Internal_Client(boost::asio::io_service& io_context,
|
||||
boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
|
||||
: io_service_(io_service), socket_(io_service)
|
||||
: io_context_(io_context), socket_(io_context)
|
||||
{
|
||||
do_connect(endpoint_iterator);
|
||||
}
|
||||
|
||||
inline void close()
|
||||
{
|
||||
io_service_.post([this]() { socket_.close(); });
|
||||
io_context_.post([this]() { socket_.close(); });
|
||||
}
|
||||
|
||||
inline void write(const Rtcm_Message& msg)
|
||||
{
|
||||
io_service_.post(
|
||||
io_context_.post(
|
||||
[this, msg]() {
|
||||
bool write_in_progress = !write_msgs_.empty();
|
||||
write_msgs_.push_back(msg);
|
||||
@ -827,7 +827,7 @@ private:
|
||||
});
|
||||
}
|
||||
|
||||
boost::asio::io_service& io_service_;
|
||||
boost::asio::io_service& io_context_;
|
||||
boost::asio::ip::tcp::socket socket_;
|
||||
Rtcm_Message read_msg_;
|
||||
std::deque<Rtcm_Message> write_msgs_;
|
||||
@ -837,13 +837,13 @@ private:
|
||||
class Queue_Reader
|
||||
{
|
||||
public:
|
||||
Queue_Reader(boost::asio::io_service& io_service, std::shared_ptr<concurrent_queue<std::string> >& queue, int port) : queue_(queue)
|
||||
Queue_Reader(boost::asio::io_service& io_context, std::shared_ptr<concurrent_queue<std::string> >& queue, int port) : queue_(queue)
|
||||
{
|
||||
boost::asio::ip::tcp::resolver resolver(io_service);
|
||||
boost::asio::ip::tcp::resolver resolver(io_context);
|
||||
std::string host("localhost");
|
||||
std::string port_str = std::to_string(port);
|
||||
auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()});
|
||||
c = std::make_shared<Tcp_Internal_Client>(io_service, queue_endpoint_iterator);
|
||||
c = std::make_shared<Tcp_Internal_Client>(io_context, queue_endpoint_iterator);
|
||||
}
|
||||
|
||||
inline void do_read_queue()
|
||||
@ -871,8 +871,8 @@ private:
|
||||
class Tcp_Server
|
||||
{
|
||||
public:
|
||||
Tcp_Server(boost::asio::io_service& io_service, const boost::asio::ip::tcp::endpoint& endpoint)
|
||||
: acceptor_(io_service), socket_(io_service)
|
||||
Tcp_Server(boost::asio::io_service& io_context, const boost::asio::ip::tcp::endpoint& endpoint)
|
||||
: acceptor_(io_context), socket_(io_context)
|
||||
{
|
||||
acceptor_.open(endpoint.protocol());
|
||||
acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
||||
@ -895,21 +895,35 @@ private:
|
||||
{
|
||||
if (first_client)
|
||||
{
|
||||
std::cout << "The TCP Server is up and running. Accepting connections ..." << std::endl;
|
||||
std::cout << "The TCP/IP server of RTCM messages is up and running. Accepting connections ..." << std::endl;
|
||||
first_client = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Starting RTCM TCP server session..." << std::endl;
|
||||
std::cout << "Serving client from " << socket_.remote_endpoint().address() << std::endl;
|
||||
LOG(INFO) << "Serving client from " << socket_.remote_endpoint().address();
|
||||
std::cout << "Starting RTCM TCP/IP server session..." << std::endl;
|
||||
boost::system::error_code ec2;
|
||||
boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2);
|
||||
if (ec2)
|
||||
{
|
||||
// Error creating remote_endpoint
|
||||
std::cout << "Error getting remote IP address, closing session." << std::endl;
|
||||
LOG(INFO) << "Error getting remote IP address";
|
||||
start_session = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string remote_addr = endpoint.address().to_string();
|
||||
std::cout << "Serving client from " << remote_addr << std::endl;
|
||||
LOG(INFO) << "Serving client from " << remote_addr;
|
||||
}
|
||||
}
|
||||
std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
|
||||
if (start_session) std::make_shared<Rtcm_Session>(std::move(socket_), room_)->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Error when invoking a RTCM session. " << ec << std::endl;
|
||||
}
|
||||
start_session = true;
|
||||
do_accept();
|
||||
});
|
||||
}
|
||||
@ -918,9 +932,10 @@ private:
|
||||
boost::asio::ip::tcp::socket socket_;
|
||||
Rtcm_Listener_Room room_;
|
||||
bool first_client = true;
|
||||
bool start_session = true;
|
||||
};
|
||||
|
||||
boost::asio::io_service io_service;
|
||||
boost::asio::io_service io_context;
|
||||
std::shared_ptr<concurrent_queue<std::string> > rtcm_message_queue;
|
||||
std::thread t;
|
||||
std::thread tq;
|
||||
|
Loading…
Reference in New Issue
Block a user