backoffAlgorithm  v1.1.0
Algorithmic library for calculating retry intervals using exponential backoff and jitter.
BackoffAlgorithm_InitializeParams

Initializes the context for using backoff algorithm. The parameters are required for calculating the next retry backoff delay. This function must be called by the application before the first new retry attempt.

uint16_t backOffBase,
uint16_t maxBackOff,
uint32_t maxAttempts );
Parameters
[out]pContextThe context to initialize with parameters required for the next backoff delay calculation function.
[in]maxBackOffThe maximum backoff delay (in milliseconds) between consecutive retry attempts.
[in]backOffBaseThe base value (in milliseconds) of backoff delay to use in the exponential backoff and jitter model.
[in]maxAttemptsThe maximum number of retry attempts. Set the value to BACKOFF_ALGORITHM_RETRY_FOREVER to retry for ever.

From the Code Example for backoffAlgorithm API, following is the part relevant to the BackoffAlgorithm_InitializeParams API.

/* Variables used in this example. */
char serverAddress[] = "amazon.com";
uint16_t nextRetryBackoff = 0;
/* Initialize reconnect attempts and interval. */
RETRY_BACKOFF_BASE_MS,
RETRY_MAX_BACKOFF_DELAY_MS,
RETRY_MAX_ATTEMPTS );
BackoffAlgorithmContext_t
Represents parameters required for calculating the back-off delay for the next retry attempt.
Definition: backoff_algorithm.h:67
BackoffAlgorithmStatus_t
BackoffAlgorithmStatus_t
Status for BackoffAlgorithm_GetNextBackoff.
Definition: backoff_algorithm.h:56
BackoffAlgorithm_InitializeParams
void BackoffAlgorithm_InitializeParams(BackoffAlgorithmContext_t *pContext, uint16_t backOffBase, uint16_t maxBackOff, uint32_t maxAttempts)
Initializes the context for using backoff algorithm. The parameters are required for calculating the ...
Definition: backoff_algorithm.c:84
BackoffAlgorithmSuccess
@ BackoffAlgorithmSuccess
The function successfully calculated the next back-off value.
Definition: backoff_algorithm.h:57