mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-11-10 20:10:05 +00:00
Adapted udp_port to multiple ports
This commit is contained in:
parent
b981f8065e
commit
94ab8a7006
@ -887,7 +887,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration,
|
||||
// Read PVT MONITOR Configuration
|
||||
pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false);
|
||||
pvt_output_parameters.udp_addresses = configuration->property(role + ".monitor_client_addresses", std::string("127.0.0.1"));
|
||||
pvt_output_parameters.udp_port = configuration->property(role + ".monitor_udp_port", 1234);
|
||||
pvt_output_parameters.udp_ports = configuration->property(role + ".monitor_udp_port", std::string("1234"));
|
||||
pvt_output_parameters.protobuf_enabled = configuration->property(role + ".enable_protobuf", true);
|
||||
if (configuration->property("Monitor.enable_protobuf", false) == true)
|
||||
{
|
||||
|
@ -467,7 +467,12 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
|
||||
|
||||
d_udp_sink_ptr = std::make_unique<Monitor_Pvt_Udp_Sink>(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled);
|
||||
std::string port_string = conf_.udp_ports;
|
||||
std::vector<std::string> udp_port_vec = split_string(port_string, '_');
|
||||
std::sort(udp_port_vec.begin(), udp_port_vec.end());
|
||||
udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end());
|
||||
|
||||
d_udp_sink_ptr = std::make_unique<Monitor_Pvt_Udp_Sink>(udp_addr_vec, udp_port_vec, conf_.protobuf_enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -17,20 +17,25 @@
|
||||
|
||||
#include "monitor_pvt_udp_sink.h"
|
||||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses,
|
||||
const uint16_t& port,
|
||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(
|
||||
const std::vector<std::string>& addresses,
|
||||
const std::vector<std::string>& ports,
|
||||
bool protobuf_enabled) : socket{io_context},
|
||||
use_protobuf(protobuf_enabled)
|
||||
{
|
||||
for (const auto& address : addresses)
|
||||
{
|
||||
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
|
||||
for (const auto& port : ports)
|
||||
{
|
||||
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), boost::lexical_cast<int> (port));
|
||||
endpoints.push_back(endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
if (use_protobuf)
|
||||
{
|
||||
|
@ -40,7 +40,10 @@ using b_io_context = boost::asio::io_service;
|
||||
class Monitor_Pvt_Udp_Sink
|
||||
{
|
||||
public:
|
||||
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
|
||||
Monitor_Pvt_Udp_Sink(
|
||||
const std::vector<std::string>& addresses,
|
||||
const std::vector<std::string>& ports,
|
||||
bool protobuf_enabled);
|
||||
bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt);
|
||||
|
||||
private:
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
std::string rtcm_output_file_path = std::string(".");
|
||||
std::string has_output_file_path = std::string(".");
|
||||
std::string udp_addresses;
|
||||
std::string udp_ports;
|
||||
std::string udp_eph_addresses;
|
||||
std::string log_source_timetag_file;
|
||||
|
||||
@ -64,7 +65,6 @@ public:
|
||||
int32_t rinexobs_rate_ms = 0;
|
||||
int32_t an_rate_ms = 20;
|
||||
int32_t max_obs_block_rx_clock_offset_ms = 40;
|
||||
int udp_port = 0;
|
||||
int udp_eph_port = 0;
|
||||
int rtk_trace_level = 0;
|
||||
|
||||
|
@ -26,21 +26,20 @@
|
||||
|
||||
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_ports,
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf)
|
||||
{
|
||||
return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels,
|
||||
decimation_factor,
|
||||
udp_port,
|
||||
udp_ports,
|
||||
udp_addresses,
|
||||
enable_protobuf));
|
||||
}
|
||||
|
||||
|
||||
gnss_synchro_monitor::gnss_synchro_monitor(int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_ports,
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf)
|
||||
: gr::block("gnss_synchro_monitor",
|
||||
|
@ -41,7 +41,7 @@ using gnss_synchro_monitor_sptr = gnss_shared_ptr<gnss_synchro_monitor>;
|
||||
|
||||
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_ports,
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf);
|
||||
|
||||
@ -61,13 +61,13 @@ public:
|
||||
private:
|
||||
friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_ports,
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf);
|
||||
|
||||
gnss_synchro_monitor(int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_ports,
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf);
|
||||
|
||||
|
@ -18,11 +18,13 @@
|
||||
#include "gnss_synchro_udp_sink.h"
|
||||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses,
|
||||
const uint16_t& port,
|
||||
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(
|
||||
const std::vector<std::string>& addresses,
|
||||
const std::vector<std::string>& ports,
|
||||
bool enable_protobuf)
|
||||
: socket{io_context},
|
||||
use_protobuf(enable_protobuf)
|
||||
@ -33,10 +35,15 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector<std::string>& add
|
||||
}
|
||||
for (const auto& address : addresses)
|
||||
{
|
||||
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
|
||||
for (const auto& port : ports)
|
||||
{
|
||||
boost::asio::ip::udp::endpoint endpoint(
|
||||
boost::asio::ip::address::from_string(address, error),
|
||||
boost::lexical_cast<int> (port));
|
||||
endpoints.push_back(endpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks)
|
||||
|
@ -45,7 +45,7 @@ using b_io_context = boost::asio::io_service;
|
||||
class Gnss_Synchro_Udp_Sink
|
||||
{
|
||||
public:
|
||||
Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool enable_protobuf);
|
||||
Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const std::vector<std::string>& ports, bool enable_protobuf);
|
||||
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
|
||||
|
||||
private:
|
||||
|
@ -217,11 +217,17 @@ void GNSSFlowgraph::init()
|
||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
|
||||
|
||||
std::string udp_port_string = configuration_->property("Monitor.udp_port", std::string("1234"));
|
||||
std::vector<std::string> udp_port_vec = split_string(udp_port_string, '_');
|
||||
std::sort(udp_port_vec.begin(), udp_port_vec.end());
|
||||
udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end());
|
||||
|
||||
// Instantiate monitor object
|
||||
GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||
configuration_->property("Monitor.decimation_factor", 1),
|
||||
configuration_->property("Monitor.udp_port", 1234),
|
||||
udp_addr_vec, enable_protobuf);
|
||||
udp_port_vec,
|
||||
udp_addr_vec,
|
||||
enable_protobuf);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -241,10 +247,16 @@ void GNSSFlowgraph::init()
|
||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
|
||||
|
||||
std::string udp_port_string = configuration_->property("AcquisitionMonitor.udp_port", std::string("1235"));
|
||||
std::vector<std::string> udp_port_vec = split_string(udp_port_string, '_');
|
||||
std::sort(udp_port_vec.begin(), udp_port_vec.end());
|
||||
udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end());
|
||||
|
||||
GnssSynchroAcquisitionMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||
configuration_->property("AcquisitionMonitor.decimation_factor", 1),
|
||||
configuration_->property("AcquisitionMonitor.udp_port", 1235),
|
||||
udp_addr_vec, enable_protobuf);
|
||||
udp_port_vec,
|
||||
udp_addr_vec,
|
||||
enable_protobuf);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -264,10 +276,16 @@ void GNSSFlowgraph::init()
|
||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
|
||||
|
||||
std::string udp_port_string = configuration_->property("TrackingMonitor.udp_port", std::string("1236"));
|
||||
std::vector<std::string> udp_port_vec = split_string(udp_port_string, '_');
|
||||
std::sort(udp_port_vec.begin(), udp_port_vec.end());
|
||||
udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end());
|
||||
|
||||
GnssSynchroTrackingMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||
configuration_->property("TrackingMonitor.decimation_factor", 1),
|
||||
configuration_->property("TrackingMonitor.udp_port", 1236),
|
||||
udp_addr_vec, enable_protobuf);
|
||||
udp_port_vec,
|
||||
udp_addr_vec,
|
||||
enable_protobuf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user