![]() |
SatNOGS-COMMS
4.1.0
A COMMS subsystem for CubeSats
|
Time and position information. More...
#include <time.hpp>
Classes | |
| class | to_string_exception |
Public Types | |
| enum class | time_src : uint8_t { GNSS_ASSISTED_RTC = 0 , GNSS_ONLY , UPTIME } |
| Source of the reported time. More... | |
| enum class | time_granularity { YEAR , MONTH , DAY , HOUR , MIN , SEC } |
| Granularity of time represented as string. More... | |
Public Member Functions | |
| time (time const &)=delete | |
| void | operator= (time const &)=delete |
| void | gnss_data_cb (const struct device *dev, const struct gnss_data *data) |
| time_src | get (uint64_t &t) |
| Gets the time in ms. | |
| time_src | get (struct tm &t) |
| Gets the current time. | |
| void | set (const struct tm &t) |
| Sets the RTC time. | |
| void | gnss (struct gnss_data &data) |
| Retrieve latest GNSS information. | |
| uint64_t | uptime () |
| Gets the current system uptime in milliseconds. | |
| uint64_t | last_gnss_update_uptime () |
| Gets the system uptime (in milliseconds) at the time of the last GNSS fix. | |
| uint64_t | last_nmea_update_uptime () |
| size_t | to_string (const struct tm &tm, etl::istring &s, time::time_granularity granularity) const |
| Return the string represantation of a struct tm time instance following the ISO-8601 paradigm. If the conversion fails, the function returns an empty string. | |
| size_t | to_string (const struct tm &tm, etl::istring &s) const |
| Overloading function of time::to_string defaulting to DAY granularity. | |
Static Public Member Functions | |
| static time & | get_instance () |
Static Public Attributes | |
| static constexpr size_t | to_string_max_size = 20 |
Time and position information.
This class provides time and position (if available) information. The SatNOGS-COMMS supports diffent sources of time depending on the configuration and the available peripherals. If the RTC battery is present and has enough voltage, the RTC time is retrieved, if the RTC clock has been set at least once. This can be done either by a telecommand or by the second available time source which is the GNSS. This class uses internally the GNSS modem of the Zephyr-RTOS and parses the NMEA messages that are published on one of the available UART ports. If the GNSS declares a valid fix, the announced time is automatically set to the RTC too.
If the RTC battery is not present or failed mid-flight but the GNSS time is available, the time is updated based on the last known time information from the GNSS and the uptime.
If all the above time sources failed to provide time information, the uptime is used as a last resort.
|
strong |
|
strong |
Source of the reported time.
|
delete |
| time::time_src satnogs::comms::time::get | ( | struct tm & | t | ) |
Gets the current time.
| t | reference to hold the result |
| time::time_src satnogs::comms::time::get | ( | uint64_t & | t | ) |
Gets the time in ms.
The current time depends on the time source and it is equal to:
| t | reference to hold the result |
| void satnogs::comms::time::gnss | ( | struct gnss_data & | data | ) |
| void satnogs::comms::time::gnss_data_cb | ( | const struct device * | dev, |
| const struct gnss_data * | data ) |
| uint64_t satnogs::comms::time::last_gnss_update_uptime | ( | ) |
|
delete |
| void satnogs::comms::time::set | ( | const struct tm & | t | ) |
| size_t satnogs::comms::time::to_string | ( | const struct tm & | tm, |
| etl::istring & | s ) const |
Overloading function of time::to_string defaulting to DAY granularity.
| size_t satnogs::comms::time::to_string | ( | const struct tm & | tm, |
| etl::istring & | s, | ||
| time::time_granularity | granularity ) const |
Return the string represantation of a struct tm time instance following the ISO-8601 paradigm. If the conversion fails, the function returns an empty string.
| tm | reference to struct tm that holds the time information |
| s | etl::string to write to |
| granularity | specifies the wanted granularity of our stringified time (year, month, day etc.) |
| uint64_t satnogs::comms::time::uptime | ( | ) |
|
staticconstexpr |