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
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2012-08-01 13:11:02 +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-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"
|
2018-02-26 02:15:53 +00:00
|
|
|
#include "gnss_block_interface.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>
|
2020-04-02 22:41:51 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
#else
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#endif
|
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
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
class OsmosdrSignalSource : public GNSSBlockInterface
|
2012-08-01 13:11:02 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-05-02 21:46:30 +00:00
|
|
|
OsmosdrSignalSource(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 std::string role() override
|
2012-08-01 13:11:02 +00:00
|
|
|
{
|
|
|
|
return role_;
|
|
|
|
}
|
2013-02-04 00:16:22 +00:00
|
|
|
|
|
|
|
/*!
|
2014-12-15 16:39:22 +00:00
|
|
|
* \brief Returns "Osmosdr_Signal_Source"
|
2013-02-04 00:16:22 +00:00
|
|
|
*/
|
2017-08-21 09:45:12 +00:00
|
|
|
inline std::string implementation() override
|
2012-08-01 13:11:02 +00:00
|
|
|
{
|
2014-12-15 16:39:22 +00:00
|
|
|
return "Osmosdr_Signal_Source";
|
2012-08-01 13:11:02 +00:00
|
|
|
}
|
2017-08-15 22:58:10 +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_;
|
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
std::shared_ptr<gr::block> valve_;
|
|
|
|
#else
|
|
|
|
boost::shared_ptr<gr::block> valve_;
|
|
|
|
#endif
|
|
|
|
gr::blocks::file_sink::sptr file_sink_;
|
|
|
|
|
2012-08-01 13:11:02 +00:00
|
|
|
std::string role_;
|
2020-06-24 20:27:51 +00:00
|
|
|
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-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
|