2012-03-16 10:55:58 +00:00
|
|
|
/*!
|
|
|
|
* \file tcp_communication.h
|
2012-03-24 02:53:00 +00:00
|
|
|
* \brief Interface of the TCP communication class
|
2012-03-16 10:55:58 +00:00
|
|
|
* \author David Pubill, 2011. dpubill(at)cttc.es
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2012-03-16 10:55:58 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2012-03-16 10:55:58 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2012-03-16 10:55:58 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2012-03-16 10:55:58 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_TCP_COMMUNICATION_H
|
|
|
|
#define GNSS_SDR_TCP_COMMUNICATION_H
|
2012-03-16 10:55:58 +00:00
|
|
|
|
|
|
|
#include "tcp_packet_data.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <boost/array.hpp>
|
|
|
|
#include <boost/asio.hpp>
|
2012-03-16 10:55:58 +00:00
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Tracking
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Tracking_libs
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
2020-06-12 22:32:40 +00:00
|
|
|
#if USE_BOOST_ASIO_IO_CONTEXT
|
2019-05-08 14:15:59 +00:00
|
|
|
using b_io_context = boost::asio::io_context;
|
|
|
|
#else
|
|
|
|
using b_io_context = boost::asio::io_service;
|
|
|
|
#endif
|
|
|
|
|
2012-10-19 13:38:25 +00:00
|
|
|
#define NUM_TX_VARIABLES_GALILEO_E1 13
|
|
|
|
#define NUM_TX_VARIABLES_GPS_L1_CA 9
|
|
|
|
#define NUM_RX_VARIABLES 4
|
2012-03-24 02:53:00 +00:00
|
|
|
|
2013-01-28 23:50:09 +00:00
|
|
|
/*!
|
|
|
|
* \brief TCP communication class
|
|
|
|
*/
|
2019-02-22 09:47:24 +00:00
|
|
|
class Tcp_Communication
|
2012-03-16 10:55:58 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-02-22 09:47:24 +00:00
|
|
|
Tcp_Communication();
|
2019-07-21 17:32:52 +00:00
|
|
|
~Tcp_Communication() = default;
|
2012-03-16 10:55:58 +00:00
|
|
|
|
2013-01-28 23:50:09 +00:00
|
|
|
int listen_tcp_connection(size_t d_port_, size_t d_port_ch0_);
|
2019-02-22 09:47:24 +00:00
|
|
|
void send_receive_tcp_packet_galileo_e1(boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> buf, Tcp_Packet_Data *tcp_data_);
|
|
|
|
void send_receive_tcp_packet_gps_l1_ca(boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> buf, Tcp_Packet_Data *tcp_data_);
|
2013-01-28 23:50:09 +00:00
|
|
|
void close_tcp_connection(size_t d_port_);
|
2012-03-16 10:55:58 +00:00
|
|
|
|
|
|
|
private:
|
2019-05-08 14:15:59 +00:00
|
|
|
b_io_context io_context_;
|
2012-03-24 02:53:00 +00:00
|
|
|
boost::asio::ip::tcp::socket tcp_socket_;
|
2012-03-16 10:55:58 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2012-03-16 10:55:58 +00:00
|
|
|
#endif
|