![]() |
|
Uniot Core
|
| 0.9.0 |
#include <Date.h>
Public Member Functions | |
| bool | store () override |
| Stores the current time to persistent storage. | |
| bool | restore () override |
| Restores time from persistent storage. | |
| virtual void | execute (short _) override |
| Periodic execution callback. | |
| TaskScheduler::TaskPtr | getSyncTask () |
| Get the task that stores and reports time synchronizations. | |
| void | forceSync () |
| Forces immediate NTP time synchronization. | |
Public Member Functions inherited from uniot::IExecutor | |
| virtual | ~IExecutor () |
| Virtual destructor for proper cleanup. | |
Public Member Functions inherited from uniot::CBORStorage | |
| CBORStorage (const String &path) | |
| Constructs a new CBORStorage object. | |
| virtual | ~CBORStorage () |
| Virtual destructor. | |
| CBORObject & | object () |
| Get access to the underlying CBORObject. | |
| virtual bool | clean () override |
| Clean the CBOR object and remove the storage file. | |
Public Member Functions inherited from uniot::Storage | |
| Storage (const String &path) | |
| Constructs a Storage object for a specific file. | |
| virtual | ~Storage () |
| Destructor. | |
Public Member Functions inherited from uniot::Singleton< Date > | |
| Singleton (const Singleton &)=delete | |
| Copy constructor is deleted to prevent duplicating the singleton instance. | |
| Singleton & | operator= (const Singleton &)=delete |
| Assignment operator is deleted to prevent duplicating the singleton instance. | |
Public Member Functions inherited from uniot::EventEmitter< unsigned int, int, Bytes > | |
| virtual | ~EventEmitter ()=default |
| Virtual destructor to ensure proper cleanup of derived classes. | |
| virtual type_id | getTypeId () const override |
| Returns the type identifier for this EventEmitter. | |
| void | emitEvent (unsigned int topic, int msg) |
| Emits an event to all registered event buses. | |
| virtual | ~EventEmitter ()=default |
| Virtual destructor to ensure proper cleanup of derived classes. | |
| virtual type_id | getTypeId () const override |
| Returns the type identifier for this EventEmitter. | |
| void | emitEvent (unsigned int topic, int msg) |
| Emits an event to all registered event buses. | |
Public Member Functions inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| virtual | ~EventEntity () |
| Destructor - disconnects from all connected EventBus instances. | |
| bool | sendDataToChannel (T_topic channel, T_data data) |
| Sends data to a specific channel on all connected EventBus instances. | |
| void | receiveDataFromChannel (T_topic channel, DataChannelCallback callback) |
| Receives data from a specific channel on all connected EventBus instances. | |
Static Public Member Functions | |
| static time_t | now () |
| Returns the current Unix timestamp. | |
| static String | getFormattedTime () |
| Gets the current time in human-readable format. | |
Static Public Member Functions inherited from uniot::Storage | |
| static void | unmount () |
| Explicitly unmounts the filesystem. | |
Static Public Member Functions inherited from uniot::Singleton< Date > | |
| static Date & | getInstance () |
| Gets the singleton instance of the derived class. | |
Friends | |
| class | Singleton< Date > |
Additional Inherited Members | |
Public Types inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| using | DataChannelCallback = std::function<void(unsigned int, bool, T_data)> |
| Callback type for handling data received from channels. | |
Protected Member Functions inherited from uniot::Storage | |
| void | setPath (const String &path) |
| Sets the file path, ensuring it starts with "/". | |
Protected Member Functions inherited from uniot::Singleton< Date > | |
| Singleton ()=default | |
| Default constructor is protected to prevent instantiation outside of derived classes. | |
| ~Singleton ()=default | |
| Default destructor is protected to prevent deletion through base class pointer. | |
Protected Member Functions inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| bool | connectUnique (EventBus< T_topic, T_msg, T_data > *eventBus) |
| Connects to an EventBus instance if not already connected. | |
Protected Attributes inherited from uniot::CBORStorage | |
| CBORObject | mCbor |
| The CBOR object used for data serialization/deserialization. | |
Protected Attributes inherited from uniot::Storage | |
| Bytes | mData |
| The byte array containing the data to be stored or the loaded data. | |
| String | mPath |
| The file path where data is stored. | |
Protected Attributes inherited from uniot::EventEntity< T_topic, T_msg, T_data > | |
| IterableQueue< EventBus< T_topic, T_msg, T_data > * > | mEventBusQueue |
| Queue of EventBus instances this entity is connected to. | |
|
inlineoverridevirtual |
Periodic execution callback.
Called periodically to store the current time to persistent storage.
| _ | Unused parameter required by IExecutor interface |
Implements uniot::IExecutor.
|
inline |
Forces immediate NTP time synchronization.
Reconfigures the NTP client and initiates an immediate time sync request regardless of the regular sync schedule. Emits TIME/SYNCED on success, TIME/SYNC_FAILED on failure.
|
inlinestatic |
Gets the current time in human-readable format.
| String | Time in "YYYY-MM-DD HH:MM:SS" format |
|
inline |
Get the task that stores and reports time synchronizations.
Sync callbacks trigger it rather than doing the work themselves, so it must be pushed to a scheduler under a name for syncs to take effect. A sync that happens before then is kept, and applied on the scheduler's first pass.
| TaskScheduler::TaskPtr | The sync task |
|
inlinestatic |
Returns the current Unix timestamp.
| time_t | Current time as Unix timestamp (seconds since epoch) |
|
inlineoverridevirtual |
Restores time from persistent storage.
Loads the last saved epoch time from CBOR storage and sets the system time accordingly.
| true | Restore operation was successful |
| false | Restore operation failed |
Reimplemented from uniot::CBORStorage.
|
inlineoverridevirtual |
Stores the current time to persistent storage.
Saves the current epoch time to CBOR storage to preserve time information between device reboots.
Reimplemented from uniot::CBORStorage.