WE310F5  39.00.000
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 {
131 
139 typedef enum M2MB_SNTP_CONF_ID
140 {
149 
157 {
163 
171 typedef struct M2MB_SNTP_SERVER_LIST
172 {
175 
182 typedef struct M2MB_SNTP_TM
183 {
194 
195 
196 /****************************************************************************************/
244 typedef void (* M2MB_SNTPC_APP_CB_T)( VOID *sntpc_ctx, UINT32 event, VOID *uData );
245 
254 {
258 
266 typedef struct M2MB_SNTP_INIT_PARAMS
267 {
269  void *user_ctx;
274 
282 typedef union
283 {
290 
291 /****************************************************************************************/
292 
293 /* Global functions =========================================================*/
294 /*-----------------------------------------------------------------------------------------------*/
348 /*-----------------------------------------------------------------------------------------------*/
350 
351 /*---------------------------------------------------------------------------*/
407 /*---------------------------------------------------------------------------*/
409 
410 /*---------------------------------------------------------------------------*/
497 /*---------------------------------------------------------------------------*/
499 
500 /*---------------------------------------------------------------------------*/
577 /*---------------------------------------------------------------------------*/
579 
580 /*-----------------------------------------------------------------------------------------------*/
633 /*---------------------------------------------------------------------------*/
635 
636 /*-----------------------------------------------------------------------------------------------*/
719 /*-----------------------------------------------------------------------------------------------*/
721 
722 
727 #ifdef __cplusplus
728 }
729 #endif
730 #endif
struct M2MB_SNTP_SERVER_ENTRY M2MB_SNTP_SERVER_ENTRY_T
SNTP server entry structure.
UINT16 tm_sec
Definition: m2mb_sntp.h:184
UINT16 tm_wday
Definition: m2mb_sntp.h:190
M2MB_SNTP_SRV_ADD_INFO_T * srv_info
Definition: m2mb_sntp.h:285
UINT16 tm_year
Definition: m2mb_sntp.h:189
UINT16 tm_yday
Definition: m2mb_sntp.h:191
M2MB_SNTPC_EVENTS_ID_E
Events from SNTP module.
Definition: m2mb_sntp.h:121
#define M2MB_SNTP_SERVER_NAME_SIZE
Definition: m2mb_sntp.h:76
unsigned char UINT8
Definition: m2mb_types.h:86
void(* M2MB_SNTPC_APP_CB_T)(VOID *sntpc_ctx, UINT32 event, VOID *uData)
User callback to indicate SNTP event.
Definition: m2mb_sntp.h:244
M2MB_SNTP_SERVER_LIST_T * get_srv_list
Definition: m2mb_sntp.h:288
M2MB_STATUS_T m2mb_sntp_init(HANDLE *handle, M2MB_SNTP_INIT_PARAMS_T *init_params)
m2mb_sntp_init is called to initialize the SNTP user callback and continuous interval.
M2MB_STATUS_T m2mb_sntp_deinit(HANDLE handle)
m2mb_sntp_deinit is called to de-initialize SNTP module.
INT32 M2MB_STATUS_T
Definition: m2mb_status.h:97
M2MB_SNTP_TM_T * tm
Definition: m2mb_sntp.h:287
M2MB_STATUS_T m2mb_sntp_update(HANDLE handle)
m2mb_sntp_update is called to update the system time from SNTP server.
#define M2MB_SNTP_SERVER_MAX
Definition: m2mb_sntp.h:79
M2MB_SNTP_SERVER_STATUS
Server status enumeration.
Definition: m2mb_sntp.h:94
UINT16 tm_min
Definition: m2mb_sntp.h:185
unsigned short UINT16
Definition: m2mb_types.h:87
SNTP server entry structure.
Definition: m2mb_sntp.h:156
UINT16 tm_mon
Definition: m2mb_sntp.h:188
UINT8 name[M2MB_SNTP_SERVER_NAME_SIZE]
Definition: m2mb_sntp.h:158
Structure is used by SET/GET configuration paramters of CONF IDs mentioned in enum M2MB_SNTP_CONF_ID_...
Definition: m2mb_sntp.h:282
UINT8 addr[M2MB_IP_ADDR_STR_LEN]
Definition: m2mb_sntp.h:159
M2MB_SNTP_SERVER_ENTRY_T server[M2MB_SNTP_SERVER_MAX]
Definition: m2mb_sntp.h:173
M2MB_STATUS_T m2mb_sntp_start(HANDLE handle)
m2mb_sntp_start is called to start to send the sntp client request to the sntp server.
enum M2MB_SNTP_SERVER_ID M2MB_SNTP_SERVER_ID_E
Server ID enumeration.
UINT16 tm_mday
Definition: m2mb_sntp.h:187
struct M2MB_SNTP_INIT_PARAMS M2MB_SNTP_INIT_PARAMS_T
SNTP initialization parameters.
UINT16 tm_isdst
Definition: m2mb_sntp.h:192
M2MB_STATUS_T m2mb_sntp_get_cfg(HANDLE handle, M2MB_SNTP_CONF_ID_E conf_id, M2MB_SNTP_CONF_PARAMS_T *conf_params)
GET the SNTP configuration parameters.
void VOID
Definition: m2mb_types.h:74
struct M2MB_SNTP_SRV_ADD_INFO M2MB_SNTP_SRV_ADD_INFO_T
Structure is used by the Configuration ID M2MB_SNTP_CONF_SET_SRV_ADD to configure the given sntp serv...
M2MB_SNTP_SERVER_ID
Server ID enumeration.
Definition: m2mb_sntp.h:106
M2MB_SNTP_SERVER_ID_E serverID
Definition: m2mb_sntp.h:286
struct M2MB_SNTP_TM M2MB_SNTP_TM_T
Time broken down.
Time broken down.
Definition: m2mb_sntp.h:182
unsigned long int UINT32
Definition: m2mb_types.h:88
SNTP initialization parameters.
Definition: m2mb_sntp.h:266
struct M2MB_SNTP_SERVER_LIST M2MB_SNTP_SERVER_LIST_T
SNTP server list structure.
SNTP server list structure.
Definition: m2mb_sntp.h:171
enum M2MB_SNTP_CONF_ID M2MB_SNTP_CONF_ID_E
SNTP GET/SET Configuration enumeration.
UINT16 tm_hour
Definition: m2mb_sntp.h:186
void * HANDLE
Definition: m2mb_types.h:98
M2MB_SNTP_SERVER_ID_E serverID
Definition: m2mb_sntp.h:256
M2MB_SNTP_CONF_ID
SNTP GET/SET Configuration enumeration.
Definition: m2mb_sntp.h:139
enum M2MB_SNTP_SERVER_STATUS M2MB_SNTP_SERVER_STATUS_E
Server status enumeration.
#define M2MB_IP_ADDR_STR_LEN
Definition: m2mb_sntp.h:82
M2MB_STATUS_T m2mb_sntp_set_cfg(HANDLE handle, M2MB_SNTP_CONF_ID_E conf_id, M2MB_SNTP_CONF_PARAMS_T *conf_params)
SET the SNTP configuration parameters.
Structure is used by the Configuration ID M2MB_SNTP_CONF_SET_SRV_ADD to configure the given sntp serv...
Definition: m2mb_sntp.h:253
M2MB_SNTPC_APP_CB_T user_cb
Definition: m2mb_sntp.h:268