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 _BLE_MESH_CFG_SRV_H_ 11 #define _BLE_MESH_CFG_SRV_H_ 12 13 #include "mesh_access.h" 14 15 /** 16 * @brief Bluetooth Mesh 17 * @defgroup bt_mesh_cfg_srv Bluetooth Mesh Configuration Server Model 18 * @ingroup bt_mesh 19 * @{ 20 */ 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** Mesh Configuration Server Model Context */ 27 struct bt_mesh_cfg_srv { 28 struct bt_mesh_model *model; 29 30 uint8_t net_transmit; /* Network Transmit state */ 31 uint8_t relay; /* Relay Mode state */ 32 uint8_t relay_retransmit; /* Relay Retransmit state */ 33 uint8_t beacon; /* Secure Network Beacon state */ 34 uint8_t gatt_proxy; /* GATT Proxy state */ 35 uint8_t frnd; /* Friend state */ 36 uint8_t default_ttl; /* Default TTL */ 37 38 /* Heartbeat Publication */ 39 struct bt_mesh_hb_pub { 40 struct k_delayed_work timer; 41 42 uint16_t dst; 43 uint16_t count; 44 uint8_t period; 45 uint8_t ttl; 46 uint16_t feat; 47 uint16_t net_idx; 48 } hb_pub; 49 50 /* Heartbeat Subscription */ 51 struct bt_mesh_hb_sub { 52 int64_t expiry; 53 54 uint16_t src; 55 uint16_t dst; 56 uint16_t count; 57 uint8_t min_hops; 58 uint8_t max_hops; 59 60 /* Optional subscription tracking function */ 61 void (*func)(uint8_t hops, uint16_t feat); 62 } hb_sub; 63 }; 64 65 extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[]; 66 extern const struct bt_mesh_model_cb bt_mesh_cfg_srv_cb; 67 68 #define BLE_MESH_MODEL_CFG_SRV(srv_data) \ 69 BLE_MESH_MODEL_CB(BLE_MESH_MODEL_ID_CFG_SRV, \ 70 bt_mesh_cfg_srv_op, NULL, srv_data, &bt_mesh_cfg_srv_cb) 71 72 typedef union { 73 struct { 74 uint8_t beacon; 75 } cfg_beacon_set; 76 struct { 77 uint8_t ttl; 78 } cfg_default_ttl_set; 79 struct { 80 uint8_t gatt_proxy; 81 } cfg_gatt_proxy_set; 82 struct { 83 uint8_t relay; 84 uint8_t retransmit; 85 } cfg_relay_set; 86 struct { 87 uint16_t elem_addr; 88 uint16_t pub_addr; 89 uint16_t app_idx; 90 bool cred_flag; 91 uint8_t ttl; 92 uint8_t period; 93 uint8_t transmit; 94 uint16_t cid; 95 uint16_t mod_id; 96 } cfg_mod_pub_set; 97 struct { 98 uint16_t elem_addr; 99 uint8_t pub_addr[16]; 100 uint16_t app_idx; 101 bool cred_flag; 102 uint8_t ttl; 103 uint8_t period; 104 uint8_t transmit; 105 uint16_t cid; 106 uint16_t mod_id; 107 } cfg_mod_pub_va_set; 108 struct { 109 uint16_t elem_addr; 110 uint16_t sub_addr; 111 uint16_t cid; 112 uint16_t mod_id; 113 } cfg_mod_sub_add; 114 struct { 115 uint16_t elem_addr; 116 uint8_t sub_addr[16]; 117 uint16_t cid; 118 uint16_t mod_id; 119 } cfg_mod_sub_va_add; 120 struct { 121 uint16_t elem_addr; 122 uint16_t sub_addr; 123 uint16_t cid; 124 uint16_t mod_id; 125 } cfg_mod_sub_delete; 126 struct { 127 uint16_t elem_addr; 128 uint8_t sub_addr[16]; 129 uint16_t cid; 130 uint16_t mod_id; 131 } cfg_mod_sub_va_delete; 132 struct { 133 uint16_t elem_addr; 134 uint16_t sub_addr; 135 uint16_t cid; 136 uint16_t mod_id; 137 } cfg_mod_sub_overwrite; 138 struct { 139 uint16_t elem_addr; 140 uint8_t sub_addr[16]; 141 uint16_t cid; 142 uint16_t mod_id; 143 } cfg_mod_sub_va_overwrite; 144 struct { 145 uint16_t elem_addr; 146 uint16_t cid; 147 uint16_t mod_id; 148 } cfg_mod_sub_delete_all; 149 struct { 150 uint16_t net_idx; 151 uint8_t net_key[16]; 152 } cfg_netkey_add; 153 struct { 154 uint16_t net_idx; 155 uint8_t net_key[16]; 156 } cfg_netkey_update; 157 struct { 158 uint16_t net_idx; 159 } cfg_netkey_delete; 160 struct { 161 uint16_t net_idx; 162 uint16_t app_idx; 163 uint8_t app_key[16]; 164 } cfg_appkey_add; 165 struct { 166 uint16_t net_idx; 167 uint16_t app_idx; 168 uint8_t app_key[16]; 169 } cfg_appkey_update; 170 struct { 171 uint16_t net_idx; 172 uint16_t app_idx; 173 } cfg_appkey_delete; 174 struct { 175 uint16_t net_idx; 176 uint8_t identity; 177 } cfg_node_identity_set; 178 struct { 179 uint16_t elem_addr; 180 uint16_t app_idx; 181 uint16_t cid; 182 uint16_t mod_id; 183 } cfg_mod_app_bind; 184 struct { 185 uint16_t elem_addr; 186 uint16_t app_idx; 187 uint16_t cid; 188 uint16_t mod_id; 189 } cfg_mod_app_unbind; 190 struct { 191 uint8_t frnd; 192 } cfg_friend_set; 193 struct { 194 uint16_t net_idx; 195 uint8_t kr_phase; 196 } cfg_kr_phase_set; 197 struct { 198 uint16_t dst; 199 uint8_t count; 200 uint8_t period; 201 uint8_t ttl; 202 uint16_t feat; 203 uint16_t net_idx; 204 } cfg_hb_pub_set; 205 struct { 206 uint16_t src; 207 uint16_t dst; 208 uint8_t period; 209 } cfg_hb_sub_set; 210 struct { 211 uint8_t transmit; 212 } cfg_net_transmit_set; 213 } bt_mesh_cfg_server_state_change_t; 214 215 #ifdef __cplusplus 216 } 217 #endif 218 219 /** 220 * @} 221 */ 222 223 #endif /* __BLE_MESH_CFG_SRV_H */ 224