SNTP Client#

Functions#

int32_t
rsi_sntp_client_create_async(uint8_t flags, uint8_t *server_ip, uint8_t sntp_method, uint16_t sntp_retry_count, void(*rsi_sntp_client_create_response_handler)(uint16_t status, const uint8_t cmd_type, const uint8_t *buffer))

Create SNTP client. This is a non-blocking API.

int32_t
rsi_sntp_client_gettime(uint16_t length, uint8_t *sntp_time_rsp)

Get the current time parameters (NTP epoch time). This is a blocking API.

int32_t
rsi_sntp_client_gettime_date(uint16_t length, uint8_t *sntp_time_date_rsp)

Get current time in time date format parameters. This is a blocking API.

int32_t
rsi_sntp_client_server_info(uint16_t length, uint8_t *sntp_server_response)

Get SNTP server info. This is a blocking API.

int32_t

Delete SNTP client. This is a non-blocking API.

Function Documentation#

rsi_sntp_client_create_async#

int32_t rsi_sntp_client_create_async (uint8_t flags, uint8_t *server_ip, uint8_t sntp_method, uint16_t sntp_retry_count, void(*rsi_sntp_client_create_response_handler)(uint16_t status, const uint8_t cmd_type, const uint8_t *buffer))

Create SNTP client. This is a non-blocking API.

Parameters
[in]flags

- Select IP version and security

Flags

Description

BIT(0) - RSI_IPV6

Set this bit to enable IPv6. Configured to IPv4 by default.

BIT(1) - RSI_SSL_ENABLE

Set this bit to enable SSL feature

BIT(2) to BIT(7)

Reserved for future use

[in]server_ip

- Server IP address

[in]sntp_method

- SNTP methods to use 1-For Broadcast method, 2-For Unicast method

[in]sntp_retry_count

- Configures SNTP max retry count The number of times the client request is retried when the server response is failed to receive. For each retry, the client waits for 5 secs to receive server response before initiating next attempt. Need to set the value based on the network quality. For ex: The value should be <= 5 for good network quality and > 10 for bad network quality.

[in]rsi_sntp_client_create_response_handler

- Callback function when asynchronous response comes for the request. status: Status code. Expected error codes are : 0xBB0A, 0xFF5F, 0xBB0B, 0xBB15, 0xBB10 cmd_type: Command type buffer: Buffer pointer

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • SNTP broadcast method is currently not supported.

  • Refer to Error Codes for the description of above error codes.


Definition at line 59 of file network/protocols/rsi_sntp_client.c

rsi_sntp_client_gettime#

int32_t rsi_sntp_client_gettime (uint16_t length, uint8_t *sntp_time_rsp)

Get the current time parameters (NTP epoch time). This is a blocking API.

Parameters
[in]length

- Length of the buffer

[in]sntp_time_rsp

- Current time response

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note


Definition at line 189 of file network/protocols/rsi_sntp_client.c

rsi_sntp_client_gettime_date#

int32_t rsi_sntp_client_gettime_date (uint16_t length, uint8_t *sntp_time_date_rsp)

Get current time in time date format parameters. This is a blocking API.

Parameters
[in]length

- Length of the buffer

[in]sntp_time_date_rsp

- Current time and date response

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note


Definition at line 297 of file network/protocols/rsi_sntp_client.c

rsi_sntp_client_server_info#

int32_t rsi_sntp_client_server_info (uint16_t length, uint8_t *sntp_server_response)

Get SNTP server info. This is a blocking API.

Parameters
[in]length

- Reponse buffer length

[in]sntp_server_response

- Pointer to the SNTP Reponse buffer

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note


Definition at line 405 of file network/protocols/rsi_sntp_client.c

rsi_sntp_client_delete_async#

int32_t rsi_sntp_client_delete_async (void)

Delete SNTP client. This is a non-blocking API.

Parameters
[in]

Returns

  • 0 - Success

  • Negative Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note


Definition at line 513 of file network/protocols/rsi_sntp_client.c