GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
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), LabSat 3
5 * Wideband (LS3W), and Labsat 4 (ls4) formats.
6 * \author Javier Arribas jarribas (at) cttc.es
7 * Mathieu Favreau favreau.mathieu (at) hotmail.com
8 *
9 * -----------------------------------------------------------------------------
10 *
11 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12 * This file is part of GNSS-SDR.
13 *
14 * Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors)
15 * SPDX-License-Identifier: GPL-3.0-or-later
16 *
17 * -----------------------------------------------------------------------------
18 */
19
20#ifndef GNSS_SDR_LABSAT23_SOURCE_H
21#define GNSS_SDR_LABSAT23_SOURCE_H
22
23#include "concurrent_queue.h"
25#include <gnuradio/block.h>
26#include <pmt/pmt.h>
27#include <cstddef>
28#include <cstdint>
29#include <fstream>
30#include <map>
31#include <string>
32#include <utility>
33#include <vector>
34
35/** \addtogroup Signal_Source
36 * \{ */
37/** \addtogroup Signal_Source_gnuradio_blocks
38 * \{ */
39
40
41class labsat23_source;
42
43using labsat23_source_sptr = gnss_shared_ptr<labsat23_source>;
44
45labsat23_source_sptr labsat23_make_source_sptr(
46 const char *signal_file_basename,
47 const std::vector<int> &channel_selector,
49 bool digital_io_enabled,
50 double seconds_to_skip);
51
52/*!
53 * \brief This class implements conversion between Labsat 2, 3 and 3 Wideband
54 * formats to gr_complex
55 */
56class labsat23_source : public gr::block
57{
58public:
59 ~labsat23_source();
60
61 int general_work(int noutput_items,
62 gr_vector_int &ninput_items,
63 gr_vector_const_void_star &input_items,
64 gr_vector_void_star &output_items);
65
66private:
67 friend labsat23_source_sptr labsat23_make_source_sptr(
68 const char *signal_file_basename,
69 const std::vector<int> &channel_selector,
71 bool digital_io_enabled,
72 double seconds_to_skip);
73
74 labsat23_source(const char *signal_file_basename,
75 const std::vector<int> &channel_selector,
77 bool digital_io_enabled,
78 double seconds_to_skip);
79
80 std::string generate_filename();
81
82 int parse_header();
83 int read_ls3w_ini(const std::string &filename);
84 int number_of_samples_per_ls3w_register() const;
85
86 void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
87 void decode_ls3w_register(uint64_t input, std::vector<gr_complex *> &out, std::size_t output_pointer) const;
88 int parse_ls23_data(int noutput_items, std::vector<gr_complex *> out);
89 int parse_ls3w_data(int noutput_items, std::vector<gr_complex *> out);
90 int parse_ls4_data(int noutput_items, std::vector<gr_complex *> out);
91 bool read_ls4_data();
92
93 std::ifstream binary_input_file;
94 std::string d_signal_file_basename;
96 std::vector<int> d_channel_selector_config;
97 int d_current_file_number;
98 uint8_t d_labsat_version;
99 uint8_t d_channel_selector;
100 uint8_t d_ref_clock;
101 uint8_t d_bits_per_sample;
102 bool d_header_parsed;
103
104 // Data members for Labsat 3 Wideband
105 std::string d_ls3w_OSC;
106 std::vector<int> d_ls3w_selected_channel_offset;
107 int64_t d_ls3w_SMP{};
108 int32_t d_ls3w_QUA{};
109 int32_t d_ls3w_CHN{};
110 int32_t d_ls3w_SFT{};
111 int d_ls3w_spare_bits{};
112 int d_ls3w_samples_per_register{};
113 bool d_is_ls3w = false;
114 bool d_is_ls4 = false;
115 bool d_ls3w_digital_io_enabled = false;
116
117 // Data members for Labsat 4
118 int32_t d_ls4_BW_MAX{0};
119 int32_t d_number_sample_per_output{0};
120 int32_t d_number_register_per_output{0};
121 uint64_t d_read_index{0};
122
123 struct ChannelState
124 {
125 std::string identifier;
126 int32_t center_freq{0};
127 int32_t bandwidth{0};
128 int32_t bw_div{0};
129 int32_t buff_size{0};
130 int32_t number_sample_per_output{0};
131 uint64_t data_index{0};
132 std::vector<uint64_t> data{};
133
134 ChannelState(const std::string &id) : identifier(id) {}
135 };
136
137 std::map<int32_t, ChannelState> d_channel_map{
138 std::make_pair(1, ChannelState{"A"}), std::make_pair(2, ChannelState{"B"}), std::make_pair(3, ChannelState{"C"})};
139};
140
141
142/** \} */
143/** \} */
144#endif // GNSS_SDR_LABSAT23_SOURCE_H
This class implements a thread-safe std::queue.
This class implements conversion between Labsat 2, 3 and 3 Wideband formats to gr_complex.
Interface of a thread-safe std::queue.
This interface represents a GNSS block.