1 /* Bluetooth Mesh */ 2 3 /* 4 * SPDX-FileCopyrightText: 2017 Intel Corporation 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #ifndef _LPN_H_ 10 #define _LPN_H_ 11 12 #include "net.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 int bt_mesh_lpn_friend_update(struct bt_mesh_net_rx *rx, 19 struct net_buf_simple *buf); 20 int bt_mesh_lpn_friend_offer(struct bt_mesh_net_rx *rx, 21 struct net_buf_simple *buf); 22 int bt_mesh_lpn_friend_clear_cfm(struct bt_mesh_net_rx *rx, 23 struct net_buf_simple *buf); 24 int bt_mesh_lpn_friend_sub_cfm(struct bt_mesh_net_rx *rx, 25 struct net_buf_simple *buf); 26 bt_mesh_lpn_established(void)27static inline bool bt_mesh_lpn_established(void) 28 { 29 #if defined(CONFIG_BLE_MESH_LOW_POWER) 30 return bt_mesh.lpn.established; 31 #else 32 return false; 33 #endif 34 } 35 bt_mesh_lpn_match(uint16_t addr)36static inline bool bt_mesh_lpn_match(uint16_t addr) 37 { 38 #if defined(CONFIG_BLE_MESH_LOW_POWER) 39 if (bt_mesh_lpn_established()) { 40 return (addr == bt_mesh.lpn.frnd); 41 } 42 #endif 43 return false; 44 } 45 bt_mesh_lpn_waiting_update(void)46static inline bool bt_mesh_lpn_waiting_update(void) 47 { 48 #if defined(CONFIG_BLE_MESH_LOW_POWER) 49 return (bt_mesh.lpn.state == BLE_MESH_LPN_WAIT_UPDATE); 50 #else 51 return false; 52 #endif 53 } 54 bt_mesh_lpn_timer(void)55static inline bool bt_mesh_lpn_timer(void) 56 { 57 #if defined(CONFIG_BLE_MESH_LPN_AUTO) 58 return (bt_mesh.lpn.state == BLE_MESH_LPN_TIMER); 59 #else 60 return false; 61 #endif 62 } 63 64 void bt_mesh_lpn_msg_received(struct bt_mesh_net_rx *rx); 65 66 void bt_mesh_lpn_group_add(uint16_t group); 67 void bt_mesh_lpn_group_del(uint16_t *groups, size_t group_count); 68 69 void bt_mesh_lpn_disable(bool force); 70 71 int bt_mesh_lpn_init(void); 72 int bt_mesh_lpn_deinit(void); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /* _LPN_H_ */ 79