Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
SNTP helper functions. More...
Enumerations | |
enum | sntp_query_state { NO_TIME = 0 , WAITING_FOR_DNS , WAITING_FOR_SNTP , HAVE_TIME , RETRYING } |
Functions | |
void | SNTP_Init () |
Initialise the SNTP library. More... | |
ca_error | SNTP_Update () |
Start the process for updating the RTC using an SNTP request. More... | |
enum sntp_query_state | SNTP_GetState () |
Get the status of the library, which indicates whether the RTC has been updated using SNTP. More... | |
SNTP helper functions.
enum sntp_query_state |
enum sntp_query_state SNTP_GetState | ( | ) |
Get the status of the library, which indicates whether the RTC has been updated using SNTP.
void SNTP_Init | ( | ) |
Initialise the SNTP library.
ca_error SNTP_Update | ( | ) |
Start the process for updating the RTC using an SNTP request.
This is an asynchronous (non-blocking) function, which makes progress as long as otTaskletsProcess() and cascoda_io_handler() are being called regularly. The RTC will be updated once both the SNTP and DNS requests succeed.
Once SNTP_Update is called, the library will keep retrying until all requests succeed, and then it will refresh the RTC every 48 hours.
Calling this function while the library is in the HAVE_TIME or RETRYING states will make it start an update immediately, without waiting for the timeouts inherent in those states.