GNSS-SDR  0.0.13
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  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
9  *
10  * GNSS-SDR is a software defined Global Navigation
11  * Satellite Systems receiver
12  *
13  * This file is part of GNSS-SDR.
14  *
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"
24 #include <gnuradio/block.h>
25 #include <pmt/pmt.h>
26 #include <cstdint>
27 #include <fstream>
28 #include <string>
29 #if GNURADIO_USES_STD_POINTERS
30 #include <memory>
31 #else
32 #include <boost/shared_ptr.hpp>
33 #endif
34 
35 class labsat23_source;
36 
37 #if GNURADIO_USES_STD_POINTERS
38 using labsat23_source_sptr = std::shared_ptr<labsat23_source>;
39 #else
40 using labsat23_source_sptr = boost::shared_ptr<labsat23_source>;
41 #endif
42 
43 labsat23_source_sptr labsat23_make_source_sptr(
44  const char *signal_file_basename,
45  int channel_selector,
47 
48 /*!
49  * \brief This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex
50  */
51 class labsat23_source : public gr::block
52 {
53 public:
54  ~labsat23_source();
55 
56  int general_work(int noutput_items,
57  gr_vector_int &ninput_items,
58  gr_vector_const_void_star &input_items,
59  gr_vector_void_star &output_items);
60 
61 private:
62  friend labsat23_source_sptr labsat23_make_source_sptr(
63  const char *signal_file_basename,
64  int channel_selector,
66 
67  labsat23_source(const char *signal_file_basename,
68  int channel_selector,
70 
71  std::string generate_filename();
72  void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
73  int getBit(uint8_t byte, int position);
74 
75  std::ifstream binary_input_file;
76  std::string d_signal_file_basename;
78  int d_channel_selector_config;
79  int d_current_file_number;
80  uint8_t d_labsat_version;
81  uint8_t d_channel_selector;
82  uint8_t d_ref_clock;
83  uint8_t d_bits_per_sample;
84  bool d_header_parsed;
85 };
86 
87 #endif // GNSS_SDR_LABSAT23_SOURCE_H
Interface of a thread-safe std::queue.
This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex...