nRF5 SDK for Mesh v5.0.0
access_reliable.h
1 /* Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form, except as embedded into a Nordic
11  * Semiconductor ASA integrated circuit in a product or a software update for
12  * such product, must reproduce the above copyright notice, this list of
13  * conditions and the following disclaimer in the documentation and/or other
14  * materials provided with the distribution.
15  *
16  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
17  * contributors may be used to endorse or promote products derived from this
18  * software without specific prior written permission.
19  *
20  * 4. This software, with or without modification, must only be used with a
21  * Nordic Semiconductor ASA integrated circuit.
22  *
23  * 5. Any software provided in binary form under this license must not be reverse
24  * engineered, decompiled, modified and/or disassembled.
25  *
26  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
30  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 #ifndef ACCESS_RELIABLE_H__
38 #define ACCESS_RELIABLE_H__
39 
40 #include <stdint.h>
41 #include "access.h"
42 
43 #include "utils.h"
44 #include "nrf_mesh_config_bearer.h"
45 
70 #define ACCESS_RELIABLE_TIMEOUT_MIN (SEC_TO_US(2))
71 
73 #define ACCESS_RELIABLE_TIMEOUT_MAX (SEC_TO_US(60))
74 
76 #define ACCESS_RELIABLE_HOP_PENALTY (MS_TO_US(BEARER_ADV_INT_DEFAULT_MS))
77 
79 #define ACCESS_RELIABLE_SEGMENT_COUNT_PENALTY MS_TO_US(BEARER_ADV_INT_DEFAULT_MS)
80 
85 #define ACCESS_RELIABLE_INTERVAL_DEFAULT (MS_TO_US(BEARER_ADV_INT_DEFAULT_MS) * 10)
86 
88 #define ACCESS_RELIABLE_BACK_OFF_FACTOR (2)
89 
91 #define ACCESS_RELIABLE_TIMEOUT_MARGIN (MS_TO_US(1))
92 
94 #define ACCESS_RELIABLE_RETRY_DELAY (MS_TO_US(BEARER_ADV_INT_DEFAULT_MS) * 2)
95 
105 typedef enum
106 {
117 
126 typedef void (*access_reliable_cb_t)(access_model_handle_t model_handle,
127  void * p_args,
128  access_reliable_status_t status);
129 
134 typedef struct
135 {
151  uint32_t timeout;
155 
161 void access_reliable_init(void);
162 
169 void access_reliable_cancel_all(void);
170 
189 uint32_t access_model_reliable_publish(const access_reliable_t * p_reliable);
190 
201 
209 void access_reliable_message_rx_cb(access_model_handle_t model_handle, const access_message_rx_t * p_message, void * p_args);
210 
220 
222 #endif /* ACCESS_RELIABLE_H__ */
uint16_t access_model_handle_t
Access layer handle type.
Definition: access.h:162
void access_reliable_init(void)
Initializes the acknowledged publication framework.
The acknowledged transfer has been cancelled.
uint32_t access_model_reliable_cancel(access_model_handle_t model_handle)
Cancels an ongoing acknowledged message.
access_reliable_status_t
Access acknowledged transfer status codes.
access_model_handle_t model_handle
Access layer model handle.
void access_reliable_message_rx_cb(access_model_handle_t model_handle, const access_message_rx_t *p_message, void *p_args)
Callback called by access layer when a model receives a message.
The acknowledged transfer reached its timeout.
Access layer opcode type.
Definition: access.h:187
Access layer acknowledged publish parameter structure.
uint32_t timeout
Relative acknowledged message timeout.
void access_reliable_cancel_all(void)
Cancels all ongoing transfers.
access_message_tx_t message
Access layer message.
Access layer TX parameter structure.
Definition: access.h:226
The acknowledged transfer was completed successfully.
void(* access_reliable_cb_t)(access_model_handle_t model_handle, void *p_args, access_reliable_status_t status)
Access layer acknowledged message callback type.
uint32_t access_model_reliable_publish(const access_reliable_t *p_reliable)
Starts publishing an acknowledged message.
Access layer RX event structure.
Definition: access.h:213
access_opcode_t reply_opcode
Opcode of the expected reply.
bool access_reliable_model_is_free(access_model_handle_t model_handle)
Checks if the model context for the given model handle is free for acknowledged message publishing...
access_reliable_cb_t status_cb
Callback to call after the acknowledged transfer has ended.

Documentation feedback | Developer Zone | Subscribe | Updated