GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
tcp_communication.h
Go to the documentation of this file.
1 /*!
2  * \file tcp_communication.h
3  * \brief Interface of the TCP communication class
4  * \author David Pubill, 2011. dpubill(at)cttc.es
5  *
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_TCP_COMMUNICATION_H
19 #define GNSS_SDR_TCP_COMMUNICATION_H
20 
21 #include "tcp_packet_data.h"
22 #include <boost/array.hpp>
23 #include <boost/asio.hpp>
24 
25 /** \addtogroup Tracking
26  * \{ */
27 /** \addtogroup Tracking_libs
28  * \{ */
29 
30 
31 #if USE_BOOST_ASIO_IO_CONTEXT
32 using b_io_context = boost::asio::io_context;
33 #else
34 using b_io_context = boost::asio::io_service;
35 #endif
36 
37 #define NUM_TX_VARIABLES_GALILEO_E1 13
38 #define NUM_TX_VARIABLES_GPS_L1_CA 9
39 #define NUM_RX_VARIABLES 4
40 
41 /*!
42  * \brief TCP communication class
43  */
45 {
46 public:
48  ~Tcp_Communication() = default;
49 
50  int listen_tcp_connection(size_t d_port_, size_t d_port_ch0_);
51  void send_receive_tcp_packet_galileo_e1(boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> buf, Tcp_Packet_Data *tcp_data_);
52  void send_receive_tcp_packet_gps_l1_ca(boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> buf, Tcp_Packet_Data *tcp_data_);
53  void close_tcp_connection(size_t d_port_);
54 
55 private:
56  b_io_context io_context_;
57  boost::asio::ip::tcp::socket tcp_socket_;
58 };
59 
60 
61 /** \} */
62 /** \} */
63 #endif
Interface of the TCP data packet class.
TCP communication class.
Class that implements a TCP data packet.