GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
nav_message_udp_sink.h
Go to the documentation of this file.
1 /*!
2  * \file nav_message_udp_sink.h
3  * \brief Interface of a class that sends serialized Nav_Message_Packet objects
4  * over UDP to one or multiple endpoints.
5  * \author Carles Fernandez-Prades, 2021. cfernandez(at)cttc.es
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-2021 (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_NAV_MESSAGE_UDP_SINK_H
19 #define GNSS_SDR_NAV_MESSAGE_UDP_SINK_H
20 
21 #include "nav_message_packet.h"
22 #include "serdes_nav_message.h"
23 #include <boost/asio.hpp>
24 #include <memory>
25 #include <string>
26 #include <vector>
27 
28 /** \addtogroup Core
29  * \{ */
30 /** \addtogroup Core_Receiver_Library
31  * \{ */
32 
33 #if USE_BOOST_ASIO_IO_CONTEXT
34 using b_io_context = boost::asio::io_context;
35 #else
36 using b_io_context = boost::asio::io_service;
37 #endif
38 
40 {
41 public:
42  Nav_Message_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port);
43  bool write_nav_message(const std::shared_ptr<Nav_Message_Packet>& nav_meg_packet);
44 
45 private:
46  Serdes_Nav_Message serdes_nav;
47  b_io_context io_context;
48  boost::asio::ip::udp::socket socket;
49  std::vector<boost::asio::ip::udp::endpoint> endpoints;
50  boost::system::error_code error;
51 };
52 
53 
54 /** \} */
55 /** \} */
56 #endif // GNSS_SDR_NAV_MESSAGE_UDP_SINK_H
This class implements serialization and deserialization of Nav_Message_Packet objects using Protocol ...
Serialization / Deserialization of Nav_Message_Packet objects using Protocol Buffers.