2015-10-08 11:08:43 +00:00
|
|
|
/*!
|
|
|
|
* \file two_bit_packed_file_signal_source.h
|
|
|
|
* \brief Interface of a class that reads signals samples from a file. Each
|
|
|
|
* sample is two bits, which are packed into bytes or shorts.
|
|
|
|
*
|
|
|
|
* \author Cillian O'Driscoll, 2015 cillian.odriscoll (at) gmail.com
|
|
|
|
*
|
|
|
|
* This class represents a file signal source.
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2019-07-26 10:38:20 +00:00
|
|
|
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
2015-10-08 11:08:43 +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
|
2015-10-08 11:08:43 +00:00
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#ifndef GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
|
|
|
|
#define GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
|
2015-10-08 11:08:43 +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"
|
|
|
|
#include "unpack_2bit_samples.h"
|
2015-10-08 11:08:43 +00:00
|
|
|
#include <gnuradio/blocks/file_sink.h>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <gnuradio/blocks/file_source.h>
|
|
|
|
#include <gnuradio/blocks/interleaved_char_to_complex.h>
|
2015-10-08 11:08:43 +00:00
|
|
|
#include <gnuradio/blocks/throttle.h>
|
|
|
|
#include <gnuradio/hier_block2.h>
|
2019-07-16 15:41:12 +00:00
|
|
|
#include <pmt/pmt.h>
|
2018-12-02 11:11:59 +00:00
|
|
|
#include <cstdint>
|
2019-08-17 11:56:54 +00:00
|
|
|
#include <memory>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <string>
|
2020-04-02 21:59:35 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
#else
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#endif
|
2015-10-08 11:08:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ConfigurationInterface;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Class that reads signals samples from a file
|
|
|
|
* and adapts it to a SignalSourceInterface
|
|
|
|
*/
|
2018-03-03 01:03:39 +00:00
|
|
|
class TwoBitPackedFileSignalSource : public GNSSBlockInterface
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
public:
|
2020-06-29 07:07:41 +00:00
|
|
|
TwoBitPackedFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
|
2018-03-03 01:03:39 +00:00
|
|
|
unsigned int in_streams, unsigned int out_streams,
|
2020-06-18 09:49:28 +00:00
|
|
|
Concurrent_Queue<pmt::pmt_t>* queue);
|
2015-10-08 11:08:43 +00:00
|
|
|
|
2019-07-21 17:32:52 +00:00
|
|
|
~TwoBitPackedFileSignalSource() = default;
|
2017-08-21 09:45:12 +00:00
|
|
|
inline std::string role() override
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return role_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Returns "Two_Bit_Packed_File_Signal_Source".
|
|
|
|
*/
|
2017-08-21 09:45:12 +00:00
|
|
|
inline std::string implementation() override
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return "Two_Bit_Packed_File_Signal_Source";
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline size_t item_size() override
|
2015-10-08 11:08:43 +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;
|
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline std::string filename() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return filename_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline std::string item_type() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return item_type_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline bool repeat() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return repeat_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2018-12-02 11:11:59 +00:00
|
|
|
inline int64_t sampling_frequency() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return sampling_frequency_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2018-12-02 11:11:59 +00:00
|
|
|
inline uint64_t samples() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return samples_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline bool big_endian_items() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return big_endian_items_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline bool big_endian_bytes() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return big_endian_bytes_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline bool is_complex() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return is_complex_;
|
|
|
|
}
|
2017-08-15 22:58:10 +00:00
|
|
|
|
2017-08-21 09:45:12 +00:00
|
|
|
inline bool reverse_interleaving() const
|
2015-10-08 11:08:43 +00:00
|
|
|
{
|
|
|
|
return reverse_interleaving_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
gr::blocks::file_source::sptr file_source_;
|
|
|
|
unpack_2bit_samples_sptr unpack_samples_;
|
|
|
|
gr::basic_block_sptr char_to_float_;
|
2020-04-02 21:59:35 +00:00
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
2020-04-02 11:23:20 +00:00
|
|
|
std::shared_ptr<gr::block> valve_;
|
2020-04-02 21:59:35 +00:00
|
|
|
#else
|
|
|
|
boost::shared_ptr<gr::block> valve_;
|
|
|
|
#endif
|
2015-10-08 11:08:43 +00:00
|
|
|
gr::blocks::file_sink::sptr sink_;
|
2018-03-03 01:03:39 +00:00
|
|
|
gr::blocks::throttle::sptr throttle_;
|
2020-06-26 20:07:41 +00:00
|
|
|
std::string filename_;
|
|
|
|
std::string item_type_;
|
|
|
|
std::string dump_filename_;
|
|
|
|
std::string role_;
|
|
|
|
std::string sample_type_;
|
|
|
|
uint64_t samples_;
|
|
|
|
int64_t sampling_frequency_;
|
2015-10-08 11:08:43 +00:00
|
|
|
size_t item_size_;
|
2020-06-26 20:07:41 +00:00
|
|
|
unsigned int in_streams_;
|
|
|
|
unsigned int out_streams_;
|
2015-10-08 11:08:43 +00:00
|
|
|
bool big_endian_items_;
|
|
|
|
bool big_endian_bytes_;
|
|
|
|
bool is_complex_;
|
|
|
|
bool reverse_interleaving_;
|
2020-06-26 20:07:41 +00:00
|
|
|
bool repeat_;
|
|
|
|
bool dump_;
|
2015-10-08 11:08:43 +00:00
|
|
|
// Throttle control
|
|
|
|
bool enable_throttle_control_;
|
|
|
|
};
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
#endif // GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
|