Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Sntp_ReceiveTimeResponse API (#16)
Add a Sntp_ReceiveTimeResponse API to allow application to obtain the response for a time request that was made to a server (with Sntp_SendTimeRequest API). The API looks at 3 different timeouts in its operations: Server Response timeout - This PR adds a responseTimeoutMs state to the SntpContext_t to allow the application to specify timeouts for server responses (to time requests). The timeout period for a server starts after the Sntp_SendTimeRequest API is called to send a request to the server. The Sntp_ReceiveTimeResponse API keeps a track of whether server response has timed out whenever it is called, and returns a SntpServerResponseTimeout error code (even if the blockTimeMs value still allows more time window for waiting on server response). Block Time - The API takes a blockTimeMs parameter which determines the maximum amount of time the function will block waiting for the server response UNLESS either the server response is received OR the server response has timed out OR there is a network read error encountered (like hitting a read retry timeout) Read Retry Timeout - This PR adds an SNTP_RECV_POLLING_TIMEOUT_MS configuration macro that represents the maximum time window of retrying zero data reads. This window is only initiated after some partial data is initially read from the network. The rationale is that when some initial data is available from the network, then it is likely that the remaining SNTP response packet will be available and thus, the read retry timeout window starts. The Sntp_ReceiveTimeResponse API uses this configuration value to retry partial data reads on the network.
- Loading branch information