xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/mesh/src/access.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /*  Bluetooth Mesh */
2 
3 /*
4  * Copyright (c) 2017 Intel Corporation
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 #ifndef __ACCESS_H__
10 #define __ACCESS_H__
11 
12 #include "mesh/mesh.h"
13 
14 /* bt_mesh_model.flags */
15 enum {
16 	BT_MESH_MOD_BIND_PENDING = BIT(0),
17 	BT_MESH_MOD_SUB_PENDING = BIT(1),
18 	BT_MESH_MOD_PUB_PENDING = BIT(2),
19 };
20 
21 void bt_mesh_elem_register(struct bt_mesh_elem *elem, u8_t count);
22 
23 u8_t bt_mesh_elem_count(void);
24 
25 /* Find local element based on unicast or group address */
26 struct bt_mesh_elem *bt_mesh_elem_find(u16_t addr);
27 
28 struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
29 					     u16_t company, u16_t id);
30 struct bt_mesh_model * bt_mesh_model_find(struct bt_mesh_elem *elem,
31 					  u16_t id);
32 
33 u16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, u16_t addr);
34 
35 bool bt_mesh_fixed_group_match(u16_t addr);
36 
37 void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
38 					struct bt_mesh_elem *elem,
39 					bool vnd, bool primary,
40 					void *user_data),
41 			   void *user_data);
42 
43 s32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod);
44 
45 void bt_mesh_comp_provision(u16_t addr);
46 void bt_mesh_comp_unprovision(void);
47 
48 u16_t bt_mesh_primary_addr(void);
49 
50 const struct bt_mesh_comp *bt_mesh_comp_get(void);
51 
52 struct bt_mesh_model *bt_mesh_model_get(bool vnd, u8_t elem_idx, u8_t mod_idx);
53 
54 void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
55 
56 int bt_mesh_comp_register(const struct bt_mesh_comp *comp);
57 #endif
58