GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
gnss_sdr_time_counter.h
Go to the documentation of this file.
1 /*!
2  * \file gnss_sdr_time_counter.h
3  * \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
4  * \author Antonio Ramos 2018. antonio.ramosdet(at)gmail.com
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_TIME_COUNTER_H
19 #define GNSS_SDR_GNSS_SDR_TIME_COUNTER_H
20 
21 #include <gnuradio/block.h>
22 #include <gnuradio/types.h> // for gr_vector_const_void_star
23 #include <cstdint>
24 #include <memory>
25 
26 /** \addtogroup Core
27  * \{ */
28 /** \addtogroup Core_Receiver_Library
29  * \{ */
30 
31 
33 
34 using gnss_sdr_time_counter_sptr = std::shared_ptr<gnss_sdr_time_counter>;
35 
36 gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
37 
38 class gnss_sdr_time_counter : public gr::block
39 {
40 public:
41  ~gnss_sdr_time_counter() = default;
42  int general_work(int noutput_items __attribute__((unused)),
43  gr_vector_int &ninput_items __attribute__((unused)),
44  gr_vector_const_void_star &input_items __attribute__((unused)),
45  gr_vector_void_star &output_items);
46 
47 private:
49  friend gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
50 
51  int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run
52  int32_t report_interval_ms;
53  uint32_t current_s; // Receiver time in seconds, modulo 60
54  uint32_t current_m; // Receiver time in minutes, modulo 60
55  uint32_t current_h; // Receiver time in hours, modulo 24
56  uint32_t current_days; // Receiver time in days since the beginning of the run
57  bool flag_m; // True if the receiver has been running for at least 1 minute
58  bool flag_h; // True if the receiver has been running for at least 1 hour
59  bool flag_days; // True if the receiver has been running for at least 1 day
60 };
61 
62 
63 /** \} */
64 /** \} */
65 #endif // GNSS_SDR_GNSS_SDR_SAMPLE_COUNTER_H