Trickle timer module interface definition.
More...
Trickle timer module interface definition.
The Trickle timer implements the trickle algorithm as specified in RFC 6202. The module has a dependency on the Application timer module, only a single application timer instance is used. The value of the APP_TIMER_PRESCALER
determines the accuracy of the Application timer and hence, the Trickle timer's accuracy as well. A lower APP_TIMER_PRESCALER
value will increase accuracy and allow shorter timeouts. You can configure the module by changing the sdk_config.h
configuration file.
#define TRICKLE_TIMER_TX_SUPPRESSION_OFF 0 |
Value reserved for the redundancy constant to turn off transmission suppression.
typedef void(* trickle_evt_handler_t)(uint32_t instance_id, trickle_evt_t event_type, uint32_t tx_evt_count) |
Callback function for notifying a Trickle timer instance of an event.
- Parameters
-
[in] | instance_id | Identifies the timer client instance from which the event originates from. |
[in] | event_type | Type of the event. |
[in] | tx_evt_count | Indicates how many times the instance generated a TRICKLE_EVT_DO_TX event. |
- Return values
-
Trickle event types.
Enumerator |
---|
TRICKLE_EVT_DO_TX |
Notifies the owner of the instance that it should transmit.
|
TRICKLE_EVT_TX_SKIPPED |
Generated at time t, if (c<k) was True before, but now it is False.
|
TRICKLE_EVT_IMAX_REACHED |
The current interval size (I) has reached the maximum interval size (i_max).
|
TRICKLE_EVT_DESTROYED |
The timer instance was destroyed.
|
Valid choices for t_min when creating a new Trickle instance.
Enumerator |
---|
TRICKLE_T_MIN_ZERO |
The transmission time t will be in the range of [0, I).
|
TRICKLE_T_MIN_HALF_I |
The transmission time t will be in the range of [(i/2), I).
|
uint32_t trickle_init |
( |
uint8_t |
rnd_seed | ) |
|
Function for initializing the Trickle timer module.
- Parameters
-
[in] | rnd_seed | Seed for the calculation a pseudo-random value for the interval and transmission times. |
- Return values
-
NRF_ERROR_NO_MEM | If TRICKLE_MAX_INSTANCES is equal to zero. |
NRF_ERROR_INVALID_STATE | If the module is already initialized. |
NRF_SUCCESS | On successful execution of procedure, else an error code indicating reason for failure. |
uint32_t trickle_instance_create |
( |
trickle_params_t * |
p_timer_params, |
|
|
uint32_t * |
p_instance_id |
|
) |
| |
Function for creating a Trickle timer instance.
Sets new Trickle timer instance parameters and starts the timer.
- Parameters
-
[in] | p_timer_params | Initialization structure for the timer instance. Should not be NULL . |
[out] | p_instance_id | Identifier of the new Trickle timer instance. |
- Return values
-
NRF_SUCCESS | On successful execution of procedure, else an error code indicating reason for failure. |
uint32_t trickle_instance_destroy |
( |
uint32_t |
instance_id | ) |
|
Function for destroying a timer instance and freeing the memory.
- Parameters
-
[in] | instance_id | Identifier of the Trickle timer instance. |
- Return values
-
NRF_SUCCESS | On successful execution of procedure, else an error code indicating reason for failure. |
uint32_t trickle_instance_reset |
( |
uint32_t |
instance_id | ) |
|
Function for resetting the timer instance.
- Parameters
-
[in] | instance_id | Identifier of the Trickle timer instance. |
- Return values
-
NRF_SUCCESS | On successful execution of procedure, else an error code indicating reason for failure. |
uint32_t trickle_rx_consistent_register |
( |
uint32_t |
instance_id | ) |
|
Function for registering a "consistent" reception with the timer instance.
- Parameters
-
[in] | instance_id | Identifier of the Trickle timer instance. |
- Return values
-
NRF_SUCCESS | On successful execution of procedure, else an error code indicating reason for failure. |
uint32_t trickle_terminate |
( |
void |
| ) |
|
Function for terminating the Trickle timer.
Stops timer (releases any resources), notifies and destroys all existing instances and stops.
- Return values
-
NRF_SUCCESS | On successful execution of procedure, else an error code indicating reason for failure. |