2012-08-01 13:11:02 +00:00
|
|
|
/*!
|
2014-12-15 16:39:22 +00:00
|
|
|
* \file osmosdr_signal_source.h
|
|
|
|
* \brief Signal source wrapper for OsmoSDR-compatible front-ends, such as
|
|
|
|
* HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
|
2020-02-05 20:24:46 +00:00
|
|
|
* (see https://osmocom.org/projects/rtl-sdr/wiki for more information)
|
2012-08-01 13:11:02 +00:00
|
|
|
* \author Javier Arribas, 2012. jarribas(at)cttc.es
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2012-08-01 13:11:02 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2012-08-01 13:11:02 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2012-08-01 13:11:02 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2012-08-01 13:11:02 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
|
|
|
|
#define GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
|
2012-08-01 13:11:02 +00:00
|
|
|
|
2019-07-16 15:41:12 +00:00
|
|
|
#include "concurrent_queue.h"
|
2021-02-15 22:34:48 +00:00
|
|
|
#include "signal_source_base.h"
|
2013-07-04 13:47:40 +00:00
|
|
|
#include <gnuradio/blocks/file_sink.h>
|
2019-07-16 15:41:12 +00:00
|
|
|
#include <pmt/pmt.h>
|
2018-12-11 00:56:25 +00:00
|
|
|
#include <cstdint>
|
2019-08-17 11:56:54 +00:00
|
|
|
#include <memory>
|
2014-01-12 20:07:38 +00:00
|
|
|
#include <osmosdr/source.h>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <stdexcept>
|
|
|
|
#include <string>
|
2012-08-01 13:11:02 +00:00
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
/** \addtogroup Signal_Source
|
|
|
|
* \{ */
|
|
|
|
/** \addtogroup Signal_Source_adapters
|
|
|
|
* \{ */
|
|
|
|
|
2020-11-03 19:51:57 +00:00
|
|
|
|
2012-08-01 13:11:02 +00:00
|
|
|
class ConfigurationInterface;
|
|
|
|
|
|
|
|
/*!
|
2014-12-15 16:39:22 +00:00
|
|
|
* \brief This class reads samples OsmoSDR-compatible front-ends, such as
|
|
|
|
* HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
|
2020-02-05 20:24:46 +00:00
|
|
|
* (see https://osmocom.org/projects/rtl-sdr/wiki)
|
2012-08-01 13:11:02 +00:00
|
|
|
*/
|
2021-02-09 22:47:34 +00:00
|
|
|
class OsmosdrSignalSource : public SignalSourceBase
|
2012-08-01 13:11:02 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-06-29 07:07:41 +00:00
|
|
|
OsmosdrSignalSource(const ConfigurationInterface* configuration,
|
2018-12-10 21:59:10 +00:00
|
|
|
const std::string& role, unsigned int in_stream,
|
2020-06-18 09:49:28 +00:00
|
|
|
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
|
2012-08-01 13:11:02 +00:00
|
|
|
|
2019-07-21 17:32:52 +00:00
|
|
|
~OsmosdrSignalSource() = default;
|
2012-08-01 13:11:02 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline size_t item_size() override
|
2012-08-01 13:11:02 +00:00
|
|
|
{
|
|
|
|
return item_size_;
|
|
|
|
}
|
|
|
|
|
2017-08-15 22:58:10 +00:00
|
|
|
void connect(gr::top_block_sptr top_block) override;
|
|
|
|
void disconnect(gr::top_block_sptr top_block) override;
|
|
|
|
gr::basic_block_sptr get_left_block() override;
|
|
|
|
gr::basic_block_sptr get_right_block() override;
|
2012-08-01 13:11:02 +00:00
|
|
|
|
|
|
|
private:
|
2017-08-25 17:17:12 +00:00
|
|
|
void driver_instance();
|
2020-06-24 20:27:51 +00:00
|
|
|
|
|
|
|
osmosdr::source::sptr osmosdr_source_;
|
2020-11-03 19:51:57 +00:00
|
|
|
gnss_shared_ptr<gr::block> valve_;
|
2020-06-24 20:27:51 +00:00
|
|
|
gr::blocks::file_sink::sptr file_sink_;
|
|
|
|
|
|
|
|
std::string item_type_;
|
|
|
|
std::string dump_filename_;
|
|
|
|
std::string osmosdr_args_;
|
|
|
|
std::string antenna_;
|
2012-08-01 13:11:02 +00:00
|
|
|
|
2016-02-02 22:32:48 +00:00
|
|
|
// Front-end settings
|
2012-08-01 13:11:02 +00:00
|
|
|
double sample_rate_;
|
|
|
|
double freq_;
|
|
|
|
double gain_;
|
2013-07-05 17:00:48 +00:00
|
|
|
double if_gain_;
|
|
|
|
double rf_gain_;
|
2012-08-01 13:11:02 +00:00
|
|
|
|
|
|
|
size_t item_size_;
|
2018-12-11 00:56:25 +00:00
|
|
|
int64_t samples_;
|
2012-08-01 13:11:02 +00:00
|
|
|
|
2020-06-24 20:27:51 +00:00
|
|
|
unsigned int in_stream_;
|
|
|
|
unsigned int out_stream_;
|
2012-08-01 13:11:02 +00:00
|
|
|
|
2020-06-24 20:27:51 +00:00
|
|
|
bool AGC_enabled_;
|
|
|
|
bool dump_;
|
2012-08-01 13:11:02 +00:00
|
|
|
};
|
|
|
|
|
2020-11-01 12:37:19 +00:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
|