GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
uhd_signal_source.h
Go to the documentation of this file.
1/*!
2 * \file uhd_signal_source.h
3 * \brief Interface for the Universal Hardware Driver signal source
4 * \author Javier Arribas, 2012. jarribas(at)cttc.es
5 *
6 * -----------------------------------------------------------------------------
7 *
8 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9 * This file is part of GNSS-SDR.
10 *
11 * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12 * SPDX-License-Identifier: GPL-3.0-or-later
13 *
14 * -----------------------------------------------------------------------------
15 */
16
17#ifndef GNSS_SDR_UHD_SIGNAL_SOURCE_H
18#define GNSS_SDR_UHD_SIGNAL_SOURCE_H
19
20#include "concurrent_queue.h"
21#include "signal_source_base.h"
22#include <gnuradio/blocks/file_sink.h>
23#include <gnuradio/hier_block2.h>
24#include <gnuradio/uhd/usrp_source.h>
25#include <pmt/pmt.h>
26#include <cstdint>
27#include <string>
28#include <vector>
29
30
31/** \addtogroup Signal_Source
32 * \{ */
33/** \addtogroup Signal_Source_adapters
34 * \{ */
35
37
38/*!
39 * \brief This class reads samples from a UHD device (see http://code.ettus.com/redmine/ettus/projects/uhd/wiki)
40 */
41class UhdSignalSource : public SignalSourceBase
42{
43public:
44 UhdSignalSource(const ConfigurationInterface* configuration,
45 const std::string& role, unsigned int in_stream,
46 unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
47
48 ~UhdSignalSource() = default;
49
50 inline size_t item_size() override
51 {
52 return item_size_;
53 }
54
55 void connect(gr::top_block_sptr top_block) override;
56 void disconnect(gr::top_block_sptr top_block) override;
57 gr::basic_block_sptr get_left_block() override;
58 gr::basic_block_sptr get_right_block() override;
59 gr::basic_block_sptr get_right_block(int RF_channel) override;
60
61private:
62 gr::uhd::usrp_source::sptr uhd_source_;
63
64 std::vector<gnss_shared_ptr<gr::block>> valve_;
65 std::vector<gr::blocks::file_sink::sptr> file_sink_;
66 std::vector<double> freq_;
67 std::vector<double> gain_;
68 std::vector<double> IF_bandwidth_hz_;
69 std::vector<uint64_t> samples_;
70 std::vector<std::string> dump_filename_;
71 std::vector<bool> dump_;
72
73 uhd::stream_args_t uhd_stream_args_; // UHD SETTINGS
74
75 std::string device_address_;
76 std::string item_type_;
77 std::string subdevice_;
78 std::string clock_source_;
79
80 // * The OTW format is a string that describes the format over-the-wire.
81 // * The following over-the-wire formats have been implemented:
82 // * - sc16 - Q16 I16
83 // * - sc8 - Q8_1 I8_1 Q8_0 I8_0
84 // * - sc12 (Only some devices)
85 std::string otw_format_;
86
87 double sample_rate_;
88 size_t item_size_;
89 int RF_channels_;
90 unsigned int in_stream_;
91 unsigned int out_stream_;
92};
93
94
95/** \} */
96/** \} */
97#endif // GNSS_SDR_UHD_SIGNAL_SOURCE_H
This class implements a thread-safe std::queue.
This abstract class represents an interface to configuration parameters.
SignalSourceBase(ConfigurationInterface const *configuration, std::string role, std::string impl)
Constructor.
Interface of a thread-safe std::queue.
Header file of the base class to signal_source GNSS blocks.