GNSS-SDR  0.0.13
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  * 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_TCP_COMMUNICATION_H
22 #define GNSS_SDR_TCP_COMMUNICATION_H
23 
24 #include "tcp_packet_data.h"
25 #include <boost/array.hpp>
26 #include <boost/asio.hpp>
27 
28 #if USE_BOOST_ASIO_IO_CONTEXT
29 using b_io_context = boost::asio::io_context;
30 #else
31 using b_io_context = boost::asio::io_service;
32 #endif
33 
34 #define NUM_TX_VARIABLES_GALILEO_E1 13
35 #define NUM_TX_VARIABLES_GPS_L1_CA 9
36 #define NUM_RX_VARIABLES 4
37 
38 /*!
39  * \brief TCP communication class
40  */
42 {
43 public:
45  ~Tcp_Communication() = default;
46 
47  int listen_tcp_connection(size_t d_port_, size_t d_port_ch0_);
48  void send_receive_tcp_packet_galileo_e1(boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> buf, Tcp_Packet_Data *tcp_data_);
49  void send_receive_tcp_packet_gps_l1_ca(boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> buf, Tcp_Packet_Data *tcp_data_);
50  void close_tcp_connection(size_t d_port_);
51 
52 private:
53  b_io_context io_context_;
54  boost::asio::ip::tcp::socket tcp_socket_;
55 };
56 
57 #endif
Interface of the TCP data packet class.
TCP communication class.
Class that implements a TCP data packet.