1
6
7
8
9
14
15
16
17
18
19
24
25
28
29
30
33
34
35
38
39
40
46
47
48
49
50
51
52
53
54
55
56
57
58
59
62
64
65
68
69
70
71
72
73
74
75
76
77
78
79
80
81
86
87
88
94
95
96
99
100
101
108
109
110
111
112
113
114
115
116
117
118
119
120
121
124
125
126
127
/* ... */
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "freertos/FreeRTOS.h"
#include "esp_err.h"
#include "esp_netif_types.h"5 includes
#ifdef __cplusplus
extern "C" {
#endif
/* ... */
/* ... */
/* ... */
typedef void (*esp_sntp_time_cb_t)(struct timeval *tv);
/* ... */
#define ESP_SNTP_SERVER_LIST(...) { __VA_ARGS__ }
/* ... */
#define ESP_NETIF_SNTP_DEFAULT_CONFIG_MULTIPLE(servers_in_list, list_of_servers) { \
.smooth_sync = false, \
.server_from_dhcp = false, \
.wait_for_sync = true, \
.start = true, \
.sync_cb = NULL, \
.renew_servers_after_new_IP = false, \
.ip_event_to_renew = IP_EVENT_STA_GOT_IP, \
.index_of_first_server = 0, \
.num_of_servers = (servers_in_list), \
.servers = list_of_servers, \
}{...}
/* ... */
#define ESP_NETIF_SNTP_DEFAULT_CONFIG(server) \
ESP_NETIF_SNTP_DEFAULT_CONFIG_MULTIPLE(1, {server})...
/* ... */
typedef struct esp_sntp_config {
bool smooth_sync;
bool server_from_dhcp;
bool wait_for_sync;
bool start;
esp_sntp_time_cb_t sync_cb;
bool renew_servers_after_new_IP;
ip_event_t ip_event_to_renew;
size_t index_of_first_server;
size_t num_of_servers;
const char* servers[CONFIG_LWIP_SNTP_MAX_SERVERS];
}{ ... } esp_sntp_config_t;
/* ... */
esp_err_t esp_netif_sntp_init(const esp_sntp_config_t * config);
/* ... */
esp_err_t esp_netif_sntp_start(void);
/* ... */
void esp_netif_sntp_deinit(void);
/* ... */
esp_err_t esp_netif_sntp_sync_wait(TickType_t tout);
/* ... */
esp_err_t esp_netif_sntp_reachability(unsigned int index, unsigned int *reachability);
/* ... */
#ifdef __cplusplus
}{...}
#endif