xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/host/mesh/include/mesh/cfg_srv.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /** @file
2  *  @brief Bluetooth Mesh Configuration Server Model APIs.
3  */
4 
5 /*
6  * Copyright (c) 2017 Intel Corporation
7  *
8  * SPDX-License-Identifier: Apache-2.0
9  */
10 #ifndef __BT_MESH_CFG_SRV_H
11 #define __BT_MESH_CFG_SRV_H
12 
13 /**
14  * @brief Bluetooth Mesh
15  * @defgroup bt_mesh_cfg_srv Bluetooth Mesh Configuration Server Model
16  * @ingroup bt_mesh
17  * @{
18  */
19 
20 /** Mesh Configuration Server Model Context */
21 struct bt_mesh_cfg_srv {
22 	struct bt_mesh_model *model;
23 
24 	u8_t net_transmit;         /* Network Transmit state */
25 	u8_t relay;                /* Relay Mode state */
26 	u8_t relay_retransmit;     /* Relay Retransmit state */
27 	u8_t beacon;               /* Secure Network Beacon state */
28 	u8_t gatt_proxy;           /* GATT Proxy state */
29 	u8_t frnd;                 /* Friend state */
30 	u8_t default_ttl;          /* Default TTL */
31 
32 	/* Heartbeat Publication */
33 	struct bt_mesh_hb_pub {
34 		struct k_delayed_work timer;
35 
36 		u16_t dst;
37 		u16_t count;
38 		u8_t  period;
39 		u8_t  ttl;
40 		u16_t feat;
41 		u16_t net_idx;
42 	} hb_pub;
43 
44 	/* Heartbeat Subscription */
45 	struct bt_mesh_hb_sub {
46 		s64_t  expiry;
47 
48 		u16_t src;
49 		u16_t dst;
50 		u16_t count;
51 		u8_t  min_hops;
52 		u8_t  max_hops;
53 
54 		/* Optional subscription tracking function */
55 		void (*func)(u8_t hops, u16_t feat);
56 	} hb_sub;
57 };
58 
59 extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[];
60 
61 #define BT_MESH_MODEL_CFG_SRV(srv_data)                                      \
62 		BT_MESH_MODEL(BT_MESH_MODEL_ID_CFG_SRV,                      \
63 			      bt_mesh_cfg_srv_op, NULL, srv_data)
64 
65 
66 /**
67  * @}
68  */
69 
70 #endif /* __BT_MESH_CFG_SRV_H */
71