GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
10  *
11  * GNSS-SDR is a software defined Global Navigation
12  * Satellite Systems receiver
13  *
14  * This file is part of GNSS-SDR.
15  *
16  * SPDX-License-Identifier: GPL-3.0-or-later
17  *
18  * -----------------------------------------------------------------------------
19  */
20 
21 #ifndef GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
22 #define GNSS_SDR_GNSS_SYNCHRO_UDP_SINK_H
23 
24 #include "gnss_synchro.h"
25 #include "serdes_gnss_synchro.h"
26 #include <boost/asio.hpp>
27 #include <boost/system/error_code.hpp>
28 #include <cstdint>
29 #include <string>
30 #include <vector>
31 
32 #if USE_BOOST_ASIO_IO_CONTEXT
33 using b_io_context = boost::asio::io_context;
34 #else
35 using b_io_context = boost::asio::io_service;
36 #endif
37 
38 /*!
39  * \brief This class sends serialized Gnss_Synchro objects
40  * over UDP to one or multiple endpoints.
41  */
43 {
44 public:
45  Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool enable_protobuf);
46  bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
47 
48 private:
49  b_io_context io_context;
50  boost::asio::ip::udp::socket socket;
51  boost::system::error_code error;
52  std::vector<boost::asio::ip::udp::endpoint> endpoints;
53  Serdes_Gnss_Synchro serdes;
54  bool use_protobuf;
55 };
56 
57 
58 #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.