GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
gnss_sdr_sample_counter.h
Go to the documentation of this file.
1/*!
2 * \file gnss_sdr_sample_counter.h
3 * \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
4 * \author Javier Arribas 2018. jarribas(at)cttc.es
5 *
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_GNSS_SDR_SAMPLE_COUNTER_H
19#define GNSS_SDR_GNSS_SDR_SAMPLE_COUNTER_H
20
22#include <gnuradio/sync_decimator.h>
23#include <gnuradio/types.h> // for gr_vector_const_void_star
24#include <cstddef> // for size_t
25#include <cstdint>
26
27/** \addtogroup Core
28 * \{ */
29/** \addtogroup Core_Receiver_Library
30 * Utilities for the core GNSS receiver.
31 * \{ */
32
33
35
36using gnss_sdr_sample_counter_sptr = gnss_shared_ptr<gnss_sdr_sample_counter>;
37
38gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(
39 double _fs,
40 int32_t _interval_ms,
41 size_t _size);
42
43class gnss_sdr_sample_counter : public gr::sync_decimator
44{
45public:
46 ~gnss_sdr_sample_counter() = default;
47 int work(int noutput_items,
48 gr_vector_const_void_star &input_items,
49 gr_vector_void_star &output_items);
50
51private:
52 friend gnss_sdr_sample_counter_sptr gnss_sdr_make_sample_counter(
53 double _fs,
54 int32_t _interval_ms,
55 size_t _size);
56
57 gnss_sdr_sample_counter(double _fs,
58 int32_t _interval_ms,
59 size_t _size);
60
61 int64_t uint64diff(uint64_t first, uint64_t second);
62
63 double fs;
64 int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run
65 uint64_t sample_counter;
66 int32_t interval_ms;
67 int32_t report_interval_ms;
68 uint32_t samples_per_output;
69 uint32_t current_s; // Receiver time in seconds, modulo 60
70 uint32_t current_m; // Receiver time in minutes, modulo 60
71 uint32_t current_h; // Receiver time in hours, modulo 24
72 uint32_t current_days; // Receiver time in days since the beginning of the run
73 bool flag_m; // True if the receiver has been running for at least 1 minute
74 bool flag_h; // True if the receiver has been running for at least 1 hour
75 bool flag_days; // True if the receiver has been running for at least 1 day
76 bool flag_enable_send_msg;
77};
78
79
80/** \} */
81/** \} */
82#endif // GNSS_SDR_GNSS_SDR_SAMPLE_COUNTER_H
This interface represents a GNSS block.