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