SNTP Client#

Functions#

int32_t
rsi_sntp_client_create_async(uint8_t flags, uint8_t *server_ip, uint8_t sntp_method, uint16_t sntp_timeout, 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_timeout, void(*)(uint16_t status, const uint8_t cmd_type, const uint8_t *buffer) rsi_sntp_client_create_response_handler)

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_timeout

- SNTP timeout value

[in]rsi_sntp_client_create_response_handler

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

Returns

  • 0 - Success Negative Value - Failure -2 - Invalid parameters, call back not registered -3 - Command given in wrong state -4 - Buffer not available to serve the command

Note

  • SNTP broadcast method is currently not supported.

  • Refer to Error Codes section for more error codes Error Codes.


Definition at line 58 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 -2 - Invalid parameters, callback not registered -3 - Command given in wrong state -4 - Buffer not available to serve the command

Note

  • Refer to Error Codes section for more error codes Error Codes.


Definition at line 184 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 -2 - Invalid parameters, callback not registered -3 - Command given in wrong state -4 - Buffer not available to serve the command

Note

  • Refer to Error Codes section for more error codes Error Codes.


Definition at line 290 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 -2 - Invalid parameters, call back not registered -3 - Command given in wrong state -4 - Buffer not available to serve the command

Note

  • Refer to Error Codes section for more error codes Error Codes.


Definition at line 396 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 -2 - Invalid parameters, callback not registered -3 - Command given in wrong state -4 - Buffer not available to serve the command

Note

  • Refer to Error Codes section for more error codes Error Codes.


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