diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index bdd1f97c6..bfdf6c4b8 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -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) { diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 5f33ecaed..bae417cbb 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -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(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled); + std::string port_string = conf_.udp_ports; + std::vector 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(udp_addr_vec, udp_port_vec, conf_.protobuf_enabled); } else { diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index 9caef6f4d..e284bf4b2 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -17,19 +17,24 @@ #include "monitor_pvt_udp_sink.h" #include +#include #include #include -Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addresses, - const uint16_t& port, +Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink( + const std::vector& addresses, + const std::vector& 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 (port)); endpoints.push_back(endpoint); + } } if (use_protobuf) diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index 1fbe3219d..bfe1c00e5 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -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& addresses, const uint16_t& port, bool protobuf_enabled); + Monitor_Pvt_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, + bool protobuf_enabled); bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt); private: diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index 37d9b5aac..b38cfe788 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -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; diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index 98526fe60..0b74b7b8c 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -26,29 +26,28 @@ gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& 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& udp_ports, const std::vector& udp_addresses, bool enable_protobuf) : gr::block("gnss_synchro_monitor", - gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), - gr::io_signature::make(0, 0, 0)), - count(0), - d_nchannels(n_channels), - d_decimation_factor(decimation_factor) + gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), + gr::io_signature::make(0, 0, 0)), + count(0), + d_nchannels(n_channels), + d_decimation_factor(decimation_factor) { udp_sink_ptr = std::make_unique(udp_addresses, udp_port, enable_protobuf); } diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h index 64749a001..4edd012e1 100644 --- a/src/core/monitor/gnss_synchro_monitor.h +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -41,7 +41,7 @@ using gnss_synchro_monitor_sptr = gnss_shared_ptr; gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& 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& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); gnss_synchro_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc index 336f834cb..67f76a431 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.cc +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -18,11 +18,13 @@ #include "gnss_synchro_udp_sink.h" #include #include +#include #include #include -Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector& addresses, - const uint16_t& port, +Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, bool enable_protobuf) : socket{io_context}, use_protobuf(enable_protobuf) @@ -33,8 +35,13 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector& add } for (const auto& address : addresses) { - boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port); - endpoints.push_back(endpoint); + for (const auto& port : ports) + { + boost::asio::ip::udp::endpoint endpoint( + boost::asio::ip::address::from_string(address, error), + boost::lexical_cast (port)); + endpoints.push_back(endpoint); + } } } diff --git a/src/core/monitor/gnss_synchro_udp_sink.h b/src/core/monitor/gnss_synchro_udp_sink.h index cf777cc12..699a6043f 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.h +++ b/src/core/monitor/gnss_synchro_udp_sink.h @@ -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& addresses, const uint16_t& port, bool enable_protobuf); + Gnss_Synchro_Udp_Sink(const std::vector& addresses, const std::vector& ports, bool enable_protobuf); bool write_gnss_synchro(const std::vector& stocks); private: diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index c7cbb9f07..599dadab3 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -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 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 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 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); } /*