nRF5 SDK for Mesh v5.0.0
mesh_friend.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 MESH_FRIEND_H__
39 #define MESH_FRIEND_H__
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 #include "mesh_friendship_types.h"
44 #include "friend_sublist.h"
45 #include "friend_queue.h"
46 #include "core_tx_friend.h"
47 
54 #define MESH_FRIEND_RECEIVE_WINDOW_MIN_MS (1)
55 
56 #define MESH_FRIEND_RECEIVE_WINDOW_MAX_MS (255)
57 
61 #define MESH_FRIEND_RECEIVE_WINDOW_DEFAULT_MS (5)
62 
63 
65 typedef struct
66 {
67  friend_queue_stats_t queue;
68  friend_sublist_stats_t sublist;
69  core_tx_friend_stats_t bearer;
71 
78 uint32_t mesh_friend_init(void);
79 
90 void mesh_friend_enable(void);
91 
97 void mesh_friend_disable(void);
98 
105 bool mesh_friend_is_enabled(void);
106 
121 uint32_t mesh_friend_friendship_terminate(const mesh_friendship_t * p_friendship);
122 
132 
146 uint32_t mesh_friend_receive_window_set(uint8_t receive_window_ms);
147 
166 uint32_t mesh_friend_friendships_get(const mesh_friendship_t ** pp_friendships, uint8_t * p_count);
167 
181 uint32_t mesh_friend_stats_get(const mesh_friendship_t * p_friendship, mesh_friend_stats_t * p_stats);
182 
185 #endif /* MESH_FRIEND_H__ */
core_tx_friend_stats_t bearer
Statistics for the Friend Bearer submodule.
Definition: mesh_friend.h:69
uint32_t mesh_friend_friendships_get(const mesh_friendship_t **pp_friendships, uint8_t *p_count)
Gets all the current active friendships.
uint32_t mesh_friend_friendship_terminate(const mesh_friendship_t *p_friendship)
Terminates the friendship with the given LPN.
uint32_t mesh_friend_friendship_terminate_all(void)
Terminates all active friendships.
bool mesh_friend_is_enabled(void)
Gets the state of the Friend feature.
Friendship statistics structure.
Definition: mesh_friend.h:65
uint32_t mesh_friend_stats_get(const mesh_friendship_t *p_friendship, mesh_friend_stats_t *p_stats)
Gets the structures of statistics for the given friendship.
void mesh_friend_disable(void)
Disables the Friend feature.
uint32_t mesh_friend_init(void)
Initializes the Friend feature.
void mesh_friend_enable(void)
Enables the Friend feature.
uint32_t mesh_friend_receive_window_set(uint8_t receive_window_ms)
Sets the receive window offered in the Friend Offer.
friend_sublist_stats_t sublist
Statistics for the Friend Subscription List submodule.
Definition: mesh_friend.h:68
friend_queue_stats_t queue
Statistics for the Friend Queue submodule.
Definition: mesh_friend.h:67

Documentation feedback | Developer Zone | Subscribe | Updated