gnss-sdr/src/core/libs/gnss_sdr_time_counter.h

66 lines
2.2 KiB
C
Raw Permalink Normal View History

2018-04-13 13:27:14 +00:00
/*!
* \file gnss_sdr_time_counter.h
* \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
* \author Antonio Ramos 2018. antonio.ramosdet(at)gmail.com
*
*
2020-07-28 14:57:15 +00:00
* -----------------------------------------------------------------------------
2018-04-13 13:27:14 +00:00
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
2018-04-13 13:27:14 +00:00
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
2018-04-13 13:27:14 +00:00
*
2020-07-28 14:57:15 +00:00
* -----------------------------------------------------------------------------
2018-04-13 13:27:14 +00:00
*/
2019-03-06 22:59:35 +00:00
#ifndef GNSS_SDR_GNSS_SDR_TIME_COUNTER_H
#define GNSS_SDR_GNSS_SDR_TIME_COUNTER_H
2018-04-13 13:27:14 +00:00
#include <gnuradio/block.h>
2019-03-06 12:49:14 +00:00
#include <gnuradio/types.h> // for gr_vector_const_void_star
#include <cstdint>
2020-04-02 22:17:22 +00:00
#include <memory>
2018-04-13 13:27:14 +00:00
/** \addtogroup Core
* \{ */
/** \addtogroup Core_Receiver_Library
* \{ */
2018-04-13 13:27:14 +00:00
class gnss_sdr_time_counter;
using gnss_sdr_time_counter_sptr = std::shared_ptr<gnss_sdr_time_counter>;
2018-04-13 13:27:14 +00:00
gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
class gnss_sdr_time_counter : public gr::block
{
public:
~gnss_sdr_time_counter() = default;
int general_work(int noutput_items __attribute__((unused)),
gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items __attribute__((unused)),
gr_vector_void_star &output_items);
2018-04-13 13:27:14 +00:00
private:
gnss_sdr_time_counter();
2020-06-27 07:25:04 +00:00
friend gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
int64_t current_T_rx_ms; // Receiver time in ms since the beginning of the run
int32_t report_interval_ms;
2020-06-27 07:25:04 +00:00
uint32_t current_s; // Receiver time in seconds, modulo 60
uint32_t current_m; // Receiver time in minutes, modulo 60
uint32_t current_h; // Receiver time in hours, modulo 24
uint32_t current_days; // Receiver time in days since the beginning of the run
bool flag_m; // True if the receiver has been running for at least 1 minute
bool flag_h; // True if the receiver has been running for at least 1 hour
bool flag_days; // True if the receiver has been running for at least 1 day
2018-04-13 13:27:14 +00:00
};
/** \} */
/** \} */
#endif // GNSS_SDR_GNSS_SDR_SAMPLE_COUNTER_H