38 lines
873 B
C
38 lines
873 B
C
/**
|
|
* @file sntp.h
|
|
* @brief SNTP client for time synchronization.
|
|
*
|
|
* This module synchronizes system time with an NTP server.
|
|
* Time sync is required for schedule-based heating control.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
|
|
/**
|
|
* @brief SNTP synchronization state enumeration.
|
|
*/
|
|
typedef enum _SntpState
|
|
{
|
|
SYNC_SUCCESSFUL, /**< Time synchronized successfully. */
|
|
SYNC_NOT_STARTED, /**< Synchronization not yet attempted. */
|
|
SYNC_FAILED, /**< Synchronization failed. */
|
|
} eSntpState;
|
|
|
|
/**
|
|
* @brief Initialize the SNTP client.
|
|
*
|
|
* Configures SNTP with the server from Kconfig and starts
|
|
* periodic time synchronization.
|
|
*
|
|
* @return ESP_OK on success, ESP_FAIL on error.
|
|
*/
|
|
esp_err_t initSntp(void);
|
|
|
|
/**
|
|
* @brief Get the current SNTP synchronization state.
|
|
* @return eSntpState indicating sync status.
|
|
*/
|
|
eSntpState getSntpState(void);
|