GNSS-SDR  0.0.14
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 the Labsat 2 (ls2) and (ls3) capture files
5  * \author Javier Arribas jarribas (at) cttc.es
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_LABSAT23_SOURCE_H
19 #define GNSS_SDR_LABSAT23_SOURCE_H
20 
21 #include "concurrent_queue.h"
22 #include "gnss_block_interface.h"
23 #include <gnuradio/block.h>
24 #include <pmt/pmt.h>
25 #include <cstdint>
26 #include <fstream>
27 #include <string>
28 
29 /** \addtogroup Signal_Source
30  * \{ */
31 /** \addtogroup Signal_Source_gnuradio_blocks
32  * \{ */
33 
34 
35 class labsat23_source;
36 
37 using labsat23_source_sptr = gnss_shared_ptr<labsat23_source>;
38 
39 labsat23_source_sptr labsat23_make_source_sptr(
40  const char *signal_file_basename,
41  int channel_selector,
43 
44 /*!
45  * \brief This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex
46  */
47 class labsat23_source : public gr::block
48 {
49 public:
50  ~labsat23_source();
51 
52  int general_work(int noutput_items,
53  gr_vector_int &ninput_items,
54  gr_vector_const_void_star &input_items,
55  gr_vector_void_star &output_items);
56 
57 private:
58  friend labsat23_source_sptr labsat23_make_source_sptr(
59  const char *signal_file_basename,
60  int channel_selector,
62 
63  labsat23_source(const char *signal_file_basename,
64  int channel_selector,
66 
67  std::string generate_filename();
68  void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
69  int getBit(uint8_t byte, int position);
70 
71  std::ifstream binary_input_file;
72  std::string d_signal_file_basename;
74  int d_channel_selector_config;
75  int d_current_file_number;
76  uint8_t d_labsat_version;
77  uint8_t d_channel_selector;
78  uint8_t d_ref_clock;
79  uint8_t d_bits_per_sample;
80  bool d_header_parsed;
81 };
82 
83 
84 /** \} */
85 /** \} */
86 #endif // GNSS_SDR_LABSAT23_SOURCE_H
Interface of a thread-safe std::queue.
This interface represents a GNSS block.
This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex...