GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
gnss_synchro_udp_sink.h
Go to the documentation of this file.
1 /*!
2  * \file gnss_synchro_udp_sink.h
3  * \brief Interface of a class that sends serialized Gnss_Synchro objects
4  * over udp to one or multiple endponits
5  * \author Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
19 #define GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
20 
21 #include "gnss_synchro.h"
22 #include "serdes_gnss_synchro.h"
23 #include <boost/asio.hpp>
24 #include <boost/system/error_code.hpp>
25 #include <cstdint>
26 #include <string>
27 #include <vector>
28 
29 /** \addtogroup Core
30  * \{ */
31 /** \addtogroup Gnss_Synchro_Monitor
32  * \{ */
33 
34 
35 #if USE_BOOST_ASIO_IO_CONTEXT
36 using b_io_context = boost::asio::io_context;
37 #else
38 using b_io_context = boost::asio::io_service;
39 #endif
40 
41 /*!
42  * \brief This class sends serialized Gnss_Synchro objects
43  * over UDP to one or multiple endpoints.
44  */
46 {
47 public:
48  Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool enable_protobuf);
49  bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
50 
51 private:
52  b_io_context io_context;
53  boost::asio::ip::udp::socket socket;
54  boost::system::error_code error;
55  std::vector<boost::asio::ip::udp::endpoint> endpoints;
56  Serdes_Gnss_Synchro serdes;
57  bool use_protobuf;
58 };
59 
60 
61 /** \} */
62 /** \} */
63 #endif // GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
This class sends serialized Gnss_Synchro objects over UDP to one or multiple endpoints.
Serialization / Deserialization of Gnss_Synchro objects using Protocol Buffers.
This class implements serialization and deserialization of Gnss_Synchro objects using Protocol Buffer...
Interface of the Gnss_Synchro class.