GNSS-SDR  0.0.17
An Open Source GNSS Software Defined Receiver
gnss_sdr_timestamp.h
Go to the documentation of this file.
1 /*!
2  * \file gnss_sdr_timestamp.h
3  * \brief GNURadio block that adds to sample stream timestamp metadata information stored on a sepparated file
4  * \author Javier Arribas, 2021. jarribas(at)cttc.es
5  *
6  * -----------------------------------------------------------------------------
7  *
8  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9  * This file is part of GNSS-SDR.
10  *
11  * Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
12  * SPDX-License-Identifier: GPL-3.0-or-later
13  *
14  * -----------------------------------------------------------------------------
15  */
16 
17 
18 #ifndef GNSS_SDR_GNSS_SDR_TIMESTAMP_H
19 #define GNSS_SDR_GNSS_SDR_TIMESTAMP_H
20 
21 #include "gnss_block_interface.h"
22 #include "gnss_time.h"
23 #include <gnuradio/sync_block.h> // for sync_block
24 #include <gnuradio/types.h> // for gr_vector_const_void_star
25 #include <pmt/pmt.h>
26 #include <cstddef> // for size_t
27 #include <cstdint>
28 #include <fstream>
29 #include <string>
30 
31 /** \addtogroup Signal_Source
32  * \{ */
33 /** \addtogroup Signal_Source_libs
34  * \{ */
35 
36 
37 class Gnss_Sdr_Timestamp;
38 
39 gnss_shared_ptr<Gnss_Sdr_Timestamp> gnss_sdr_make_Timestamp(
40  size_t sizeof_stream_item,
41  std::string timestamp_file,
42  double clock_offset_ms);
43 
44 
45 class Gnss_Sdr_Timestamp : public gr::sync_block
46 {
47 public:
48  int work(int noutput_items,
49  gr_vector_const_void_star& input_items,
50  gr_vector_void_star& output_items);
51  bool start();
52 
53 private:
54  friend gnss_shared_ptr<Gnss_Sdr_Timestamp> gnss_sdr_make_Timestamp(
55  size_t sizeof_stream_item,
56  std::string timestamp_file,
57  double clock_offset_ms);
58 
59  Gnss_Sdr_Timestamp(size_t sizeof_stream_item,
60  std::string timestamp_file,
61  double clock_offset_ms);
62 
63  int64_t uint64diff(uint64_t first, uint64_t second);
64  bool read_next_timetag();
65  std::string d_timefile;
66  std::fstream d_timefilestream;
67  GnssTime next_timetag{};
68  double d_clock_offset_ms;
69  double d_fraction_ms_offset;
70  double d_integer_ms_offset;
71  uint64_t d_next_timetag_samplecount;
72  bool d_get_next_timetag;
73 };
74 
75 
76 /** \} */
77 /** \} */
78 #endif // GNSS_SDR_GNSS_SDR_TIMESTAMP_H
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)...
This interface represents a GNSS block.