nRF5 SDK for Mesh v1.0.1
access_reliable.h
1 /* Copyright (c) 2010 - 2017, 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 
68 #define ACCESS_RELIABLE_TIMEOUT_MIN (SEC_TO_US(30))
69 
71 #define ACCESS_RELIABLE_TIMEOUT_MAX (SEC_TO_US(60))
72 
74 #define ACCESS_RELIABLE_HOP_PENALTY (MS_TO_US(BEARER_ADV_INT_DEFAULT_MS))
75 
77 #define ACCESS_RELIABLE_SEGMENT_COUNT_PENALTY MS_TO_US(BEARER_ADV_INT_DEFAULT_MS)
78 
83 #define ACCESS_RELIABLE_INTERVAL_DEFAULT (MS_TO_US(BEARER_ADV_INT_DEFAULT_MS) * 10)
84 
86 #define ACCESS_RELIABLE_BACK_OFF_FACTOR (2)
87 
89 #define ACCESS_RELIABLE_TIMEOUT_MARGIN (MS_TO_US(1))
90 
92 #define ACCESS_RELIABLE_RETRY_DELAY (MS_TO_US(BEARER_ADV_INT_DEFAULT_MS) * 2)
93 
103 typedef enum
104 {
113 
122 typedef void (*access_reliable_cb_t)(access_model_handle_t model_handle,
123  void * p_args,
124  access_reliable_status_t status);
125 
130 typedef struct
131 {
146  uint32_t timeout;
150 
156 void access_reliable_init(void);
157 
164 void access_reliable_cancel_all(void);
165 
180 uint32_t access_model_reliable_publish(const access_reliable_t * p_reliable);
181 
192 
200 void access_reliable_message_rx_cb(access_model_handle_t model_handle, const access_message_rx_t * p_message, void * p_args);
201 
203 #endif /* ACCESS_RELIABLE_H__ */
uint16_t access_model_handle_t
Access layer handle type.
Definition: access.h:155
void access_reliable_init(void)
Initializes the reliable publication framework.
uint32_t access_model_reliable_cancel(access_model_handle_t model_handle)
Cancels an ongoing reliable message.
access_reliable_status_t
Access reliable 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 reliable transfer reached its timeout.
Access layer opcode type.
Definition: access.h:180
Access layer reliable publish parameter structure.
uint32_t timeout
Relative reliable 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:219
The reliable 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 reliable message callback type.
uint32_t access_model_reliable_publish(const access_reliable_t *p_reliable)
Starts publishing a reliable message.
Access layer RX event structure.
Definition: access.h:206
access_opcode_t reply_opcode
Opcode of the expected reply.
access_reliable_cb_t status_cb
Callback to call after the reliable transfer has ended.

Documentation feedback | Developer Zone | Subscribe | Updated