GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
two_bit_packed_file_signal_source.h
Go to the documentation of this file.
1/*!
2 * \file two_bit_packed_file_signal_source.h
3 * \brief Interface of a class that reads signals samples from a file. Each
4 * sample is two bits, which are packed into bytes or shorts.
5 *
6 * \author Cillian O'Driscoll, 2015 cillian.odriscoll (at) gmail.com
7 *
8 * This class represents a file signal source.
9 *
10 * -----------------------------------------------------------------------------
11 *
12 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
13 * This file is part of GNSS-SDR.
14 *
15 * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
16 * SPDX-License-Identifier: GPL-3.0-or-later
17 *
18 * -----------------------------------------------------------------------------
19 */
20
21#ifndef GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
22#define GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
23
24#include "file_source_base.h"
25#include "unpack_2bit_samples.h"
26#include <gnuradio/blocks/interleaved_char_to_complex.h>
27#include <cstddef>
28#include <string>
29#include <tuple>
30
31
32/** \addtogroup Signal_Source
33 * \{ */
34/** \addtogroup Signal_Source_adapters
35 * \{ */
36
37
39
40/*!
41 * \brief Class that reads signals samples from a file
42 * and adapts it to a SignalSourceInterface
43 */
44class TwoBitPackedFileSignalSource : public FileSourceBase
45{
46public:
47 TwoBitPackedFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
48 unsigned int in_streams, unsigned int out_streams,
50
51 ~TwoBitPackedFileSignalSource() = default;
52
53private:
54 inline bool big_endian_items() const
55 {
56 return big_endian_items_;
57 }
58
59 inline bool big_endian_bytes() const
60 {
61 return big_endian_bytes_;
62 }
63
64
65 inline bool reverse_interleaving() const
66 {
67 return reverse_interleaving_;
68 }
69
70protected:
71 std::tuple<size_t, bool> itemTypeToSize() override;
72 double packetsPerSample() const override;
73 gnss_shared_ptr<gr::block> source() const override;
74 void create_file_source_hook() override;
75 void pre_connect_hook(gr::top_block_sptr top_block) override;
76 void pre_disconnect_hook(gr::top_block_sptr top_block) override;
77
78private:
79 std::string sample_type_;
80 bool big_endian_items_;
81 bool big_endian_bytes_;
82 bool reverse_interleaving_;
83 unpack_2bit_samples_sptr unpack_samples_;
84 gnss_shared_ptr<gr::block> char_to_float_;
85};
86
87
88/** \} */
89/** \} */
90#endif // GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
This class implements a thread-safe std::queue.
This abstract class represents an interface to configuration parameters.
FileSourceBase(ConfigurationInterface const *configuration, std::string const &role, std::string impl, Concurrent_Queue< pmt::pmt_t > *queue, std::string default_item_type="short")
Constructor.
gnss_shared_ptr< gr::block > source() const override
Abstracted front-end source. Sub-classes may override if they create specialized chains to decode sou...
double packetsPerSample() const override
The number of (possibly unpacked) samples in a (raw) file sample (default=1).
std::tuple< size_t, bool > itemTypeToSize() override
Compute the item size, from the item_type(). Subclasses may constrain types that don't make.
Header file of the base class to file-oriented signal_source GNSS blocks.
Unpacks 2 bit samples samples may be packed in any of the following ways: 1) Into bytes [ item == byt...