1 /*
2  * Copyright (c) 2017 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx,
8 			      struct net_buf_simple *buf);
9 int bt_mesh_lpn_friend_offer(struct bt_mesh_net_rx *rx,
10 			     struct net_buf_simple *buf);
11 int bt_mesh_lpn_friend_clear_cfm(struct bt_mesh_net_rx *rx,
12 				 struct net_buf_simple *buf);
13 int bt_mesh_lpn_friend_sub_cfm(struct bt_mesh_net_rx *rx,
14 			       struct net_buf_simple *buf);
15 
bt_mesh_lpn_established(void)16 static inline bool bt_mesh_lpn_established(void)
17 {
18 #if defined(CONFIG_BT_MESH_LOW_POWER)
19 	return bt_mesh.lpn.established;
20 #else
21 	return false;
22 #endif
23 }
24 
bt_mesh_lpn_match(uint16_t addr)25 static inline bool bt_mesh_lpn_match(uint16_t addr)
26 {
27 #if defined(CONFIG_BT_MESH_LOW_POWER)
28 	if (bt_mesh_lpn_established()) {
29 		return (addr == bt_mesh.lpn.frnd);
30 	}
31 #endif
32 	return false;
33 }
34 
bt_mesh_lpn_waiting_update(void)35 static inline bool bt_mesh_lpn_waiting_update(void)
36 {
37 #if defined(CONFIG_BT_MESH_LOW_POWER)
38 	return (bt_mesh.lpn.state == BT_MESH_LPN_WAIT_UPDATE);
39 #else
40 	return false;
41 #endif
42 }
43 
44 
45 void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx);
46 
47 void bt_mesh_lpn_group_add(uint16_t group);
48 void bt_mesh_lpn_group_del(const uint16_t *groups, size_t group_count);
49 
50 void bt_mesh_lpn_disable(bool force);
51 void bt_mesh_lpn_friendship_end(void);
52 
53 int bt_mesh_lpn_init(void);
54