2018-07-03 11:25:43 +00:00
|
|
|
/*!
|
|
|
|
* \file gnss_synchro_udp_sink.h
|
|
|
|
* \brief Interface of a class that sends serialized Gnss_Synchro objects
|
|
|
|
* over udp to one or multiple endponits
|
|
|
|
* \author Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-07-03 11:25:43 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2018-07-03 11:25:43 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-07-03 11:25:43 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-07-03 11:25:43 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
|
|
|
|
#define GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
|
2018-07-03 11:25:43 +00:00
|
|
|
|
|
|
|
#include "gnss_synchro.h"
|
2019-04-20 09:52:00 +00:00
|
|
|
#include "serdes_gnss_synchro.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <boost/asio.hpp>
|
2019-02-09 23:52:29 +00:00
|
|
|
#include <boost/system/error_code.hpp>
|
2019-03-08 09:24:06 +00:00
|
|
|
#include <cstdint>
|
2019-02-09 23:52:29 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Core
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Gnss_Synchro_Monitor
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2020-06-12 22:32:40 +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
|
2018-07-03 11:25:43 +00:00
|
|
|
|
2019-03-08 09:24:06 +00:00
|
|
|
/*!
|
|
|
|
* \brief This class sends serialized Gnss_Synchro objects
|
|
|
|
* over UDP to one or multiple endpoints.
|
|
|
|
*/
|
2018-07-03 11:25:43 +00:00
|
|
|
class Gnss_Synchro_Udp_Sink
|
|
|
|
{
|
|
|
|
public:
|
2019-06-29 20:04:03 +00:00
|
|
|
Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool enable_protobuf);
|
2019-04-21 11:30:59 +00:00
|
|
|
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
|
2018-07-03 11:25:43 +00:00
|
|
|
|
|
|
|
private:
|
2019-05-08 14:15:59 +00:00
|
|
|
b_io_context io_context;
|
2018-07-03 11:25:43 +00:00
|
|
|
boost::asio::ip::udp::socket socket;
|
|
|
|
boost::system::error_code error;
|
|
|
|
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
2019-04-20 09:52:00 +00:00
|
|
|
Serdes_Gnss_Synchro serdes;
|
2019-04-21 11:30:59 +00:00
|
|
|
bool use_protobuf;
|
2018-07-03 11:25:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
|