WL865E4-P  36.07.001
m2mb_sntp.h
Go to the documentation of this file.
1 /*===============================================================================================*/
2 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
47 #ifndef M2MB_SNTP_API_H
48 #define M2MB_SNTP_API_H
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
63 /*-----------------------------------------------------------------------------------------------*/
64 
70 /* Global declarations ==========================================================================*/
71 
73 #define M2MB_SNTP_DEFAULT_SERVER "pool.ntp.org"
74 
76 #define M2MB_SNTP_SERVER_NAME_SIZE 68
77 
79 #define M2MB_SNTP_SERVER_MAX 2
80 
82 #define M2MB_IP_ADDR_STR_LEN 48
83 
85 #define M2MB_SNTP_SYNC_DONE 0x0010
86 
87 /* Global typedefs ==============================================================================*/
95 {
99 
107 {
112 
121 typedef enum
122 {
128 
137 typedef enum
138 {
146 
154 {
160 
168 typedef struct M2MB_SNTP_SERVER_LIST
169 {
172 
179 typedef struct M2MB_SNTP_TM
180 {
191 
192 /****************************************************************************************/
245 typedef void (* M2MB_SNTPC_APP_CB_t)( void *sntpc_ctx, uint32_t event, void *uData );
246 
247 /* Global functions =========================================================*/
248 /*-----------------------------------------------------------------------------------------------*/
300 /*-----------------------------------------------------------------------------------------------*/
301 INT32 m2mb_sntp_init(M2MB_SNTPC_APP_CB_t user_cb, void *user_ctx, uint32_t poll_interval);
302 
303 /*-----------------------------------------------------------------------------------------------*/
347 /*---------------------------------------------------------------------------*/
349 
350 /*---------------------------------------------------------------------------*/
395 /*---------------------------------------------------------------------------*/
397 
398 /*---------------------------------------------------------------------------*/
441 /*---------------------------------------------------------------------------*/
443 
444 /*---------------------------------------------------------------------------*/
506 /*-----------------------------------------------------------------------------------------------*/
508 
509 /*---------------------------------------------------------------------------*/
561 /*-----------------------------------------------------------------------------------------------*/
563 
564 /*-----------------------------------------------------------------------------------------------*/
611 /*-----------------------------------------------------------------------------------------------*/
613 
614 /*-----------------------------------------------------------------------------------------------*/
685 /*-----------------------------------------------------------------------------------------------*/
687 
688 /*-----------------------------------------------------------------------------------------------*/
712 /*-----------------------------------------------------------------------------------------------*/
714 
719 #ifdef __cplusplus
720 }
721 #endif
722 #endif
enum M2MB_SNTP_SERVER_STATUS M2MB_SNTP_SERVER_STATUS_E
Server status enumeration.
M2MB_SNTP_SERVER_STATUS
Server status enumeration.
Definition: m2mb_sntp.h:94
INT32 m2mb_sntp_init(M2MB_SNTPC_APP_CB_t user_cb, void *user_ctx, uint32_t poll_interval)
m2mb_sntp_init is called to initialize the SNTP user callback and continuous interval.
unsigned char UINT8
Definition: m2mb_types.h:83
M2MB_SNTPC_RTC_STATUS_E
The enum indicates RTC SYCN status.
Definition: m2mb_sntp.h:121
INT32 m2mb_sntp_deinit(VOID)
m2mb_sntp_deinit is called to de-initialize SNTP module.
#define M2MB_IP_ADDR_STR_LEN
Definition: m2mb_sntp.h:82
struct M2MB_SNTP_SERVER_LIST M2MB_SNTP_SERVER_LIST_T
SNTP server list structure.
UINT32 tm_hour
Definition: m2mb_sntp.h:183
struct M2MB_SNTP_TM M2MB_SNTP_TM_T
Time broken down.
M2MB_SNTPC_EVENTS_ID_E
Events from SNTP module.
Definition: m2mb_sntp.h:137
struct M2MB_SNTP_SERVER_ENTRY M2MB_SNTP_SERVER_ENTRY_T
SNTP server entry structure.
UINT32 tm_mday
Definition: m2mb_sntp.h:184
UINT32 tm_min
Definition: m2mb_sntp.h:182
UINT32 tm_year
Definition: m2mb_sntp.h:186
INT32 m2mb_sntp_svr_delete(M2MB_SNTP_SERVER_ID_E serverID)
m2mb_sntp_svr_delete is called to delete the SNTP server details.
INT32 m2mb_sntp_svr_add(M2MB_SNTP_SERVER_ID_E serverID, UINT8 *name)
m2mb_sntp_svr_add is called to add a SNTP server to get the time.
enum M2MB_SNTP_SERVER_ID M2MB_SNTP_SERVER_ID_E
Server ID enumeration.
UINT32 tm_isdst
Definition: m2mb_sntp.h:189
INT32 m2mb_sntp_update(VOID)
m2mb_sntp_update is called to update the system time from SNTP server.
unsigned long int UINT32
Definition: m2mb_types.h:85
Time broken down.
Definition: m2mb_sntp.h:179
UINT32 tm_mon
Definition: m2mb_sntp.h:185
INT32 m2mb_sntp_get_server_list(M2MB_SNTP_SERVER_LIST_T *svr_List)
m2mb_sntp_get_server_list is called to get the SNTP server list.
UINT8 name[M2MB_SNTP_SERVER_NAME_SIZE]
Definition: m2mb_sntp.h:155
M2MB_SNTP_SERVER_ID
Server ID enumeration.
Definition: m2mb_sntp.h:106
M2MB_SNTP_SERVER_ENTRY_T server[M2MB_SNTP_SERVER_MAX]
Definition: m2mb_sntp.h:170
void VOID
Definition: m2mb_types.h:72
#define M2MB_SNTP_SERVER_MAX
Definition: m2mb_sntp.h:79
signed int INT32
Definition: m2mb_types.h:80
UINT32 tm_wday
Definition: m2mb_sntp.h:187
SNTP server list structure.
Definition: m2mb_sntp.h:168
INT32 m2mb_sntp_is_started(VOID)
m2mb_sntp_is_started is called to check SNTP status.
UINT32 tm_sec
Definition: m2mb_sntp.h:181
UINT32 tm_yday
Definition: m2mb_sntp.h:188
INT32 m2mb_sntp_start(VOID)
m2mb_sntp_start is called to start SNTP.
void(* M2MB_SNTPC_APP_CB_t)(void *sntpc_ctx, uint32_t event, void *uData)
User callback to indicate SNTP event.
Definition: m2mb_sntp.h:245
UINT8 addr[M2MB_IP_ADDR_STR_LEN]
Definition: m2mb_sntp.h:156
SNTP server entry structure.
Definition: m2mb_sntp.h:153
INT32 m2mb_sntp_get_time(M2MB_SNTP_TM_T *tm)
m2mb_sntp_get_time is called to get the current system time.
#define M2MB_SNTP_SERVER_NAME_SIZE
Definition: m2mb_sntp.h:76