nRF5 SDK for Mesh v5.0.0
nrf_mesh_prov_bearer.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 
38 #ifndef NRF_MESH_PROV_BEARER_H__
39 #define NRF_MESH_PROV_BEARER_H__
40 
41 #include <stdint.h>
42 #include "list.h"
43 
57 typedef enum
58 {
64 
66 typedef struct prov_bearer prov_bearer_t;
67 
82 typedef uint32_t (*prov_bearer_if_tx_t)(prov_bearer_t * p_bearer, const uint8_t * p_data, uint16_t length);
83 
93 typedef uint32_t (*prov_bearer_if_listen_start_t)(prov_bearer_t * p_bearer,
94  const char * p_uri,
95  uint16_t oob_info,
96  uint32_t link_timeout_us);
97 
103 typedef uint32_t (*prov_bearer_if_listen_stop_t)(prov_bearer_t * p_bearer);
104 
115 typedef uint32_t (*prov_bearer_if_link_open_t)(prov_bearer_t * p_bearer,
116  const uint8_t * p_uuid,
117  uint32_t link_timeout_us);
118 
126 typedef void (*prov_bearer_if_link_close_t)(prov_bearer_t * p_bearer,
127  nrf_mesh_prov_link_close_reason_t close_reason);
128 
132 typedef struct
133 {
145 
162 typedef void (*prov_bearer_cb_rx_t)(prov_bearer_t * p_bearer,
163  const uint8_t * p_data,
164  uint16_t length);
165 
171 typedef void (*prov_bearer_cb_ack_t)(prov_bearer_t * p_bearer);
172 
178 typedef void (*prov_bearer_cb_link_opened_t)(prov_bearer_t * p_bearer);
179 
186 typedef void (*prov_bearer_cb_link_closed_t)(prov_bearer_t * p_bearer,
188 
192 typedef struct
193 {
203 
204 /* @} end of PROV_BEARER_CALLBACKS */
205 
207 #define NRF_MESH_PROV_BEARER_COUNT (3)
208 
212 typedef enum
213 {
218 
225 {
226  list_node_t node;
230  void * p_parent;
231 };
232 
234 #endif
uint32_t(* prov_bearer_if_listen_stop_t)(prov_bearer_t *p_bearer)
Function used to stop listening for incoming provisioning links.
prov_bearer_if_listen_start_t listen_start
Function to start listening for incoming provisioning links.
Mesh-based provisioning bearer.
prov_bearer_cb_rx_t rx
The callback function for passing up all the incoming packets except the control packets.
GATT-based provisioning bearer, PB-GATT.
The link was closed beacuse of an error.
const prov_bearer_callbacks_t * p_callbacks
Provisioning bearer callbacks.
void(* prov_bearer_cb_rx_t)(prov_bearer_t *p_bearer, const uint8_t *p_data, uint16_t length)
Callback function type used when a provisioning packet has been received.
prov_bearer_if_link_open_t link_open
Function for opening a provisioning link.
const prov_bearer_interface_t * p_interface
Provisioning bearer interface.
prov_bearer_if_tx_t tx
Function for transmitting packets.
nrf_mesh_prov_link_close_reason_t
Reason for why a provisioning link was closed.
Advertising-based provisioning bearer, PB-ADV.
prov_bearer_if_link_close_t link_close
Function for closing a provisioning link.
void(* prov_bearer_cb_link_closed_t)(prov_bearer_t *p_bearer, nrf_mesh_prov_link_close_reason_t reason)
Callback function type used when a provisioning link has been closed.
The link timed out and was closed.
void(* prov_bearer_cb_link_opened_t)(prov_bearer_t *p_bearer)
Callback function type used when a provisioning link has been opened.
void(* prov_bearer_cb_ack_t)(prov_bearer_t *p_bearer)
Callback function type used when the previous provisioning packet has been acknowledged.
prov_bearer_if_listen_stop_t listen_stop
Function to stop listening for incoming provisioning links.
Struct defining the bearer callback functions.
The highest known link close reason, values higher are unrecognized.
The link was closed because provisioning was completed successfully.
void * p_parent
Pointer to the parent context structure.
Struct used to provide an interface to provisioning bearers.
prov_bearer_cb_link_opened_t opened
The callback function for notifying the users that a link has been opened.
list_node_t node
Linked-list node parameter.
uint32_t(* prov_bearer_if_tx_t)(prov_bearer_t *p_bearer, const uint8_t *p_data, uint16_t length)
Function used for transmitting a provisioning packet.
Provisioning bearer context.
nrf_mesh_prov_bearer_type_t bearer_type
Bearer type.
uint32_t(* prov_bearer_if_link_open_t)(prov_bearer_t *p_bearer, const uint8_t *p_uuid, uint32_t link_timeout_us)
Function used for opening a new provisioning link.
nrf_mesh_prov_bearer_type_t
Provisioning bearer types.
prov_bearer_cb_ack_t ack
The callback function for passing up all the incoming acknowledgments.
prov_bearer_cb_link_closed_t closed
The callback function for notifying the users that a link has been closed.
uint32_t(* prov_bearer_if_listen_start_t)(prov_bearer_t *p_bearer, const char *p_uri, uint16_t oob_info, uint32_t link_timeout_us)
Function used to start listening for incoming provisioning links.
void(* prov_bearer_if_link_close_t)(prov_bearer_t *p_bearer, nrf_mesh_prov_link_close_reason_t close_reason)
Function used for closing a provisioning link.

Documentation feedback | Developer Zone | Subscribe | Updated