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
|
// Read PVT MONITOR Configuration
|
||||||
pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false);
|
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_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);
|
pvt_output_parameters.protobuf_enabled = configuration->property(role + ".enable_protobuf", true);
|
||||||
if (configuration->property("Monitor.enable_protobuf", false) == 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());
|
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());
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -17,19 +17,24 @@
|
|||||||
|
|
||||||
#include "monitor_pvt_udp_sink.h"
|
#include "monitor_pvt_udp_sink.h"
|
||||||
#include <boost/archive/binary_oarchive.hpp>
|
#include <boost/archive/binary_oarchive.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses,
|
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(
|
||||||
const uint16_t& port,
|
const std::vector<std::string>& addresses,
|
||||||
|
const std::vector<std::string>& ports,
|
||||||
bool protobuf_enabled) : socket{io_context},
|
bool protobuf_enabled) : socket{io_context},
|
||||||
use_protobuf(protobuf_enabled)
|
use_protobuf(protobuf_enabled)
|
||||||
{
|
{
|
||||||
for (const auto& address : addresses)
|
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);
|
endpoints.push_back(endpoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_protobuf)
|
if (use_protobuf)
|
||||||
|
@ -40,7 +40,10 @@ using b_io_context = boost::asio::io_service;
|
|||||||
class Monitor_Pvt_Udp_Sink
|
class Monitor_Pvt_Udp_Sink
|
||||||
{
|
{
|
||||||
public:
|
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);
|
bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
std::string rtcm_output_file_path = std::string(".");
|
std::string rtcm_output_file_path = std::string(".");
|
||||||
std::string has_output_file_path = std::string(".");
|
std::string has_output_file_path = std::string(".");
|
||||||
std::string udp_addresses;
|
std::string udp_addresses;
|
||||||
|
std::string udp_ports;
|
||||||
std::string udp_eph_addresses;
|
std::string udp_eph_addresses;
|
||||||
std::string log_source_timetag_file;
|
std::string log_source_timetag_file;
|
||||||
|
|
||||||
@ -64,7 +65,6 @@ public:
|
|||||||
int32_t rinexobs_rate_ms = 0;
|
int32_t rinexobs_rate_ms = 0;
|
||||||
int32_t an_rate_ms = 20;
|
int32_t an_rate_ms = 20;
|
||||||
int32_t max_obs_block_rx_clock_offset_ms = 40;
|
int32_t max_obs_block_rx_clock_offset_ms = 40;
|
||||||
int udp_port = 0;
|
|
||||||
int udp_eph_port = 0;
|
int udp_eph_port = 0;
|
||||||
int rtk_trace_level = 0;
|
int rtk_trace_level = 0;
|
||||||
|
|
||||||
|
@ -26,29 +26,28 @@
|
|||||||
|
|
||||||
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
const std::vector<std::string>& udp_ports,
|
||||||
const std::vector<std::string>& udp_addresses,
|
const std::vector<std::string>& udp_addresses,
|
||||||
bool enable_protobuf)
|
bool enable_protobuf)
|
||||||
{
|
{
|
||||||
return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels,
|
return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels,
|
||||||
decimation_factor,
|
decimation_factor,
|
||||||
udp_port,
|
udp_ports,
|
||||||
udp_addresses,
|
udp_addresses,
|
||||||
enable_protobuf));
|
enable_protobuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gnss_synchro_monitor::gnss_synchro_monitor(int n_channels,
|
gnss_synchro_monitor::gnss_synchro_monitor(int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
const std::vector<std::string>& udp_ports,
|
||||||
const std::vector<std::string>& udp_addresses,
|
const std::vector<std::string>& udp_addresses,
|
||||||
bool enable_protobuf)
|
bool enable_protobuf)
|
||||||
: gr::block("gnss_synchro_monitor",
|
: gr::block("gnss_synchro_monitor",
|
||||||
gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
|
gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
|
||||||
gr::io_signature::make(0, 0, 0)),
|
gr::io_signature::make(0, 0, 0)),
|
||||||
count(0),
|
count(0),
|
||||||
d_nchannels(n_channels),
|
d_nchannels(n_channels),
|
||||||
d_decimation_factor(decimation_factor)
|
d_decimation_factor(decimation_factor)
|
||||||
{
|
{
|
||||||
udp_sink_ptr = std::make_unique<Gnss_Synchro_Udp_Sink>(udp_addresses, udp_port, enable_protobuf);
|
udp_sink_ptr = std::make_unique<Gnss_Synchro_Udp_Sink>(udp_addresses, udp_port, enable_protobuf);
|
||||||
}
|
}
|
||||||
|
@ -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,
|
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
const std::vector<std::string>& udp_ports,
|
||||||
const std::vector<std::string>& udp_addresses,
|
const std::vector<std::string>& udp_addresses,
|
||||||
bool enable_protobuf);
|
bool enable_protobuf);
|
||||||
|
|
||||||
@ -61,13 +61,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
const std::vector<std::string>& udp_ports,
|
||||||
const std::vector<std::string>& udp_addresses,
|
const std::vector<std::string>& udp_addresses,
|
||||||
bool enable_protobuf);
|
bool enable_protobuf);
|
||||||
|
|
||||||
gnss_synchro_monitor(int n_channels,
|
gnss_synchro_monitor(int n_channels,
|
||||||
int decimation_factor,
|
int decimation_factor,
|
||||||
int udp_port,
|
const std::vector<std::string>& udp_ports,
|
||||||
const std::vector<std::string>& udp_addresses,
|
const std::vector<std::string>& udp_addresses,
|
||||||
bool enable_protobuf);
|
bool enable_protobuf);
|
||||||
|
|
||||||
|
@ -18,11 +18,13 @@
|
|||||||
#include "gnss_synchro_udp_sink.h"
|
#include "gnss_synchro_udp_sink.h"
|
||||||
#include <boost/archive/binary_oarchive.hpp>
|
#include <boost/archive/binary_oarchive.hpp>
|
||||||
#include <boost/serialization/vector.hpp>
|
#include <boost/serialization/vector.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses,
|
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(
|
||||||
const uint16_t& port,
|
const std::vector<std::string>& addresses,
|
||||||
|
const std::vector<std::string>& ports,
|
||||||
bool enable_protobuf)
|
bool enable_protobuf)
|
||||||
: socket{io_context},
|
: socket{io_context},
|
||||||
use_protobuf(enable_protobuf)
|
use_protobuf(enable_protobuf)
|
||||||
@ -33,8 +35,13 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector<std::string>& add
|
|||||||
}
|
}
|
||||||
for (const auto& address : addresses)
|
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)
|
||||||
endpoints.push_back(endpoint);
|
{
|
||||||
|
boost::asio::ip::udp::endpoint endpoint(
|
||||||
|
boost::asio::ip::address::from_string(address, error),
|
||||||
|
boost::lexical_cast<int> (port));
|
||||||
|
endpoints.push_back(endpoint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ using b_io_context = boost::asio::io_service;
|
|||||||
class Gnss_Synchro_Udp_Sink
|
class Gnss_Synchro_Udp_Sink
|
||||||
{
|
{
|
||||||
public:
|
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);
|
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -217,11 +217,17 @@ void GNSSFlowgraph::init()
|
|||||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
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());
|
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
|
// Instantiate monitor object
|
||||||
GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||||
configuration_->property("Monitor.decimation_factor", 1),
|
configuration_->property("Monitor.decimation_factor", 1),
|
||||||
configuration_->property("Monitor.udp_port", 1234),
|
udp_port_vec,
|
||||||
udp_addr_vec, enable_protobuf);
|
udp_addr_vec,
|
||||||
|
enable_protobuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -241,10 +247,16 @@ void GNSSFlowgraph::init()
|
|||||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
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());
|
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_,
|
GnssSynchroAcquisitionMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||||
configuration_->property("AcquisitionMonitor.decimation_factor", 1),
|
configuration_->property("AcquisitionMonitor.decimation_factor", 1),
|
||||||
configuration_->property("AcquisitionMonitor.udp_port", 1235),
|
udp_port_vec,
|
||||||
udp_addr_vec, enable_protobuf);
|
udp_addr_vec,
|
||||||
|
enable_protobuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -264,10 +276,16 @@ void GNSSFlowgraph::init()
|
|||||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
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());
|
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_,
|
GnssSynchroTrackingMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||||
configuration_->property("TrackingMonitor.decimation_factor", 1),
|
configuration_->property("TrackingMonitor.decimation_factor", 1),
|
||||||
configuration_->property("TrackingMonitor.udp_port", 1236),
|
udp_port_vec,
|
||||||
udp_addr_vec, enable_protobuf);
|
udp_addr_vec,
|
||||||
|
enable_protobuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user