GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
labsat23_source.h
Go to the documentation of this file.
1 /*!
2  * \file labsat23_source.h
3  *
4  * \brief Unpacks capture files in the LabSat 2 (ls2), LabSat 3 (ls3), or LabSat
5  * 3 Wideband (LS3W) formats.
6  * \author Javier Arribas jarribas (at) cttc.es
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 #ifndef GNSS_SDR_LABSAT23_SOURCE_H
20 #define GNSS_SDR_LABSAT23_SOURCE_H
21 
22 #include "concurrent_queue.h"
23 #include "gnss_block_interface.h"
24 #include <gnuradio/block.h>
25 #include <pmt/pmt.h>
26 #include <cstddef>
27 #include <cstdint>
28 #include <fstream>
29 #include <string>
30 #include <vector>
31 
32 /** \addtogroup Signal_Source
33  * \{ */
34 /** \addtogroup Signal_Source_gnuradio_blocks
35  * \{ */
36 
37 
38 class labsat23_source;
39 
40 using labsat23_source_sptr = gnss_shared_ptr<labsat23_source>;
41 
42 labsat23_source_sptr labsat23_make_source_sptr(
43  const char *signal_file_basename,
44  const std::vector<int> &channel_selector,
46  bool digital_io_enabled);
47 
48 /*!
49  * \brief This class implements conversion between Labsat 2, 3 and 3 Wideband
50  * formats to gr_complex
51  */
52 class labsat23_source : public gr::block
53 {
54 public:
55  ~labsat23_source();
56 
57  int general_work(int noutput_items,
58  gr_vector_int &ninput_items,
59  gr_vector_const_void_star &input_items,
60  gr_vector_void_star &output_items);
61 
62 private:
63  friend labsat23_source_sptr labsat23_make_source_sptr(
64  const char *signal_file_basename,
65  const std::vector<int> &channel_selector,
67  bool digital_io_enabled);
68 
69  labsat23_source(const char *signal_file_basename,
70  const std::vector<int> &channel_selector,
72  bool digital_io_enabled);
73 
74  std::string generate_filename();
75 
76  int parse_header();
77  int getBit(uint8_t byte, int position);
78  int read_ls3w_ini(const std::string &filename);
79  int number_of_samples_per_ls3w_register() const;
80 
81  void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
82  void decode_ls3w_register(uint64_t input, std::vector<gr_complex *> &out, std::size_t output_pointer) const;
83 
84  std::ifstream binary_input_file;
85  std::string d_signal_file_basename;
87  std::vector<int> d_channel_selector_config;
88  int d_current_file_number;
89  uint8_t d_labsat_version;
90  uint8_t d_channel_selector;
91  uint8_t d_ref_clock;
92  uint8_t d_bits_per_sample;
93  bool d_header_parsed;
94 
95  // Data members for Labsat 3 Wideband
96  std::string d_ls3w_OSC;
97  std::vector<int> d_ls3w_selected_channel_offset;
98  int64_t d_ls3w_SMP{};
99  int32_t d_ls3w_QUA{};
100  int32_t d_ls3w_CHN{};
101  int32_t d_ls3w_SFT{};
102  int32_t d_ls3w_CFA{};
103  int32_t d_ls3w_CFB{};
104  int32_t d_ls3w_CFC{};
105  int32_t d_ls3w_BWA{};
106  int32_t d_ls3w_BWB{};
107  int32_t d_ls3w_BWC{};
108  int d_ls3w_spare_bits{};
109  int d_ls3w_samples_per_register{};
110  bool d_is_ls3w = false;
111  bool d_ls3w_digital_io_enabled = false;
112 };
113 
114 
115 /** \} */
116 /** \} */
117 #endif // GNSS_SDR_LABSAT23_SOURCE_H
Interface of a thread-safe std::queue.
This interface represents a GNSS block.
This class implements conversion between Labsat 2, 3 and 3 Wideband formats to gr_complex.