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 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 /** Mesh Configuration Server Model Context */ 25 struct bt_mesh_cfg_srv { 26 struct bt_mesh_model *model; 27 28 u8_t net_transmit; /* Network Transmit state */ 29 u8_t relay; /* Relay Mode state */ 30 u8_t relay_retransmit; /* Relay Retransmit state */ 31 u8_t beacon; /* Secure Network Beacon state */ 32 u8_t gatt_proxy; /* GATT Proxy state */ 33 u8_t frnd; /* Friend state */ 34 u8_t default_ttl; /* Default TTL */ 35 36 /* Heartbeat Publication */ 37 struct bt_mesh_hb_pub { 38 struct k_delayed_work timer; 39 40 u16_t dst; 41 u16_t count; 42 u8_t period; 43 u8_t ttl; 44 u16_t feat; 45 u16_t net_idx; 46 } hb_pub; 47 48 /* Heartbeat Subscription */ 49 struct bt_mesh_hb_sub { 50 s64_t expiry; 51 52 u16_t src; 53 u16_t dst; 54 u16_t count; 55 u8_t min_hops; 56 u8_t max_hops; 57 58 /* Optional subscription tracking function */ 59 void (*func)(u8_t hops, u16_t feat); 60 } hb_sub; 61 }; 62 #ifdef CONFIG_BT_MESH_EVENT_CALLBACK 63 typedef struct { 64 uint8_t status; 65 uint16_t netkey_idx; 66 uint16_t appkey_idx; 67 }appkey_status; 68 #endif 69 70 71 extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[]; 72 extern struct bt_mesh_cfg_srv g_cfg_srv; 73 74 #define BT_MESH_MODEL_CFG_SRV(srv_data) \ 75 BT_MESH_MODEL(BT_MESH_MODEL_ID_CFG_SRV, \ 76 bt_mesh_cfg_srv_op, NULL, srv_data) 77 78 #define MESH_MODEL_CFG_SRV_NULL() BT_MESH_MODEL_CFG_SRV(&g_cfg_srv) 79 80 u8_t bt_mesh_mod_bind(struct bt_mesh_model *model, u16_t key_idx); 81 u8_t bt_mesh_mod_sub_add(struct bt_mesh_model *model, u16_t sub_addr); 82 u8_t bt_mesh_mod_pub_set(struct bt_mesh_model *model, u16_t pub_addr); 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 /** 89 * @} 90 */ 91 92 #endif /* __BT_MESH_CFG_SRV_H */ 93