GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
rtl_tcp_dongle_info.h
Go to the documentation of this file.
1 /*!
2  * \file rtl_tcp_dongle_info.h
3  * \brief Interface for a structure sent by rtl_tcp defining the hardware.
4  * \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
5  *
6  * This file contains information taken from librtlsdr:
7  * https://git.osmocom.org/rtl-sdr
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 #ifndef GNSS_SDR_RTL_TCP_DONGLE_INFO_H
20 #define GNSS_SDR_RTL_TCP_DONGLE_INFO_H
21 
22 #include <boost/asio/ip/tcp.hpp>
23 
24 
25 /** \addtogroup Signal_Source
26  * \{ */
27 /** \addtogroup Signal_Source_libs
28  * \{ */
29 
30 
31 /*!
32  * \brief This class represents the dongle information
33  * which is sent by rtl_tcp.
34  */
36 {
37 public:
38  enum
39  {
40  TUNER_UNKNOWN = 0,
41  TUNER_E4000,
42  TUNER_FC0012,
43  TUNER_FC0013,
44  TUNER_FC2580,
45  TUNER_R820T,
46  TUNER_R828D
47  };
48 
50 
51  boost::system::error_code read(boost::asio::ip::tcp::socket &socket);
52 
53  bool is_valid() const;
54 
55  const char *get_type_name() const;
56 
57  double clip_gain(int gain) const;
58 
59  inline uint32_t get_tuner_type() const
60  {
61  return tuner_type_;
62  }
63 
64  inline uint32_t get_tuner_gain_count() const
65  {
66  return tuner_gain_count_;
67  }
68 
69 private:
70  char magic_[4]{};
71  uint32_t tuner_type_;
72  uint32_t tuner_gain_count_;
73 };
74 
75 
76 /** \} */
77 /** \} */
78 #endif // GNSS_SDR_RTL_TCP_DONGLE_INFO_H
This class represents the dongle information which is sent by rtl_tcp.