gnss-sdr/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h

54 lines
1.5 KiB
C
Raw Normal View History

2019-01-21 10:59:29 +00:00
/*!
* \file monitor_pvt_udp_sink.h
* \brief Interface of a class that sends serialized Monitor_Pvt objects
* over udp to one or multiple endpoints
* \author Álvaro Cebrián Juan, 2019. acebrianjuan(at)gmail.com
*
2020-07-28 14:57:15 +00:00
* -----------------------------------------------------------------------------
2019-01-21 10:59:29 +00:00
*
2020-07-28 14:57:15 +00:00
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
2019-01-21 10:59:29 +00:00
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* SPDX-License-Identifier: GPL-3.0-or-later
2019-01-21 10:59:29 +00:00
*
2020-07-28 14:57:15 +00:00
* -----------------------------------------------------------------------------
2019-01-21 10:59:29 +00:00
*/
#ifndef GNSS_SDR_MONITOR_PVT_UDP_SINK_H
#define GNSS_SDR_MONITOR_PVT_UDP_SINK_H
2019-01-21 10:59:29 +00:00
#include "monitor_pvt.h"
#include "serdes_monitor_pvt.h"
2019-01-21 10:59:29 +00:00
#include <boost/asio.hpp>
#include <memory>
#include <string>
#include <vector>
2019-01-21 10:59:29 +00:00
#if USE_BOOST_ASIO_IO_CONTEXT
2019-05-08 14:15:59 +00:00
using b_io_context = boost::asio::io_context;
#else
using b_io_context = boost::asio::io_service;
#endif
2019-01-21 10:59:29 +00:00
class Monitor_Pvt_Udp_Sink
{
public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
2020-07-26 21:56:36 +00:00
bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt);
2019-01-21 10:59:29 +00:00
private:
2020-06-24 09:34:14 +00:00
Serdes_Monitor_Pvt serdes;
2019-05-08 14:15:59 +00:00
b_io_context io_context;
2019-01-21 10:59:29 +00:00
boost::asio::ip::udp::socket socket;
std::vector<boost::asio::ip::udp::endpoint> endpoints;
2020-06-24 09:34:14 +00:00
boost::system::error_code error;
bool use_protobuf;
2019-01-21 10:59:29 +00:00
};
#endif // GNSS_SDR_MONITOR_PVT_UDP_SINK_H