SNTP Client#
Functions#
Create SNTP client. This is a non-blocking API.
Get the current time parameters (NTP epoch time). This is a blocking API.
Get current time in time date format parameters. This is a blocking API.
Get SNTP server info. This is a blocking API.
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(*)(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.
[in] | flags | - Select IP version and security
| ||||||||
[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: Expected error codes are : 0xBB0A, 0xFF5F, 0xBB0B, 0xBB15, 0xBB10 cmd_type: Command type buffer: Buffer pointer |
rsi_config_ipaddress() API needs to be called before this API.
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.
62
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.
[in] | length | - Length of the buffer |
[in] | sntp_time_rsp | - Current time response |
rsi_sntp_client_create_async() API needs to be called before this API.
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.
195
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.
[in] | length | - Length of the buffer |
[in] | sntp_time_date_rsp | - Current time and date response |
rsi_sntp_client_create_async() API needs to be called before this API.
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.
306
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.
[in] | length | - Reponse buffer length |
[in] | sntp_server_response | - Pointer to the SNTP Reponse buffer |
rsi_sntp_client_create_async() API needs to be called before this API.
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.
417
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.
[in] |
rsi_sntp_client_create_async() API needs to be called before this API.
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.
528
of file network/protocols/rsi_sntp_client.c