nRF5 SDK for Thread and Zigbee v3.2.0
Data Structures | Macros | Typedefs | Functions

This module includes functions that control SNTP communication. More...

Data Structures

struct  otSntpQuery
 

Macros

#define OT_SNTP_DEFAULT_SERVER_IP   "2001:4860:4806:8::"
 Defines default SNTP Server address - Google NTP Server.
 
#define OT_SNTP_DEFAULT_SERVER_PORT   123
 Defines default SNTP Server port.
 

Typedefs

typedef struct otSntpQuery otSntpQuery
 
typedef void(* otSntpResponseHandler )(void *aContext, uint64_t aTime, otError aResult)
 

Functions

otError otSntpClientQuery (otInstance *aInstance, const otSntpQuery *aQuery, otSntpResponseHandler aHandler, void *aContext)
 
void otSntpClientSetUnixEra (otInstance *aInstance, uint32_t aUnixEra)
 

Detailed Description

This module includes functions that control SNTP communication.

Typedef Documentation

typedef struct otSntpQuery otSntpQuery

This structure implements SNTP Query parameters.

typedef void(* otSntpResponseHandler)(void *aContext, uint64_t aTime, otError aResult)

This function pointer is called when a SNTP response is received.

Parameters
[in]aContextA pointer to application-specific context.
[in]aTimeSpecifies the time at the server when the response left for the client, in UNIX time.
[in]aResultA result of the SNTP transaction.
Return values
OT_ERROR_NONEA response was received successfully and time is provided in aTime.
OT_ERROR_ABORTA SNTP transaction was aborted by stack.
OT_ERROR_BUSYThe Kiss-o'-death packet has been received.
OT_ERROR_RESPONSE_TIMEOUTNo SNTP response has been received within timeout.
OT_ERROR_FAILEDA response was received but contains incorrect data.

Function Documentation

otError otSntpClientQuery ( otInstance aInstance,
const otSntpQuery aQuery,
otSntpResponseHandler  aHandler,
void *  aContext 
)

This function sends a SNTP query.

This function is available only if feature OPENTHREAD_ENABLE_SNTP_CLIENT is enabled.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aQueryA pointer to specify SNTP query parameters.
[in]aHandlerA function pointer that shall be called on response reception or time-out.
[in]aContextA pointer to arbitrary context information.
void otSntpClientSetUnixEra ( otInstance aInstance,
uint32_t  aUnixEra 
)

This function sets the unix era number.

The default value of unix era is set to 0. The subsequent eras start after year 2106.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aUnixEraUnix era number.

Documentation feedback | Developer Zone | Subscribe | Updated