![]() |
WL865E4-P
36.07.001
|
This file contains the public APIs and structures of Simple Network Time Protocol(SNTP) module. More...
Go to the source code of this file.
Data Structures | |
struct | M2MB_SNTP_SERVER_ENTRY |
SNTP server entry structure. More... | |
struct | M2MB_SNTP_SERVER_LIST |
SNTP server list structure. More... | |
struct | M2MB_SNTP_TM |
Time broken down. More... | |
#define | M2MB_SNTP_DEFAULT_SERVER "pool.ntp.org" |
#define | M2MB_SNTP_SERVER_NAME_SIZE 68 |
#define | M2MB_SNTP_SERVER_MAX 2 |
#define | M2MB_IP_ADDR_STR_LEN 48 |
#define | M2MB_SNTP_SYNC_DONE 0x0010 |
enum | M2MB_SNTP_SERVER_STATUS { M2MB_SNTP_SERVER_STATUS_KOD = 1, M2MB_SNTP_SERVER_STATUS_NORESP = 2 } |
Server status enumeration. More... | |
enum | M2MB_SNTP_SERVER_ID { M2MB_SNTP_SERVER_ID_PRIMARY, M2MB_SNTP_SERVER_ID_SECONDARY } |
Server ID enumeration. More... | |
enum | M2MB_SNTPC_RTC_STATUS_E { M2MB_SNTPC_EVENT_SYSTEM_RTC_SET, M2MB_SNTPC_EVENT_SYSTEM_RTC_NOT_SET } |
The enum indicates RTC SYCN status. More... | |
enum | M2MB_SNTPC_EVENTS_ID_E { M2MB_SNTPC_EVENT_INIT, M2MB_SNTPC_EVENT_INCORRECT_SVR_TYPE, M2MB_SNTPC_EVENT_SYSTEM_SYNC_DONE, M2MB_SNTPC_EVENT_SERVER_DELETED, M2MB_SNTPC_EVENT_SERVER_ADDED } |
Events from SNTP module. More... | |
typedef enum M2MB_SNTP_SERVER_STATUS | M2MB_SNTP_SERVER_STATUS_E |
Server status enumeration. More... | |
typedef enum M2MB_SNTP_SERVER_ID | M2MB_SNTP_SERVER_ID_E |
Server ID enumeration. More... | |
typedef struct M2MB_SNTP_SERVER_ENTRY | M2MB_SNTP_SERVER_ENTRY_T |
SNTP server entry structure. More... | |
typedef struct M2MB_SNTP_SERVER_LIST | M2MB_SNTP_SERVER_LIST_T |
SNTP server list structure. More... | |
typedef struct M2MB_SNTP_TM | M2MB_SNTP_TM_T |
Time broken down. More... | |
typedef void(* | M2MB_SNTPC_APP_CB_t) (void *sntpc_ctx, uint32_t event, void *uData) |
User callback to indicate SNTP event. More... | |
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. More... | |
INT32 | m2mb_sntp_start (VOID) |
m2mb_sntp_start is called to start SNTP. More... | |
INT32 | m2mb_sntp_is_started (VOID) |
m2mb_sntp_is_started is called to check SNTP status. More... | |
INT32 | m2mb_sntp_deinit (VOID) |
m2mb_sntp_deinit is called to de-initialize SNTP module. More... | |
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. More... | |
INT32 | m2mb_sntp_svr_delete (M2MB_SNTP_SERVER_ID_E serverID) |
m2mb_sntp_svr_delete is called to delete the SNTP server details. More... | |
INT32 | m2mb_sntp_update (VOID) |
m2mb_sntp_update is called to update the system time from SNTP server. More... | |
INT32 | m2mb_sntp_get_time (M2MB_SNTP_TM_T *tm) |
m2mb_sntp_get_time is called to get the current system time. More... | |
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. More... | |
This file contains the public APIs and structures of Simple Network Time Protocol(SNTP) module.
we866e4/epl/inc/nwk/m2mb_sntp.h
SNTP provides APIs to get the current time from the global server and updates the system.
To get the current time, the user must provide the server details. This module stores the primary and secondary server details. User can provide server details either by giving its host name or IP address. If host name is given then user has to make sure the DNS client module is initialized before setting the server details.
Steps to use SNTP module: 1. User has to call m2mb_sntpc_init() API first to register the user callback with application context and poll interval.
4. Server has to be updated by calling API m2mb_sntp_update.
Definition in file m2mb_sntp.h.