mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-05-01 11:11:24 +00:00
Expose usage of Protocol Buffers to the configuration
This commit is contained in:
@@ -741,6 +741,11 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* 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.protobuf_enabled = configuration->property(role + ".enable_protobuf", true);
|
||||
if (configuration->property("Monitor.enable_protobuf", false) == true)
|
||||
{
|
||||
pvt_output_parameters.protobuf_enabled = true;
|
||||
}
|
||||
|
||||
// Show time in local zone
|
||||
pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false);
|
||||
|
||||
@@ -347,7 +347,7 @@ 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());
|
||||
|
||||
udp_sink_ptr = std::unique_ptr<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port));
|
||||
udp_sink_ptr = std::unique_ptr<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <sstream>
|
||||
|
||||
|
||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port) : 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_service}
|
||||
{
|
||||
for (const auto& address : addresses)
|
||||
{
|
||||
@@ -71,14 +71,18 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, c
|
||||
monitor_pvt.hdop = 0.0;
|
||||
monitor_pvt.vdop = 0.0;
|
||||
|
||||
serdes = Serdes_Monitor_Pvt();
|
||||
use_protobuf = protobuf_enabled;
|
||||
if (use_protobuf)
|
||||
{
|
||||
serdes = Serdes_Monitor_Pvt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt, bool protobuf)
|
||||
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt)
|
||||
{
|
||||
std::string outbound_data;
|
||||
if (protobuf == false)
|
||||
if (use_protobuf == false)
|
||||
{
|
||||
std::ostringstream archive_stream;
|
||||
boost::archive::binary_oarchive oa{archive_stream};
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
class Monitor_Pvt_Udp_Sink
|
||||
{
|
||||
public:
|
||||
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port);
|
||||
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt, bool protobuf = false);
|
||||
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port, bool protobuf_enabled);
|
||||
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt);
|
||||
|
||||
private:
|
||||
boost::asio::io_service io_service;
|
||||
@@ -49,6 +49,7 @@ private:
|
||||
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
||||
Monitor_Pvt monitor_pvt;
|
||||
Serdes_Monitor_Pvt serdes;
|
||||
bool use_protobuf;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ Pvt_Conf::Pvt_Conf()
|
||||
rtcm_output_file_path = std::string(".");
|
||||
|
||||
monitor_enabled = false;
|
||||
protobuf_enabled = true;
|
||||
udp_port = 0;
|
||||
|
||||
show_local_time_zone = false;
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
std::string rtcm_output_file_path;
|
||||
|
||||
bool monitor_enabled;
|
||||
bool protobuf_enabled;
|
||||
std::string udp_addresses;
|
||||
int udp_port;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user