GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
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
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
38
39gnss_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 int items_to_samples);
44
45
46class Gnss_Sdr_Timestamp : public gr::sync_block
47{
48public:
49 int work(int noutput_items,
50 gr_vector_const_void_star& input_items,
51 gr_vector_void_star& output_items);
52 bool start();
53
54private:
55 friend gnss_shared_ptr<Gnss_Sdr_Timestamp> gnss_sdr_make_Timestamp(
56 size_t sizeof_stream_item,
57 std::string timestamp_file,
58 double clock_offset_ms,
59 int items_to_samples);
60
61 Gnss_Sdr_Timestamp(size_t sizeof_stream_item,
62 std::string timestamp_file,
63 double clock_offset_ms,
64 int items_to_samples);
65
66 int64_t uint64diff(uint64_t first, uint64_t second);
67 bool read_next_timetag();
68 std::string d_timefile;
69 std::fstream d_timefilestream;
70 GnssTime next_timetag{};
71 double d_clock_offset_ms;
72 double d_fraction_ms_offset;
73 double d_integer_ms_offset;
74 int d_items_to_samples;
75 uint64_t d_next_timetag_samplecount;
76 bool d_get_next_timetag;
77};
78
79
80/** \} */
81/** \} */
82#endif // GNSS_SDR_GNSS_SDR_TIMESTAMP_H
This interface represents a GNSS block.
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)