esp_ble_mesh_defs.h
1 // Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef _ESP_BLE_MESH_DEFS_H_ 16 #define _ESP_BLE_MESH_DEFS_H_ 17 18 #include <stdint.h> 19 20 #include "mesh_config.h" 21 #include "mesh_common.h" 22 #include "proxy_server.h" 23 #include "provisioner_main.h" 24 25 #ifdef CONFIG_BT_BLUEDROID_ENABLED 26 #include "esp_bt_defs.h" 27 #include "esp_bt_main.h" 28 #define ESP_BLE_HOST_STATUS_ENABLED ESP_BLUEDROID_STATUS_ENABLED 29 #define ESP_BLE_HOST_STATUS_CHECK(status) ESP_BLUEDROID_STATUS_CHECK(status) 30 #else 31 #define ESP_BLE_HOST_STATUS_ENABLED 0 32 #define ESP_BLE_HOST_STATUS_CHECK(status) do {} while (0) 33 #endif 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /*!< The maximum length of a BLE Mesh message, including Opcode, Payload and TransMIC */ 40 #define ESP_BLE_MESH_SDU_MAX_LEN 384 41 42 /*!< Length of a short Mesh MIC. */ 43 #define ESP_BLE_MESH_MIC_SHORT 4 44 45 /*!< Length of a long Mesh MIC. */ 46 #define ESP_BLE_MESH_MIC_LONG 8 47 48 /*!< The maximum length of a BLE Mesh provisioned node name */ 49 #define ESP_BLE_MESH_NODE_NAME_MAX_LEN 31 50 51 /*!< The maximum length of a BLE Mesh unprovisioned device name */ 52 #define ESP_BLE_MESH_DEVICE_NAME_MAX_LEN DEVICE_NAME_SIZE 53 54 /*!< Define the BLE Mesh octet 16 bytes size */ 55 #define ESP_BLE_MESH_OCTET16_LEN 16 56 typedef uint8_t esp_ble_mesh_octet16_t[ESP_BLE_MESH_OCTET16_LEN]; 57 58 /*!< Define the BLE Mesh octet 8 bytes size */ 59 #define ESP_BLE_MESH_OCTET8_LEN 8 60 typedef uint8_t esp_ble_mesh_octet8_t[ESP_BLE_MESH_OCTET8_LEN]; 61 62 /*!< Invalid Company ID */ 63 #define ESP_BLE_MESH_CID_NVAL 0xFFFF 64 65 /*!< Special TTL value to request using configured default TTL */ 66 #define ESP_BLE_MESH_TTL_DEFAULT 0xFF 67 68 /*!< Maximum allowed TTL value */ 69 #define ESP_BLE_MESH_TTL_MAX 0x7F 70 71 #define ESP_BLE_MESH_ADDR_UNASSIGNED 0x0000 72 #define ESP_BLE_MESH_ADDR_ALL_NODES 0xFFFF 73 #define ESP_BLE_MESH_ADDR_PROXIES 0xFFFC 74 #define ESP_BLE_MESH_ADDR_FRIENDS 0xFFFD 75 #define ESP_BLE_MESH_ADDR_RELAYS 0xFFFE 76 77 #define ESP_BLE_MESH_KEY_UNUSED 0xFFFF 78 #define ESP_BLE_MESH_KEY_DEV 0xFFFE 79 80 #define ESP_BLE_MESH_KEY_PRIMARY 0x0000 81 #define ESP_BLE_MESH_KEY_ANY 0xFFFF 82 83 /*!< Primary Network Key index */ 84 #define ESP_BLE_MESH_NET_PRIMARY 0x000 85 86 /*!< Relay state value */ 87 #define ESP_BLE_MESH_RELAY_DISABLED 0x00 88 #define ESP_BLE_MESH_RELAY_ENABLED 0x01 89 #define ESP_BLE_MESH_RELAY_NOT_SUPPORTED 0x02 90 91 /*!< Beacon state value */ 92 #define ESP_BLE_MESH_BEACON_DISABLED 0x00 93 #define ESP_BLE_MESH_BEACON_ENABLED 0x01 94 95 /*!< GATT Proxy state value */ 96 #define ESP_BLE_MESH_GATT_PROXY_DISABLED 0x00 97 #define ESP_BLE_MESH_GATT_PROXY_ENABLED 0x01 98 #define ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED 0x02 99 100 /*!< Friend state value */ 101 #define ESP_BLE_MESH_FRIEND_DISABLED 0x00 102 #define ESP_BLE_MESH_FRIEND_ENABLED 0x01 103 #define ESP_BLE_MESH_FRIEND_NOT_SUPPORTED 0x02 104 105 /*!< Node identity state value */ 106 #define ESP_BLE_MESH_NODE_IDENTITY_STOPPED 0x00 107 #define ESP_BLE_MESH_NODE_IDENTITY_RUNNING 0x01 108 #define ESP_BLE_MESH_NODE_IDENTITY_NOT_SUPPORTED 0x02 109 110 /*!< Supported features */ 111 #define ESP_BLE_MESH_FEATURE_RELAY BIT(0) 112 #define ESP_BLE_MESH_FEATURE_PROXY BIT(1) 113 #define ESP_BLE_MESH_FEATURE_FRIEND BIT(2) 114 #define ESP_BLE_MESH_FEATURE_LOW_POWER BIT(3) 115 #define ESP_BLE_MESH_FEATURE_ALL_SUPPORTED (ESP_BLE_MESH_FEATURE_RELAY | \ 116 ESP_BLE_MESH_FEATURE_PROXY | \ 117 ESP_BLE_MESH_FEATURE_FRIEND | \ 118 ESP_BLE_MESH_FEATURE_LOW_POWER) 119 120 #define ESP_BLE_MESH_ADDR_IS_UNICAST(addr) ((addr) && (addr) < 0x8000) 121 #define ESP_BLE_MESH_ADDR_IS_GROUP(addr) ((addr) >= 0xC000 && (addr) <= 0xFF00) 122 #define ESP_BLE_MESH_ADDR_IS_VIRTUAL(addr) ((addr) >= 0x8000 && (addr) < 0xC000) 123 #define ESP_BLE_MESH_ADDR_IS_RFU(addr) ((addr) >= 0xFF00 && (addr) <= 0xFFFB) 124 125 #define ESP_BLE_MESH_INVALID_NODE_INDEX 0xFFFF 126 127 /** @def ESP_BLE_MESH_TRANSMIT 128 * 129 * @brief Encode transmission count & interval steps. 130 * 131 * @note For example, ESP_BLE_MESH_TRANSMIT(2, 20) means that the message 132 * will be sent about 90ms(count is 3, step is 1, interval is 30 ms 133 * which includes 10ms of advertising interval random delay). 134 * 135 * @param count Number of retransmissions (first transmission is excluded). 136 * @param int_ms Interval steps in milliseconds. Must be greater than 0 137 * and a multiple of 10. 138 * 139 * @return BLE Mesh transmit value that can be used e.g. for the default 140 * values of the Configuration Model data. 141 */ 142 #define ESP_BLE_MESH_TRANSMIT(count, int_ms) ((count) | (((int_ms / 10) - 1) << 3)) 143 144 /** @def ESP_BLE_MESH_GET_TRANSMIT_COUNT 145 * 146 * @brief Decode transmit count from a transmit value. 147 * 148 * @param transmit Encoded transmit count & interval value. 149 * 150 * @return Transmission count (actual transmissions equal to N + 1). 151 */ 152 #define ESP_BLE_MESH_GET_TRANSMIT_COUNT(transmit) (((transmit) & (uint8_t)BIT_MASK(3))) 153 154 /** @def ESP_BLE_MESH_GET_TRANSMIT_INTERVAL 155 * 156 * @brief Decode transmit interval from a transmit value. 157 * 158 * @param transmit Encoded transmit count & interval value. 159 * 160 * @return Transmission interval in milliseconds. 161 */ 162 #define ESP_BLE_MESH_GET_TRANSMIT_INTERVAL(transmit) ((((transmit) >> 3) + 1) * 10) 163 164 /** @def ESP_BLE_MESH_PUBLISH_TRANSMIT 165 * 166 * @brief Encode Publish Retransmit count & interval steps. 167 * 168 * @param count Number of retransmissions (first transmission is excluded). 169 * @param int_ms Interval steps in milliseconds. Must be greater than 0 170 * and a multiple of 50. 171 * 172 * @return BLE Mesh transmit value that can be used e.g. for the default 173 * values of the Configuration Model data. 174 */ 175 #define ESP_BLE_MESH_PUBLISH_TRANSMIT(count, int_ms) ESP_BLE_MESH_TRANSMIT(count, (int_ms) / 5) 176 177 /** @def ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_COUNT 178 * 179 * @brief Decode Publish Retransmit count from a given value. 180 * 181 * @param transmit Encoded Publish Retransmit count & interval value. 182 * 183 * @return Retransmission count (actual transmissions equal to N + 1). 184 */ 185 #define ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_COUNT(transmit) ESP_BLE_MESH_GET_TRANSMIT_COUNT(transmit) 186 187 /** @def ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_INTERVAL 188 * 189 * @brief Decode Publish Retransmit interval from a given value. 190 * 191 * @param transmit Encoded Publish Retransmit count & interval value. 192 * 193 * @return Transmission interval in milliseconds. 194 */ 195 #define ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_INTERVAL(transmit) ((((transmit) >> 3) + 1) * 50) 196 197 /*!< Callbacks which are not needed to be initialized by users (set with 0 and will be initialized internally) */ 198 typedef uint32_t esp_ble_mesh_cb_t; 199 200 typedef enum { 201 ESP_BLE_MESH_TYPE_PROV_CB, 202 ESP_BLE_MESH_TYPE_OUTPUT_NUM_CB, 203 ESP_BLE_MESH_TYPE_OUTPUT_STR_CB, 204 ESP_BLE_MESH_TYPE_INTPUT_CB, 205 ESP_BLE_MESH_TYPE_LINK_OPEN_CB, 206 ESP_BLE_MESH_TYPE_LINK_CLOSE_CB, 207 ESP_BLE_MESH_TYPE_COMPLETE_CB, 208 ESP_BLE_MESH_TYPE_RESET_CB, 209 } esp_ble_mesh_cb_type_t; 210 211 /*!< This enum value is provisioning authentication oob method */ 212 typedef enum { 213 ESP_BLE_MESH_NO_OOB, 214 ESP_BLE_MESH_STATIC_OOB, 215 ESP_BLE_MESH_OUTPUT_OOB, 216 ESP_BLE_MESH_INPUT_OOB, 217 } esp_ble_mesh_oob_method_t; 218 219 /*!< This enum value is associated with bt_mesh_output_action_t in mesh_main.h */ 220 typedef enum { 221 ESP_BLE_MESH_NO_OUTPUT = 0, 222 ESP_BLE_MESH_BLINK = BIT(0), 223 ESP_BLE_MESH_BEEP = BIT(1), 224 ESP_BLE_MESH_VIBRATE = BIT(2), 225 ESP_BLE_MESH_DISPLAY_NUMBER = BIT(3), 226 ESP_BLE_MESH_DISPLAY_STRING = BIT(4), 227 } esp_ble_mesh_output_action_t; 228 229 /*!< This enum value is associated with bt_mesh_input_action_t in mesh_main.h */ 230 typedef enum { 231 ESP_BLE_MESH_NO_INPUT = 0, 232 ESP_BLE_MESH_PUSH = BIT(0), 233 ESP_BLE_MESH_TWIST = BIT(1), 234 ESP_BLE_MESH_ENTER_NUMBER = BIT(2), 235 ESP_BLE_MESH_ENTER_STRING = BIT(3), 236 } esp_ble_mesh_input_action_t; 237 238 /*!< This enum value is associated with bt_mesh_prov_bearer_t in mesh_main.h */ 239 typedef enum { 240 ESP_BLE_MESH_PROV_ADV = BIT(0), 241 ESP_BLE_MESH_PROV_GATT = BIT(1), 242 } esp_ble_mesh_prov_bearer_t; 243 244 /*!< This enum value is associated with bt_mesh_prov_oob_info_t in mesh_main.h */ 245 typedef enum { 246 ESP_BLE_MESH_PROV_OOB_OTHER = BIT(0), 247 ESP_BLE_MESH_PROV_OOB_URI = BIT(1), 248 ESP_BLE_MESH_PROV_OOB_2D_CODE = BIT(2), 249 ESP_BLE_MESH_PROV_OOB_BAR_CODE = BIT(3), 250 ESP_BLE_MESH_PROV_OOB_NFC = BIT(4), 251 ESP_BLE_MESH_PROV_OOB_NUMBER = BIT(5), 252 ESP_BLE_MESH_PROV_OOB_STRING = BIT(6), 253 /* 7 - 10 are reserved */ 254 ESP_BLE_MESH_PROV_OOB_ON_BOX = BIT(11), 255 ESP_BLE_MESH_PROV_OOB_IN_BOX = BIT(12), 256 ESP_BLE_MESH_PROV_OOB_ON_PAPER = BIT(13), 257 ESP_BLE_MESH_PROV_OOB_IN_MANUAL = BIT(14), 258 ESP_BLE_MESH_PROV_OOB_ON_DEV = BIT(15), 259 } esp_ble_mesh_prov_oob_info_t; 260 261 /*!< Maximum length of value used by Static OOB authentication */ 262 #define ESP_BLE_MESH_PROV_STATIC_OOB_MAX_LEN 16 263 264 /*!< Maximum length of string used by Output OOB authentication */ 265 #define ESP_BLE_MESH_PROV_OUTPUT_OOB_MAX_LEN 8 266 267 /*!< Maximum length of string used by Output OOB authentication */ 268 #define ESP_BLE_MESH_PROV_INPUT_OOB_MAX_LEN 8 269 270 /*!< Macros used to define message opcode */ 271 #define ESP_BLE_MESH_MODEL_OP_1(b0) (b0) 272 #define ESP_BLE_MESH_MODEL_OP_2(b0, b1) (((b0) << 8) | (b1)) 273 #define ESP_BLE_MESH_MODEL_OP_3(b0, cid) ((((b0) << 16) | 0xC00000) | (cid)) 274 275 /*!< This macro is associated with BLE_MESH_MODEL_CB in mesh_access.h */ 276 #define ESP_BLE_MESH_SIG_MODEL(_id, _op, _pub, _user_data) \ 277 { \ 278 .model_id = (_id), \ 279 .op = _op, \ 280 .keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \ 281 ESP_BLE_MESH_KEY_UNUSED }, \ 282 .pub = _pub, \ 283 .groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \ 284 ESP_BLE_MESH_ADDR_UNASSIGNED }, \ 285 .user_data = _user_data, \ 286 } 287 288 /*!< This macro is associated with BLE_MESH_MODEL_VND_CB in mesh_access.h */ 289 #define ESP_BLE_MESH_VENDOR_MODEL(_company, _id, _op, _pub, _user_data) \ 290 { \ 291 .vnd.company_id = (_company), \ 292 .vnd.model_id = (_id), \ 293 .op = _op, \ 294 .pub = _pub, \ 295 .keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \ 296 ESP_BLE_MESH_KEY_UNUSED }, \ 297 .groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \ 298 ESP_BLE_MESH_ADDR_UNASSIGNED }, \ 299 .user_data = _user_data, \ 300 } 301 302 /** @brief Helper to define a BLE Mesh element within an array. 303 * 304 * In case the element has no SIG or Vendor models, the helper 305 * macro ESP_BLE_MESH_MODEL_NONE can be given instead. 306 * 307 * @note This macro is associated with BLE_MESH_ELEM in mesh_access.h 308 * 309 * @param _loc Location Descriptor. 310 * @param _mods Array of SIG models. 311 * @param _vnd_mods Array of vendor models. 312 */ 313 #define ESP_BLE_MESH_ELEMENT(_loc, _mods, _vnd_mods) \ 314 { \ 315 .location = (_loc), \ 316 .sig_model_count = ARRAY_SIZE(_mods), \ 317 .sig_models = (_mods), \ 318 .vnd_model_count = ARRAY_SIZE(_vnd_mods), \ 319 .vnd_models = (_vnd_mods), \ 320 } 321 322 #define ESP_BLE_MESH_PROV(uuid, sta_val, sta_val_len, out_size, out_act, in_size, in_act) { \ 323 .uuid = uuid, \ 324 .static_val = sta_val, \ 325 .static_val_len = sta_val_len, \ 326 .output_size = out_size, \ 327 .output_action = out_act, \ 328 .input_size = in_size, \ 329 .input_action = in_act, \ 330 } 331 332 typedef uint8_t UINT8; 333 typedef uint16_t UINT16; 334 typedef uint32_t UINT32; 335 typedef uint64_t UINT64; 336 337 #define BT_OCTET32_LEN 32 338 typedef UINT8 BT_OCTET32[BT_OCTET32_LEN]; /* octet array: size 32 */ 339 340 341 #ifndef BD_ADDR_LEN 342 #define BD_ADDR_LEN 6 343 typedef uint8_t BD_ADDR[BD_ADDR_LEN]; 344 #endif 345 346 typedef uint8_t esp_ble_mesh_bd_addr_t[BD_ADDR_LEN]; 347 348 #define ESP_BLE_MESH_ADDR_TYPE_PUBLIC 0x00 349 #define ESP_BLE_MESH_ADDR_TYPE_RANDOM 0x01 350 #define ESP_BLE_MESH_ADDR_TYPE_RPA_PUBLIC 0x02 351 #define ESP_BLE_MESH_ADDR_TYPE_RPA_RANDOM 0x03 352 /// BLE device address type 353 typedef uint8_t esp_ble_mesh_addr_type_t; 354 355 /** BLE Mesh deinit parameters */ 356 typedef struct { 357 bool erase_flash; /*!< Indicate if erasing flash when deinit mesh stack */ 358 } esp_ble_mesh_deinit_param_t; 359 360 typedef struct esp_ble_mesh_model esp_ble_mesh_model_t; 361 362 /** Abstraction that describes a BLE Mesh Element. 363 * This structure is associated with struct bt_mesh_elem in mesh_access.h 364 */ 365 typedef struct { 366 /** Element Address, assigned during provisioning. */ 367 uint16_t element_addr; 368 369 /** Location Descriptor (GATT Bluetooth Namespace Descriptors) */ 370 const uint16_t location; 371 372 const uint8_t sig_model_count; /*!< SIG Model count */ 373 const uint8_t vnd_model_count; /*!< Vendor Model count */ 374 375 esp_ble_mesh_model_t *sig_models; /*!< SIG Models */ 376 esp_ble_mesh_model_t *vnd_models; /*!< Vendor Models */ 377 } esp_ble_mesh_elem_t; 378 379 /** Abstraction that describes a model publication context. 380 * This structure is associated with struct bt_mesh_model_pub in mesh_access.h 381 */ 382 typedef struct { 383 /** Pointer to the model to which the context belongs. Initialized by the stack. */ 384 esp_ble_mesh_model_t *model; 385 386 uint16_t publish_addr; /*!< Publish Address. */ 387 uint16_t app_idx:12, /*!< Publish AppKey Index. */ 388 cred:1, /*!< Friendship Credentials Flag. */ 389 send_rel:1; /*!< Force reliable sending (segment acks) */ 390 391 uint8_t ttl; /*!< Publish Time to Live. */ 392 uint8_t retransmit; /*!< Retransmit Count & Interval Steps. */ 393 394 uint8_t period; /*!< Publish Period. */ 395 uint8_t period_div:4, /*!< Divisor for the Period. */ 396 fast_period:1, /*!< Use FastPeriodDivisor */ 397 count:3; /*!< Retransmissions left. */ 398 399 uint32_t period_start; /*!< Start of the current period. */ 400 401 /** @brief Publication buffer, containing the publication message. 402 * 403 * This will get correctly created when the publication context 404 * has been defined using the ESP_BLE_MESH_MODEL_PUB_DEFINE macro. 405 * 406 * ESP_BLE_MESH_MODEL_PUB_DEFINE(name, size); 407 */ 408 struct net_buf_simple *msg; 409 410 /** Callback used to update publish message. Initialized by the stack. */ 411 esp_ble_mesh_cb_t update; 412 413 /** Publish Period Timer. Initialized by the stack. */ 414 struct k_delayed_work timer; 415 416 /** Role of the device that is going to publish messages */ 417 uint8_t dev_role; 418 } esp_ble_mesh_model_pub_t; 419 420 /** @def ESP_BLE_MESH_MODEL_PUB_DEFINE 421 * 422 * Define a model publication context. 423 * 424 * @param _name Variable name given to the context. 425 * @param _msg_len Length of the publication message. 426 * @param _role Role of the device which contains the model. 427 */ 428 #define ESP_BLE_MESH_MODEL_PUB_DEFINE(_name, _msg_len, _role) \ 429 NET_BUF_SIMPLE_DEFINE_STATIC(bt_mesh_pub_msg_##_name, _msg_len); \ 430 static esp_ble_mesh_model_pub_t _name = { \ 431 .update = (uint32_t)NULL, \ 432 .msg = &bt_mesh_pub_msg_##_name, \ 433 .dev_role = _role, \ 434 } 435 436 /** @def ESP_BLE_MESH_MODEL_OP 437 * 438 * Define a model operation context. 439 * 440 * @param _opcode Message opcode. 441 * @param _min_len Message minimum length. 442 */ 443 #define ESP_BLE_MESH_MODEL_OP(_opcode, _min_len) \ 444 { \ 445 .opcode = _opcode, \ 446 .min_len = _min_len, \ 447 .param_cb = (uint32_t)NULL, \ 448 } 449 450 /** Abstraction that describes a model operation context. 451 * This structure is associated with struct bt_mesh_model_op in mesh_access.h 452 */ 453 typedef struct { 454 const uint32_t opcode; /*!< Message opcode */ 455 const size_t min_len; /*!< Message minimum length */ 456 esp_ble_mesh_cb_t param_cb; /*!< Callback used to handle message. Initialized by the stack. */ 457 } esp_ble_mesh_model_op_t; 458 459 /** Define the terminator for the model operation table. 460 * Each model operation struct array must use this terminator as 461 * the end tag of the operation unit. 462 */ 463 #define ESP_BLE_MESH_MODEL_OP_END {0, 0, 0} 464 465 /** Abstraction that describes a model callback structure. 466 * This structure is associated with struct bt_mesh_model_cb in mesh_access.h. 467 */ 468 typedef struct { 469 /** Callback used during model initialization. Initialized by the stack. */ 470 esp_ble_mesh_cb_t init_cb; 471 472 #if CONFIG_BLE_MESH_DEINIT 473 /** Callback used during model deinitialization. Initialized by the stack. */ 474 esp_ble_mesh_cb_t deinit_cb; 475 #endif /* CONFIG_BLE_MESH_DEINIT */ 476 } esp_ble_mesh_model_cbs_t; 477 478 /** Abstraction that describes a Mesh Model instance. 479 * This structure is associated with struct bt_mesh_model in mesh_access.h 480 */ 481 struct esp_ble_mesh_model { 482 /** Model ID */ 483 union { 484 const uint16_t model_id; /*!< 16-bit model identifier */ 485 struct { 486 uint16_t company_id; /*!< 16-bit company identifier */ 487 uint16_t model_id; /*!< 16-bit model identifier */ 488 } vnd; /*!< Structure encapsulating a model ID with a company ID */ 489 }; 490 491 /** Internal information, mainly for persistent storage */ 492 uint8_t element_idx; /*!< Belongs to Nth element */ 493 uint8_t model_idx; /*!< Is the Nth model in the element */ 494 uint16_t flags; /*!< Information about what has changed */ 495 496 /** The Element to which this Model belongs */ 497 esp_ble_mesh_elem_t *element; 498 499 /** Model Publication */ 500 esp_ble_mesh_model_pub_t *const pub; 501 502 /** AppKey List */ 503 uint16_t keys[CONFIG_BLE_MESH_MODEL_KEY_COUNT]; 504 505 /** Subscription List (group or virtual addresses) */ 506 uint16_t groups[CONFIG_BLE_MESH_MODEL_GROUP_COUNT]; 507 508 /** Model operation context */ 509 esp_ble_mesh_model_op_t *op; 510 511 /** Model callback structure */ 512 esp_ble_mesh_model_cbs_t *cb; 513 514 /** Model-specific user data */ 515 void *user_data; 516 }; 517 518 /** Helper to define an empty model array. 519 * This structure is associated with BLE_MESH_MODEL_NONE in mesh_access.h 520 */ 521 #define ESP_BLE_MESH_MODEL_NONE ((esp_ble_mesh_model_t []){}) 522 523 /** Message sending context. 524 * This structure is associated with struct bt_mesh_msg_ctx in mesh_access.h 525 */ 526 typedef struct { 527 /** NetKey Index of the subnet through which to send the message. */ 528 uint16_t net_idx; 529 530 /** AppKey Index for message encryption. */ 531 uint16_t app_idx; 532 533 /** Remote address. */ 534 uint16_t addr; 535 536 /** Destination address of a received message. Not used for sending. */ 537 uint16_t recv_dst; 538 539 /** RSSI of received packet. Not used for sending. */ 540 int8_t recv_rssi; 541 542 /** Received TTL value. Not used for sending. */ 543 uint8_t recv_ttl: 7; 544 545 /** Force sending reliably by using segment acknowledgement */ 546 uint8_t send_rel: 1; 547 548 /** TTL, or ESP_BLE_MESH_TTL_DEFAULT for default TTL. */ 549 uint8_t send_ttl; 550 551 /** Opcode of a received message. Not used for sending message. */ 552 uint32_t recv_op; 553 554 /** Model corresponding to the message, no need to be initialized before sending message */ 555 esp_ble_mesh_model_t *model; 556 557 /** Indicate if the message is sent by a node server model, no need to be initialized before sending message */ 558 bool srv_send; 559 } esp_ble_mesh_msg_ctx_t; 560 561 /** Provisioning properties & capabilities. 562 * This structure is associated with struct bt_mesh_prov in mesh_access.h 563 */ 564 typedef struct { 565 #if CONFIG_BLE_MESH_NODE 566 /** The UUID that is used when advertising as an unprovisioned device */ 567 const uint8_t *uuid; 568 569 /** Optional URI. This will be advertised separately from the 570 * unprovisioned beacon, however the unprovisioned beacon will 571 * contain a hash of it so the two can be associated by the 572 * provisioner. 573 */ 574 const char *uri; 575 576 /** Out of Band information field. */ 577 esp_ble_mesh_prov_oob_info_t oob_info; 578 579 /** Flag indicates whether unprovisioned devices support OOB public key */ 580 bool oob_pub_key; 581 582 /** Callback used to notify to set OOB Public Key. Initialized by the stack. */ 583 esp_ble_mesh_cb_t oob_pub_key_cb; 584 585 /** Static OOB value */ 586 const uint8_t *static_val; 587 /** Static OOB value length */ 588 uint8_t static_val_len; 589 590 /** Maximum size of Output OOB supported */ 591 uint8_t output_size; 592 /** Supported Output OOB Actions */ 593 uint16_t output_actions; 594 595 /** Maximum size of Input OOB supported */ 596 uint8_t input_size; 597 /** Supported Input OOB Actions */ 598 uint16_t input_actions; 599 600 /** Callback used to output the number. Initialized by the stack. */ 601 esp_ble_mesh_cb_t output_num_cb; 602 /** Callback used to output the string. Initialized by the stack. */ 603 esp_ble_mesh_cb_t output_str_cb; 604 /** Callback used to notify to input number/string. Initialized by the stack. */ 605 esp_ble_mesh_cb_t input_cb; 606 /** Callback used to indicate that link is opened. Initialized by the stack. */ 607 esp_ble_mesh_cb_t link_open_cb; 608 /** Callback used to indicate that link is closed. Initialized by the stack. */ 609 esp_ble_mesh_cb_t link_close_cb; 610 /** Callback used to indicate that provisioning is completed. Initialized by the stack. */ 611 esp_ble_mesh_cb_t complete_cb; 612 /** Callback used to indicate that node has been reset. Initialized by the stack. */ 613 esp_ble_mesh_cb_t reset_cb; 614 #endif /* CONFIG_BLE_MESH_NODE */ 615 616 #ifdef CONFIG_BLE_MESH_PROVISIONER 617 /** Provisioner device UUID */ 618 const uint8_t *prov_uuid; 619 620 /** Primary element address of the provisioner */ 621 const uint16_t prov_unicast_addr; 622 623 /** Pre-incremental unicast address value to be assigned to the first device */ 624 uint16_t prov_start_address; 625 626 /** Attention timer contained in Provisioning Invite PDU */ 627 uint8_t prov_attention; 628 629 /** Provisioning Algorithm for the Provisioner */ 630 uint8_t prov_algorithm; 631 632 /** Provisioner public key oob */ 633 uint8_t prov_pub_key_oob; 634 635 /** Callback used to notify to set device OOB Public Key. Initialized by the stack. */ 636 esp_ble_mesh_cb_t provisioner_prov_read_oob_pub_key; 637 638 /** Provisioner static oob value */ 639 uint8_t *prov_static_oob_val; 640 /** Provisioner static oob value length */ 641 uint8_t prov_static_oob_len; 642 643 /** Callback used to notify to input number/string. Initialized by the stack. */ 644 esp_ble_mesh_cb_t provisioner_prov_input; 645 /** Callback used to output number/string. Initialized by the stack. */ 646 esp_ble_mesh_cb_t provisioner_prov_output; 647 648 /** Key refresh and IV update flag */ 649 uint8_t flags; 650 651 /** IV index */ 652 uint32_t iv_index; 653 654 /** Callback used to indicate that link is opened. Initialized by the stack. */ 655 esp_ble_mesh_cb_t provisioner_link_open; 656 /** Callback used to indicate that link is closed. Initialized by the stack. */ 657 esp_ble_mesh_cb_t provisioner_link_close; 658 /** Callback used to indicate that a device is provisioned. Initialized by the stack. */ 659 esp_ble_mesh_cb_t provisioner_prov_comp; 660 #endif /* CONFIG_BLE_MESH_PROVISIONER */ 661 } esp_ble_mesh_prov_t; 662 663 /** Node Composition data context. 664 * This structure is associated with struct bt_mesh_comp in mesh_access.h 665 */ 666 typedef struct { 667 uint16_t cid; /*!< 16-bit SIG-assigned company identifier */ 668 uint16_t pid; /*!< 16-bit vendor-assigned product identifier */ 669 uint16_t vid; /*!< 16-bit vendor-assigned product version identifier */ 670 671 size_t element_count; /*!< Element count */ 672 esp_ble_mesh_elem_t *elements; /*!< A sequence of elements */ 673 } esp_ble_mesh_comp_t; 674 675 /*!< This enum value is the role of the device */ 676 typedef enum { 677 ROLE_NODE = 0, 678 ROLE_PROVISIONER, 679 ROLE_FAST_PROV, 680 } esp_ble_mesh_dev_role_t; 681 682 /*!< Flag which will be set when device is going to be added. */ 683 typedef uint8_t esp_ble_mesh_dev_add_flag_t; 684 #define ADD_DEV_RM_AFTER_PROV_FLAG BIT(0) /*!< Device will be removed from queue after provisioned successfully */ 685 #define ADD_DEV_START_PROV_NOW_FLAG BIT(1) /*!< Start provisioning device immediately */ 686 #define ADD_DEV_FLUSHABLE_DEV_FLAG BIT(2) /*!< Device can be remove when queue is full and new device is going to added */ 687 688 /** Information of the device which is going to be added for provisioning. */ 689 typedef struct { 690 esp_ble_mesh_bd_addr_t addr; /*!< Device address */ 691 esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */ 692 uint8_t uuid[16]; /*!< Device UUID */ 693 uint16_t oob_info; /*!< Device OOB Info */ 694 /*!< ADD_DEV_START_PROV_NOW_FLAG shall not be set if the bearer has both PB-ADV and PB-GATT enabled */ 695 esp_ble_mesh_prov_bearer_t bearer; /*!< Provisioning Bearer */ 696 } esp_ble_mesh_unprov_dev_add_t; 697 698 #define DEL_DEV_ADDR_FLAG BIT(0) 699 #define DEL_DEV_UUID_FLAG BIT(1) 700 /** Information of the device which is going to be deleted. */ 701 typedef struct { 702 union { 703 struct { 704 esp_ble_mesh_bd_addr_t addr; /*!< Device address */ 705 esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */ 706 }; 707 uint8_t uuid[16]; /*!< Device UUID */ 708 }; 709 uint8_t flag; /*!< BIT0: device address; BIT1: device UUID */ 710 } esp_ble_mesh_device_delete_t; 711 712 #define PROV_DATA_NET_IDX_FLAG BIT(0) 713 #define PROV_DATA_FLAGS_FLAG BIT(1) 714 #define PROV_DATA_IV_INDEX_FLAG BIT(2) 715 /** Information of the provisioner which is going to be updated. */ 716 typedef struct { 717 union { 718 uint16_t net_idx; /*!< NetKey Index */ 719 uint8_t flags; /*!< Flags */ 720 uint32_t iv_index; /*!< IV Index */ 721 }; 722 uint8_t flag; /*!< BIT0: net_idx; BIT1: flags; BIT2: iv_index */ 723 } esp_ble_mesh_prov_data_info_t; 724 725 /** Information of the provisioned node */ 726 typedef struct { 727 /* Device information */ 728 esp_ble_mesh_bd_addr_t addr; /*!< Node device address */ 729 esp_ble_mesh_addr_type_t addr_type; /*!< Node device address type */ 730 uint8_t dev_uuid[16]; /*!< Device UUID */ 731 uint16_t oob_info; /*!< Node OOB information */ 732 733 /* Provisioning information */ 734 uint16_t unicast_addr; /*!< Node unicast address */ 735 uint8_t element_num; /*!< Node element number */ 736 uint16_t net_idx; /*!< Node NetKey Index */ 737 uint8_t flags; /*!< Node key refresh flag and iv update flag */ 738 uint32_t iv_index; /*!< Node IV Index */ 739 uint8_t dev_key[16]; /*!< Node device key */ 740 741 /* Additional information */ 742 char name[ESP_BLE_MESH_NODE_NAME_MAX_LEN + 1]; /*!< Node name */ 743 uint16_t comp_length; /*!< Length of Composition Data */ 744 uint8_t *comp_data; /*!< Value of Composition Data */ 745 } __attribute__((packed)) esp_ble_mesh_node_t; 746 747 /** Context of fast provisioning which need to be set. */ 748 typedef struct { 749 uint16_t unicast_min; /*!< Minimum unicast address used for fast provisioning */ 750 uint16_t unicast_max; /*!< Maximum unicast address used for fast provisioning */ 751 uint16_t net_idx; /*!< Netkey index used for fast provisioning */ 752 uint8_t flags; /*!< Flags used for fast provisioning */ 753 uint32_t iv_index; /*!< IV Index used for fast provisioning */ 754 uint8_t offset; /*!< Offset of the UUID to be compared */ 755 uint8_t match_len; /*!< Length of the UUID to be compared */ 756 uint8_t match_val[16]; /*!< Value of UUID to be compared */ 757 } esp_ble_mesh_fast_prov_info_t; 758 759 /*!< This enum value is the action of fast provisioning */ 760 typedef enum { 761 FAST_PROV_ACT_NONE, 762 FAST_PROV_ACT_ENTER, 763 FAST_PROV_ACT_SUSPEND, 764 FAST_PROV_ACT_EXIT, 765 FAST_PROV_ACT_MAX, 766 } esp_ble_mesh_fast_prov_action_t; 767 768 /*!< This enum value is the type of proxy filter */ 769 typedef enum { 770 PROXY_FILTER_WHITELIST, 771 PROXY_FILTER_BLACKLIST, 772 } esp_ble_mesh_proxy_filter_type_t; 773 774 /** Count for sending BLE advertising packet infinitely */ 775 #define ESP_BLE_MESH_BLE_ADV_INFINITE 0xFFFF 776 777 /*!< This enum value is the priority of BLE advertising packet */ 778 typedef enum { 779 ESP_BLE_MESH_BLE_ADV_PRIO_LOW, 780 ESP_BLE_MESH_BLE_ADV_PRIO_HIGH, 781 } esp_ble_mesh_ble_adv_priority_t; 782 783 /** Context of BLE advertising parameters. */ 784 typedef struct { 785 uint16_t interval; /*!< BLE advertising interval */ 786 uint8_t adv_type; /*!< BLE advertising type */ 787 uint8_t own_addr_type; /*!< Own address type */ 788 uint8_t peer_addr_type; /*!< Peer address type */ 789 uint8_t peer_addr[BD_ADDR_LEN]; /*!< Peer address */ 790 uint16_t duration; /*!< Duration is milliseconds */ 791 uint16_t period; /*!< Period in milliseconds */ 792 uint16_t count; /*!< Number of advertising duration */ 793 uint8_t priority:2; /*!< Priority of BLE advertising packet */ 794 } esp_ble_mesh_ble_adv_param_t; 795 796 /** Context of BLE advertising data. */ 797 typedef struct { 798 uint8_t adv_data_len; /*!< Advertising data length */ 799 uint8_t adv_data[31]; /*!< Advertising data */ 800 uint8_t scan_rsp_data_len; /*!< Scan response data length */ 801 uint8_t scan_rsp_data[31]; /*!< Scan response data */ 802 } esp_ble_mesh_ble_adv_data_t; 803 804 /*!< This enum value is the event of node/provisioner/fast provisioning */ 805 typedef enum { 806 ESP_BLE_MESH_PROV_REGISTER_COMP_EVT, /*!< Initialize BLE Mesh provisioning capabilities and internal data information completion event */ 807 ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT, /*!< Set the unprovisioned device name completion event */ 808 ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT, /*!< Enable node provisioning functionality completion event */ 809 ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT, /*!< Disable node provisioning functionality completion event */ 810 ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT, /*!< Establish a BLE Mesh link event */ 811 ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT, /*!< Close a BLE Mesh link event */ 812 ESP_BLE_MESH_NODE_PROV_OOB_PUB_KEY_EVT, /*!< Generate Node input OOB public key event */ 813 ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT, /*!< Generate Node Output Number event */ 814 ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT, /*!< Generate Node Output String event */ 815 ESP_BLE_MESH_NODE_PROV_INPUT_EVT, /*!< Event requiring the user to input a number or string */ 816 ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT, /*!< Provisioning done event */ 817 ESP_BLE_MESH_NODE_PROV_RESET_EVT, /*!< Provisioning reset event */ 818 ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT, /*!< Node set oob public key completion event */ 819 ESP_BLE_MESH_NODE_PROV_INPUT_NUMBER_COMP_EVT, /*!< Node input number completion event */ 820 ESP_BLE_MESH_NODE_PROV_INPUT_STRING_COMP_EVT, /*!< Node input string completion event */ 821 ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT, /*!< Enable BLE Mesh Proxy Identity advertising completion event */ 822 ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT, /*!< Enable BLE Mesh GATT Proxy Service completion event */ 823 ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT, /*!< Disable BLE Mesh GATT Proxy Service completion event */ 824 ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT, /*!< Provisioner enable provisioning functionality completion event */ 825 ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT, /*!< Provisioner disable provisioning functionality completion event */ 826 ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT, /*!< Provisioner receives unprovisioned device beacon event */ 827 ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT, /*!< Provisioner read unprovisioned device OOB public key event */ 828 ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT, /*!< Provisioner input value for provisioning procedure event */ 829 ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT, /*!< Provisioner output value for provisioning procedure event */ 830 ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT, /*!< Provisioner establish a BLE Mesh link event */ 831 ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT, /*!< Provisioner close a BLE Mesh link event */ 832 ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT, /*!< Provisioner provisioning done event */ 833 ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT, /*!< Provisioner add a device to the list which contains devices that are waiting/going to be provisioned completion event */ 834 ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT, /*!< Provisioner start to provision an unprovisioned device completion event */ 835 ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT, /*!< Provisioner delete a device from the list, close provisioning link with the device completion event */ 836 ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT, /*!< Provisioner set the value to be compared with part of the unprovisioned device UUID completion event */ 837 ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT, /*!< Provisioner set net_idx/flags/iv_index used for provisioning completion event */ 838 ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT, /*!< Provisioner set static oob value used for provisioning completion event */ 839 ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT, /*!< Provisioner set unicast address of primary element completion event */ 840 ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT, /*!< Provisioner read unprovisioned device OOB public key completion event */ 841 ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT, /*!< Provisioner input number completion event */ 842 ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT, /*!< Provisioner input string completion event */ 843 ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT, /*!< Provisioner set node name completion event */ 844 ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT, /*!< Provisioner add local app key completion event */ 845 ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT, /*!< Provisioner update local app key completion event */ 846 ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT, /*!< Provisioner bind local model with local app key completion event */ 847 ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT, /*!< Provisioner add local network key completion event */ 848 ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT, /*!< Provisioner update local network key completion event */ 849 ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT, /*!< Provisioner store node composition data completion event */ 850 ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT, /*!< Provisioner delete node with uuid completion event */ 851 ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT, /*!< Provisioner delete node with unicast address completion event */ 852 ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT, /*!< Set fast provisioning information (e.g. unicast address range, net_idx, etc.) completion event */ 853 ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT, /*!< Set fast provisioning action completion event */ 854 ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT, /*!< Receive Heartbeat message event */ 855 ESP_BLE_MESH_LPN_ENABLE_COMP_EVT, /*!< Enable Low Power Node completion event */ 856 ESP_BLE_MESH_LPN_DISABLE_COMP_EVT, /*!< Disable Low Power Node completion event */ 857 ESP_BLE_MESH_LPN_POLL_COMP_EVT, /*!< Low Power Node send Friend Poll completion event */ 858 ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT, /*!< Low Power Node establishes friendship event */ 859 ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT, /*!< Low Power Node terminates friendship event */ 860 ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT, /*!< Friend Node establishes friendship event */ 861 ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT, /*!< Friend Node terminates friendship event */ 862 ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT, /*!< Proxy Client receives Network ID advertising packet event */ 863 ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT, /*!< Proxy Client establishes connection successfully event */ 864 ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT, /*!< Proxy Client terminates connection successfully event */ 865 ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT, /*!< Proxy Client receives Proxy Filter Status event */ 866 ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT, /*!< Proxy Client connect completion event */ 867 ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT, /*!< Proxy Client disconnect completion event */ 868 ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT, /*!< Proxy Client set filter type completion event */ 869 ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT, /*!< Proxy Client add filter address completion event */ 870 ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT, /*!< Proxy Client remove filter address completion event */ 871 ESP_BLE_MESH_START_BLE_ADVERTISING_COMP_EVT, /*!< Start BLE advertising completion event */ 872 ESP_BLE_MESH_STOP_BLE_ADVERTISING_COMP_EVT, /*!< Stop BLE advertising completion event */ 873 ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model subscribes group address completion event */ 874 ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model unsubscribes group address completion event */ 875 ESP_BLE_MESH_DEINIT_MESH_COMP_EVT, /*!< De-initialize BLE Mesh stack completion event */ 876 ESP_BLE_MESH_PROV_EVT_MAX, 877 } esp_ble_mesh_prov_cb_event_t; 878 879 /** 880 * @brief BLE Mesh Node/Provisioner callback parameters union 881 */ 882 typedef union { 883 /** 884 * @brief ESP_BLE_MESH_PROV_REGISTER_COMP_EVT 885 */ 886 struct ble_mesh_prov_register_comp_param { 887 int err_code; /*!< Indicate the result of BLE Mesh initialization */ 888 } prov_register_comp; /*!< Event parameter of ESP_BLE_MESH_PROV_REGISTER_COMP_EVT */ 889 /** 890 * @brief ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT 891 */ 892 struct ble_mesh_set_unprov_dev_name_comp_param { 893 int err_code; /*!< Indicate the result of setting BLE Mesh device name */ 894 } node_set_unprov_dev_name_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT */ 895 /** 896 * @brief ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT 897 */ 898 struct ble_mesh_prov_enable_comp_param { 899 int err_code; /*!< Indicate the result of enabling BLE Mesh device */ 900 } node_prov_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT */ 901 /** 902 * @brief ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT 903 */ 904 struct ble_mesh_prov_disable_comp_param { 905 int err_code; /*!< Indicate the result of disabling BLE Mesh device */ 906 } node_prov_disable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT */ 907 /** 908 * @brief ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT 909 */ 910 struct ble_mesh_link_open_evt_param { 911 esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when device link is open */ 912 } node_prov_link_open; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT */ 913 /** 914 * @brief ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT 915 */ 916 struct ble_mesh_link_close_evt_param { 917 esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when device link is closed */ 918 } node_prov_link_close; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT */ 919 /** 920 * @brief ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT 921 */ 922 struct ble_mesh_output_num_evt_param { 923 esp_ble_mesh_output_action_t action; /*!< Action of Output OOB Authentication */ 924 uint32_t number; /*!< Number of Output OOB Authentication */ 925 } node_prov_output_num; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT */ 926 /** 927 * @brief ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT 928 */ 929 struct ble_mesh_output_str_evt_param { 930 char string[8]; /*!< String of Output OOB Authentication */ 931 } node_prov_output_str; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT */ 932 /** 933 * @brief ESP_BLE_MESH_NODE_PROV_INPUT_EVT 934 */ 935 struct ble_mesh_input_evt_param { 936 esp_ble_mesh_input_action_t action; /*!< Action of Input OOB Authentication */ 937 uint8_t size; /*!< Size of Input OOB Authentication */ 938 } node_prov_input; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_EVT */ 939 /** 940 * @brief ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT 941 */ 942 struct ble_mesh_provision_complete_evt_param { 943 uint16_t net_idx; /*!< NetKey Index */ 944 uint8_t net_key[16]; /*!< NetKey */ 945 uint16_t addr; /*!< Primary address */ 946 uint8_t flags; /*!< Flags */ 947 uint32_t iv_index; /*!< IV Index */ 948 } node_prov_complete; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT */ 949 /** 950 * @brief ESP_BLE_MESH_NODE_PROV_RESET_EVT 951 */ 952 struct ble_mesh_provision_reset_param { 953 954 } node_prov_reset; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_RESET_EVT */ 955 /** 956 * @brief ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT 957 */ 958 struct ble_mesh_set_oob_pub_key_comp_param { 959 int err_code; /*!< Indicate the result of setting OOB Public Key */ 960 } node_prov_set_oob_pub_key_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT */ 961 /** 962 * @brief ESP_BLE_MESH_NODE_PROV_INPUT_NUM_COMP_EVT 963 */ 964 struct ble_mesh_input_number_comp_param { 965 int err_code; /*!< Indicate the result of inputting number */ 966 } node_prov_input_num_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_NUM_COMP_EVT */ 967 /** 968 * @brief ESP_BLE_MESH_NODE_PROV_INPUT_STR_COMP_EVT 969 */ 970 struct ble_mesh_input_string_comp_param { 971 int err_code; /*!< Indicate the result of inputting string */ 972 } node_prov_input_str_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_STR_COMP_EVT */ 973 /** 974 * @brief ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT 975 */ 976 struct ble_mesh_proxy_identity_enable_comp_param { 977 int err_code; /*!< Indicate the result of enabling Mesh Proxy advertising */ 978 } node_proxy_identity_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT */ 979 /** 980 * @brief ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT 981 */ 982 struct ble_mesh_proxy_gatt_enable_comp_param { 983 int err_code; /*!< Indicate the result of enabling Mesh Proxy Service */ 984 } node_proxy_gatt_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT */ 985 /** 986 * @brief ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT 987 */ 988 struct ble_mesh_proxy_gatt_disable_comp_param { 989 int err_code; /*!< Indicate the result of disabling Mesh Proxy Service */ 990 } node_proxy_gatt_disable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT */ 991 /** 992 * @brief ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT 993 */ 994 struct ble_mesh_provisioner_recv_unprov_adv_pkt_param { 995 uint8_t dev_uuid[16]; /*!< Device UUID of the unprovisioned device */ 996 esp_ble_mesh_bd_addr_t addr; /*!< Device address of the unprovisioned device */ 997 esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */ 998 uint16_t oob_info; /*!< OOB Info of the unprovisioned device */ 999 uint8_t adv_type; /*!< Avertising type of the unprovisioned device */ 1000 esp_ble_mesh_prov_bearer_t bearer; /*!< Bearer of the unprovisioned device */ 1001 int8_t rssi; /*!< RSSI of the received advertising packet */ 1002 } provisioner_recv_unprov_adv_pkt; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT */ 1003 /** 1004 * @brief ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT 1005 */ 1006 struct ble_mesh_provisioner_prov_enable_comp_param { 1007 int err_code; /*!< Indicate the result of enabling BLE Mesh Provisioner */ 1008 } provisioner_prov_enable_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT */ 1009 /** 1010 * @brief ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT 1011 */ 1012 struct ble_mesh_provisioner_prov_disable_comp_param { 1013 int err_code; /*!< Indicate the result of disabling BLE Mesh Provisioner */ 1014 } provisioner_prov_disable_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT */ 1015 /** 1016 * @brief ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT 1017 */ 1018 struct ble_mesh_provisioner_link_open_evt_param { 1019 esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when Provisioner link is opened */ 1020 } provisioner_prov_link_open; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT */ 1021 /** 1022 * @brief ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT 1023 */ 1024 struct ble_mesh_provisioner_prov_read_oob_pub_key_evt_param { 1025 uint8_t link_idx; /*!< Index of the provisioning link */ 1026 } provisioner_prov_read_oob_pub_key; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT */ 1027 /** 1028 * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT 1029 */ 1030 struct ble_mesh_provisioner_prov_input_evt_param { 1031 esp_ble_mesh_oob_method_t method; /*!< Method of device Output OOB Authentication */ 1032 esp_ble_mesh_output_action_t action; /*!< Action of device Output OOB Authentication */ 1033 uint8_t size; /*!< Size of device Output OOB Authentication */ 1034 uint8_t link_idx; /*!< Index of the provisioning link */ 1035 } provisioner_prov_input; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT */ 1036 /** 1037 * @brief ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT 1038 */ 1039 struct ble_mesh_provisioner_prov_output_evt_param { 1040 esp_ble_mesh_oob_method_t method; /*!< Method of device Input OOB Authentication */ 1041 esp_ble_mesh_input_action_t action; /*!< Action of device Input OOB Authentication */ 1042 uint8_t size; /*!< Size of device Input OOB Authentication */ 1043 uint8_t link_idx; /*!< Index of the provisioning link */ 1044 union { 1045 char string[8]; /*!< String output by the Provisioner */ 1046 uint32_t number; /*!< Number output by the Provisioner */ 1047 }; 1048 } provisioner_prov_output; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT */ 1049 /** 1050 * @brief ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT 1051 */ 1052 struct ble_mesh_provisioner_link_close_evt_param { 1053 esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when Provisioner link is closed */ 1054 uint8_t reason; /*!< Reason of the closed provisioning link */ 1055 } provisioner_prov_link_close; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT */ 1056 /** 1057 * @brief ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT 1058 */ 1059 struct ble_mesh_provisioner_prov_comp_param { 1060 uint16_t node_idx; /*!< Index of the provisioned device */ 1061 esp_ble_mesh_octet16_t device_uuid; /*!< Device UUID of the provisioned device */ 1062 uint16_t unicast_addr; /*!< Primary address of the provisioned device */ 1063 uint8_t element_num; /*!< Element count of the provisioned device */ 1064 uint16_t netkey_idx; /*!< NetKey Index of the provisioned device */ 1065 } provisioner_prov_complete; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT */ 1066 /** 1067 * @brief ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT 1068 */ 1069 struct ble_mesh_provisioner_add_unprov_dev_comp_param { 1070 int err_code; /*!< Indicate the result of adding device into queue by the Provisioner */ 1071 } provisioner_add_unprov_dev_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT */ 1072 /** 1073 * @brief ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT 1074 */ 1075 struct ble_mesh_provisioner_prov_dev_with_addr_comp_param { 1076 int err_code; /*!< Indicate the result of Provisioner starting to provision a device */ 1077 } provisioner_prov_dev_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT */ 1078 /** 1079 * @brief ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT 1080 */ 1081 struct ble_mesh_provisioner_delete_dev_comp_param { 1082 int err_code; /*!< Indicate the result of deleting device by the Provisioner */ 1083 } provisioner_delete_dev_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT */ 1084 /** 1085 * @brief ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT 1086 */ 1087 struct ble_mesh_provisioner_set_dev_uuid_match_comp_param { 1088 int err_code; /*!< Indicate the result of setting Device UUID match value by the Provisioner */ 1089 } provisioner_set_dev_uuid_match_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT */ 1090 /** 1091 * @brief ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT 1092 */ 1093 struct ble_mesh_provisioner_set_prov_data_info_comp_param { 1094 int err_code; /*!< Indicate the result of setting provisioning info by the Provisioner */ 1095 } provisioner_set_prov_data_info_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT */ 1096 /** 1097 * @brief ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT 1098 */ 1099 struct ble_mesh_provisioner_set_static_oob_val_comp_param { 1100 int err_code; /*!< Indicate the result of setting static oob value by the Provisioner */ 1101 } provisioner_set_static_oob_val_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT */ 1102 /** 1103 * @brief ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT 1104 */ 1105 struct ble_mesh_provisioner_set_primary_elem_addr_comp_param { 1106 int err_code; /*!< Indicate the result of setting unicast address of primary element by the Provisioner */ 1107 } provisioner_set_primary_elem_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT */ 1108 /** 1109 * @brief ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT 1110 */ 1111 struct ble_mesh_provisioner_prov_read_oob_pub_key_comp_param { 1112 int err_code; /*!< Indicate the result of setting OOB Public Key by the Provisioner */ 1113 } provisioner_prov_read_oob_pub_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT */ 1114 /** 1115 * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT 1116 */ 1117 struct ble_mesh_provisioner_prov_input_num_comp_param { 1118 int err_code; /*!< Indicate the result of inputting number by the Provisioner */ 1119 } provisioner_prov_input_num_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT */ 1120 /** 1121 * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT 1122 */ 1123 struct ble_mesh_provisioner_prov_input_str_comp_param { 1124 int err_code; /*!< Indicate the result of inputting string by the Provisioner */ 1125 } provisioner_prov_input_str_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT */ 1126 /** 1127 * @brief ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT 1128 */ 1129 struct ble_mesh_provisioner_set_node_name_comp_param { 1130 int err_code; /*!< Indicate the result of setting provisioned device name by the Provisioner */ 1131 uint16_t node_index; /*!< Index of the provisioned device */ 1132 } provisioner_set_node_name_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT */ 1133 /** 1134 * @brief ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT 1135 */ 1136 struct ble_mesh_provisioner_add_local_app_key_comp_param { 1137 int err_code; /*!< Indicate the result of adding local AppKey by the Provisioner */ 1138 uint16_t net_idx; /*!< NetKey Index */ 1139 uint16_t app_idx; /*!< AppKey Index */ 1140 } provisioner_add_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT */ 1141 /** 1142 * @brief ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT 1143 */ 1144 struct ble_mesh_provisioner_update_local_app_key_comp_param { 1145 int err_code; /*!< Indicate the result of updating local AppKey by the Provisioner */ 1146 uint16_t net_idx; /*!< NetKey Index */ 1147 uint16_t app_idx; /*!< AppKey Index */ 1148 } provisioner_update_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT */ 1149 /** 1150 * @brief ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT 1151 */ 1152 struct ble_mesh_provisioner_bind_local_mod_app_comp_param { 1153 int err_code; /*!< Indicate the result of binding AppKey with model by the Provisioner */ 1154 uint16_t element_addr; /*!< Element address */ 1155 uint16_t app_idx; /*!< AppKey Index */ 1156 uint16_t company_id; /*!< Company ID */ 1157 uint16_t model_id; /*!< Model ID */ 1158 } provisioner_bind_app_key_to_model_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT */ 1159 /** 1160 * @brief ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT 1161 */ 1162 struct ble_mesh_provisioner_add_local_net_key_comp_param { 1163 int err_code; /*!< Indicate the result of adding local NetKey by the Provisioner */ 1164 uint16_t net_idx; /*!< NetKey Index */ 1165 } provisioner_add_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT */ 1166 /** 1167 * @brief ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT 1168 */ 1169 struct ble_mesh_provisioner_update_local_net_key_comp_param { 1170 int err_code; /*!< Indicate the result of updating local NetKey by the Provisioner */ 1171 uint16_t net_idx; /*!< NetKey Index */ 1172 } provisioner_update_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT */ 1173 /** 1174 * @brief ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT 1175 */ 1176 struct ble_mesh_provisioner_store_node_comp_data_comp_param { 1177 int err_code; /*!< Indicate the result of storing node composition data by the Provisioner */ 1178 uint16_t addr; /*!< Node element address */ 1179 } provisioner_store_node_comp_data_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT */ 1180 /** 1181 * @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT 1182 */ 1183 struct ble_mesh_provisioner_delete_node_with_uuid_comp_param { 1184 int err_code; /*!< Indicate the result of deleting node with uuid by the Provisioner */ 1185 uint8_t uuid[16]; /*!< Node device uuid */ 1186 } provisioner_delete_node_with_uuid_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT */ 1187 /** 1188 * @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT 1189 */ 1190 struct ble_mesh_provisioner_delete_node_with_addr_comp_param { 1191 int err_code; /*!< Indicate the result of deleting node with unicast address by the Provisioner */ 1192 uint16_t unicast_addr; /*!< Node unicast address */ 1193 } provisioner_delete_node_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT */ 1194 /** 1195 * @brief ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT 1196 */ 1197 struct ble_mesh_set_fast_prov_info_comp_param { 1198 uint8_t status_unicast; /*!< Indicate the result of setting unicast address range of fast provisioning */ 1199 uint8_t status_net_idx; /*!< Indicate the result of setting NetKey Index of fast provisioning */ 1200 uint8_t status_match; /*!< Indicate the result of setting matching Device UUID of fast provisioning */ 1201 } set_fast_prov_info_comp; /*!< Event parameter of ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT */ 1202 /** 1203 * @brief ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT 1204 */ 1205 struct ble_mesh_set_fast_prov_action_comp_param { 1206 uint8_t status_action; /*!< Indicate the result of setting action of fast provisioning */ 1207 } set_fast_prov_action_comp; /*!< Event parameter of ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT */ 1208 /** 1209 * @brief ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT 1210 */ 1211 struct ble_mesh_heartbeat_msg_recv_param { 1212 uint8_t hops; /*!< Heartbeat hops (InitTTL - RxTTL + 1) */ 1213 uint16_t feature; /*!< Bit field of currently active features of the node */ 1214 } heartbeat_msg_recv; /*!< Event parameter of ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT */ 1215 /** 1216 * @brief ESP_BLE_MESH_LPN_ENABLE_COMP_EVT 1217 */ 1218 struct ble_mesh_lpn_enable_comp_param { 1219 int err_code; /*!< Indicate the result of enabling LPN functionality */ 1220 } lpn_enable_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_ENABLE_COMP_EVT */ 1221 /** 1222 * @brief ESP_BLE_MESH_LPN_DISABLE_COMP_EVT 1223 */ 1224 struct ble_mesh_lpn_disable_comp_param { 1225 int err_code; /*!< Indicate the result of disabling LPN functionality */ 1226 } lpn_disable_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_DISABLE_COMP_EVT */ 1227 /** 1228 * @brief ESP_BLE_MESH_LPN_POLL_COMP_EVT 1229 */ 1230 struct ble_mesh_lpn_poll_comp_param { 1231 int err_code; /*!< Indicate the result of sending Friend Poll */ 1232 } lpn_poll_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_POLL_COMP_EVT */ 1233 /** 1234 * @brief ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT 1235 */ 1236 struct ble_mesh_lpn_friendship_establish_param { 1237 uint16_t friend_addr; /*!< Friend Node unicast address */ 1238 } lpn_friendship_establish; /*!< Event parameter of ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT */ 1239 /** 1240 * @brief ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT 1241 */ 1242 struct ble_mesh_lpn_friendship_terminate_param { 1243 uint16_t friend_addr; /*!< Friend Node unicast address */ 1244 } lpn_friendship_terminate; /*!< Event parameter of ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT */ 1245 /** 1246 * @brief ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT 1247 */ 1248 struct ble_mesh_friend_friendship_establish_param { 1249 uint16_t lpn_addr; /*!< Low Power Node unicast address */ 1250 } frnd_friendship_establish; /*!< Event parameter of ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT */ 1251 /** 1252 * @brief ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT 1253 */ 1254 struct ble_mesh_friend_friendship_terminate_param { 1255 uint16_t lpn_addr; /*!< Low Power Node unicast address */ 1256 /** This enum value is the reason of friendship termination on the friend node side */ 1257 enum { 1258 ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_ESTABLISH_FAIL, /*!< Friend Offer has been sent, but Friend Offer is not received within 1 second, friendship fails to be established */ 1259 ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_POLL_TIMEOUT, /*!< Friendship is established, PollTimeout timer expires and no Friend Poll/Sub Add/Sub Remove is received */ 1260 ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_REQ, /*!< Receive Friend Request from existing Low Power Node */ 1261 ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_CLEAR, /*!< Receive Friend Clear from other friend node */ 1262 ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_DISABLE, /*!< Friend feature disabled or corresponding NetKey is deleted */ 1263 } reason; /*!< Friendship terminated reason */ 1264 } frnd_friendship_terminate; /*!< Event parameter of ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT */ 1265 /** 1266 * @brief ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT 1267 */ 1268 struct ble_mesh_proxy_client_recv_adv_pkt_param { 1269 esp_ble_mesh_bd_addr_t addr; /*!< Device address */ 1270 esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */ 1271 uint16_t net_idx; /*!< Network ID related NetKey Index */ 1272 uint8_t net_id[8]; /*!< Network ID contained in the advertising packet */ 1273 int8_t rssi; /*!< RSSI of the received advertising packet */ 1274 } proxy_client_recv_adv_pkt; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT */ 1275 /** 1276 * @brief ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT 1277 */ 1278 struct ble_mesh_proxy_client_connected_param { 1279 esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */ 1280 esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */ 1281 uint8_t conn_handle; /*!< Proxy connection handle */ 1282 uint16_t net_idx; /*!< Corresponding NetKey Index */ 1283 } proxy_client_connected; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT */ 1284 /** 1285 * @brief ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT 1286 */ 1287 struct ble_mesh_proxy_client_disconnected_param { 1288 esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */ 1289 esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */ 1290 uint8_t conn_handle; /*!< Proxy connection handle */ 1291 uint16_t net_idx; /*!< Corresponding NetKey Index */ 1292 uint8_t reason; /*!< Proxy disconnect reason */ 1293 } proxy_client_disconnected; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT */ 1294 /** 1295 * @brief ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT 1296 */ 1297 struct ble_mesh_proxy_client_recv_filter_status_param { 1298 uint8_t conn_handle; /*!< Proxy connection handle */ 1299 uint16_t server_addr; /*!< Proxy Server primary element address */ 1300 uint16_t net_idx; /*!< Corresponding NetKey Index */ 1301 uint8_t filter_type; /*!< Proxy Server filter type(whitelist or blacklist) */ 1302 uint16_t list_size; /*!< Number of addresses in the Proxy Server filter list */ 1303 } proxy_client_recv_filter_status; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT */ 1304 /** 1305 * @brief ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT 1306 */ 1307 struct ble_mesh_proxy_client_connect_comp_param { 1308 int err_code; /*!< Indicate the result of Proxy Client connect */ 1309 esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */ 1310 esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */ 1311 uint16_t net_idx; /*!< Corresponding NetKey Index */ 1312 } proxy_client_connect_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT */ 1313 /** 1314 * @brief ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT 1315 */ 1316 struct ble_mesh_proxy_client_disconnect_comp_param { 1317 int err_code; /*!< Indicate the result of Proxy Client disconnect */ 1318 uint8_t conn_handle; /*!< Proxy connection handle */ 1319 } proxy_client_disconnect_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT */ 1320 /** 1321 * @brief ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT 1322 */ 1323 struct ble_mesh_proxy_client_set_filter_type_comp_param { 1324 int err_code; /*!< Indicate the result of Proxy Client set filter type */ 1325 uint8_t conn_handle; /*!< Proxy connection handle */ 1326 uint16_t net_idx; /*!< Corresponding NetKey Index */ 1327 } proxy_client_set_filter_type_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT */ 1328 /** 1329 * @brief ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT 1330 */ 1331 struct ble_mesh_proxy_client_add_filter_addr_comp_param { 1332 int err_code; /*!< Indicate the result of Proxy Client add filter address */ 1333 uint8_t conn_handle; /*!< Proxy connection handle */ 1334 uint16_t net_idx; /*!< Corresponding NetKey Index */ 1335 } proxy_client_add_filter_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT */ 1336 /** 1337 * @brief ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT 1338 */ 1339 struct ble_mesh_proxy_client_remove_filter_addr_comp_param { 1340 int err_code; /*!< Indicate the result of Proxy Client remove filter address */ 1341 uint8_t conn_handle; /*!< Proxy connection handle */ 1342 uint16_t net_idx; /*!< Corresponding NetKey Index */ 1343 } proxy_client_remove_filter_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT */ 1344 /** 1345 * @brief ESP_BLE_MESH_START_BLE_ADVERTISING_COMP_EVT 1346 */ 1347 struct ble_mesh_start_ble_advertising_comp_param { 1348 int err_code; /*!< Indicate the result of starting BLE advertising */ 1349 uint8_t index; /*!< Index of the BLE advertising */ 1350 } start_ble_advertising_comp; /*!< Event parameter of ESP_BLE_MESH_START_BLE_ADVERTISING_COMP_EVT */ 1351 /** 1352 * @brief ESP_BLE_MESH_STOP_BLE_ADVERTISING_COMP_EVT 1353 */ 1354 struct ble_mesh_stop_ble_advertising_comp_param { 1355 int err_code; /*!< Indicate the result of stopping BLE advertising */ 1356 uint8_t index; /*!< Index of the BLE advertising */ 1357 } stop_ble_advertising_comp; /*!< Event parameter of ESP_BLE_MESH_STOP_BLE_ADVERTISING_COMP_EVT */ 1358 /** 1359 * @brief ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT 1360 */ 1361 struct ble_mesh_model_sub_group_addr_comp_param { 1362 int err_code; /*!< Indicate the result of local model subscribing group address */ 1363 uint16_t element_addr; /*!< Element address */ 1364 uint16_t company_id; /*!< Company ID */ 1365 uint16_t model_id; /*!< Model ID */ 1366 uint16_t group_addr; /*!< Group Address */ 1367 } model_sub_group_addr_comp; /*!< Event parameters of ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT */ 1368 /** 1369 * @brief ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT 1370 */ 1371 struct ble_mesh_model_unsub_group_addr_comp_param { 1372 int err_code; /*!< Indicate the result of local model unsubscribing group address */ 1373 uint16_t element_addr; /*!< Element address */ 1374 uint16_t company_id; /*!< Company ID */ 1375 uint16_t model_id; /*!< Model ID */ 1376 uint16_t group_addr; /*!< Group Address */ 1377 } model_unsub_group_addr_comp; /*!< Event parameters of ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT */ 1378 /** 1379 * @brief ESP_BLE_MESH_DEINIT_MESH_COMP_EVT 1380 */ 1381 struct ble_mesh_deinit_mesh_comp_param { 1382 int err_code; /*!< Indicate the result of BLE Mesh deinitialization */ 1383 } deinit_mesh_comp; /*!< Event parameter of ESP_BLE_MESH_DEINIT_MESH_COMP_EVT */ 1384 } esp_ble_mesh_prov_cb_param_t; 1385 1386 /** 1387 * @brief BLE Mesh models related Model ID and Opcode definitions 1388 */ 1389 1390 /*!< Foundation Models */ 1391 #define ESP_BLE_MESH_MODEL_ID_CONFIG_SRV 0x0000 1392 #define ESP_BLE_MESH_MODEL_ID_CONFIG_CLI 0x0001 1393 #define ESP_BLE_MESH_MODEL_ID_HEALTH_SRV 0x0002 1394 #define ESP_BLE_MESH_MODEL_ID_HEALTH_CLI 0x0003 1395 1396 /*!< Models from the Mesh Model Specification */ 1397 #define ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV 0x1000 1398 #define ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI 0x1001 1399 #define ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_SRV 0x1002 1400 #define ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_CLI 0x1003 1401 #define ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV 0x1004 1402 #define ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI 0x1005 1403 #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV 0x1006 1404 #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV 0x1007 1405 #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI 0x1008 1406 #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV 0x1009 1407 #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV 0x100a 1408 #define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI 0x100b 1409 #define ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_SRV 0x100c 1410 #define ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_CLI 0x100d 1411 #define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SRV 0x100e 1412 #define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SETUP_SRV 0x100f 1413 #define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_CLI 0x1010 1414 #define ESP_BLE_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV 0x1011 1415 #define ESP_BLE_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV 0x1012 1416 #define ESP_BLE_MESH_MODEL_ID_GEN_USER_PROP_SRV 0x1013 1417 #define ESP_BLE_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV 0x1014 1418 #define ESP_BLE_MESH_MODEL_ID_GEN_PROP_CLI 0x1015 1419 #define ESP_BLE_MESH_MODEL_ID_SENSOR_SRV 0x1100 1420 #define ESP_BLE_MESH_MODEL_ID_SENSOR_SETUP_SRV 0x1101 1421 #define ESP_BLE_MESH_MODEL_ID_SENSOR_CLI 0x1102 1422 #define ESP_BLE_MESH_MODEL_ID_TIME_SRV 0x1200 1423 #define ESP_BLE_MESH_MODEL_ID_TIME_SETUP_SRV 0x1201 1424 #define ESP_BLE_MESH_MODEL_ID_TIME_CLI 0x1202 1425 #define ESP_BLE_MESH_MODEL_ID_SCENE_SRV 0x1203 1426 #define ESP_BLE_MESH_MODEL_ID_SCENE_SETUP_SRV 0x1204 1427 #define ESP_BLE_MESH_MODEL_ID_SCENE_CLI 0x1205 1428 #define ESP_BLE_MESH_MODEL_ID_SCHEDULER_SRV 0x1206 1429 #define ESP_BLE_MESH_MODEL_ID_SCHEDULER_SETUP_SRV 0x1207 1430 #define ESP_BLE_MESH_MODEL_ID_SCHEDULER_CLI 0x1208 1431 #define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV 0x1300 1432 #define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV 0x1301 1433 #define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI 0x1302 1434 #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SRV 0x1303 1435 #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV 0x1304 1436 #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_CLI 0x1305 1437 #define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV 0x1306 1438 #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SRV 0x1307 1439 #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV 0x1308 1440 #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_CLI 0x1309 1441 #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV 0x130a 1442 #define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV 0x130b 1443 #define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SRV 0x130c 1444 #define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV 0x130d 1445 #define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_CLI 0x130e 1446 #define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SRV 0x130f 1447 #define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SETUP_SRV 0x1310 1448 #define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_CLI 0x1311 1449 1450 /** 1451 * esp_ble_mesh_opcode_config_client_get_t belongs to esp_ble_mesh_opcode_t, this typedef is only 1452 * used to locate the opcodes used by esp_ble_mesh_config_client_get_state. 1453 * The following opcodes will only be used in the esp_ble_mesh_config_client_get_state function. 1454 */ 1455 typedef uint32_t esp_ble_mesh_opcode_config_client_get_t; 1456 1457 #define ESP_BLE_MESH_MODEL_OP_BEACON_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x09) /*!< Config Beacon Get */ 1458 #define ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x08) /*!< Config Composition Data Get */ 1459 #define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0C) /*!< Config Default TTL Get */ 1460 #define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x12) /*!< Config GATT Proxy Get */ 1461 #define ESP_BLE_MESH_MODEL_OP_RELAY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x26) /*!< Config Relay Get */ 1462 #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x18) /*!< Config Model Publication Get */ 1463 #define ESP_BLE_MESH_MODEL_OP_FRIEND_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0F) /*!< Config Friend Get */ 1464 #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x38) /*!< Config Heartbeat Publication Get */ 1465 #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3a) /*!< Config Heartbeat Subscription Get */ 1466 #define ESP_BLE_MESH_MODEL_OP_NET_KEY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x42) /*!< Config NetKey Get */ 1467 #define ESP_BLE_MESH_MODEL_OP_APP_KEY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x01) /*!< Config AppKey Get */ 1468 #define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x46) /*!< Config Node Identity Get */ 1469 #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x29) /*!< Config SIG Model Subscription Get */ 1470 #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2B) /*!< Config Vendor Model Subscription Get */ 1471 #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4B) /*!< Config SIG Model App Get */ 1472 #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4D) /*!< Config Vendor Model App Get */ 1473 #define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x15) /*!< Config Key Refresh Phase Get */ 1474 #define ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2D) /*!< Config Low Power Node PollTimeout Get */ 1475 #define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x23) /*!< Config Network Transmit Get */ 1476 1477 /** 1478 * esp_ble_mesh_opcode_config_client_set_t belongs to esp_ble_mesh_opcode_t, this typedef is 1479 * only used to locate the opcodes used by esp_ble_mesh_config_client_set_state. 1480 * The following opcodes will only be used in the esp_ble_mesh_config_client_set_state function. 1481 */ 1482 typedef uint32_t esp_ble_mesh_opcode_config_client_set_t; 1483 1484 #define ESP_BLE_MESH_MODEL_OP_BEACON_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0A) /*!< Config Beacon Set */ 1485 #define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0D) /*!< Config Default TTL Set */ 1486 #define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x13) /*!< Config GATT Proxy Set */ 1487 #define ESP_BLE_MESH_MODEL_OP_RELAY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x27) /*!< Config Relay Set */ 1488 #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET ESP_BLE_MESH_MODEL_OP_1(0x03) /*!< Config Model Publication Set */ 1489 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1B) /*!< Config Model Subscription Add */ 1490 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x20) /*!< Config Model Subscription Virtual Address Add */ 1491 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1C) /*!< Config Model Subscription Delete */ 1492 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x21) /*!< Config Model Subscription Virtual Address Delete */ 1493 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1E) /*!< Config Model Subscription Overwrite */ 1494 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_OVERWRITE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x22) /*!< Config Model Subscription Virtual Address Overwrite */ 1495 #define ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x40) /*!< Config NetKey Add */ 1496 #define ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD ESP_BLE_MESH_MODEL_OP_1(0x00) /*!< Config AppKey Add */ 1497 #define ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3D) /*!< Config Model App Bind */ 1498 #define ESP_BLE_MESH_MODEL_OP_NODE_RESET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x49) /*!< Config Node Reset */ 1499 #define ESP_BLE_MESH_MODEL_OP_FRIEND_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x10) /*!< Config Friend Set */ 1500 #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x39) /*!< Config Heartbeat Publication Set */ 1501 #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3B) /*!< Config Heartbeat Subscription Set */ 1502 #define ESP_BLE_MESH_MODEL_OP_NET_KEY_UPDATE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x45) /*!< Config NetKey Update */ 1503 #define ESP_BLE_MESH_MODEL_OP_NET_KEY_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x41) /*!< Config NetKey Delete */ 1504 #define ESP_BLE_MESH_MODEL_OP_APP_KEY_UPDATE ESP_BLE_MESH_MODEL_OP_1(0x01) /*!< Config AppKey Update */ 1505 #define ESP_BLE_MESH_MODEL_OP_APP_KEY_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x00) /*!< Config AppKey Delete */ 1506 #define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x47) /*!< Config Node Identity Set */ 1507 #define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x16) /*!< Config Key Refresh Phase Set */ 1508 #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_VIRTUAL_ADDR_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1A) /*!< Config Model Publication Virtual Address Set */ 1509 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE_ALL ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1D) /*!< Config Model Subscription Delete All */ 1510 #define ESP_BLE_MESH_MODEL_OP_MODEL_APP_UNBIND ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3F) /*!< Config Model App Unbind */ 1511 #define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x24) /*!< Config Network Transmit Set */ 1512 1513 /** 1514 * esp_ble_mesh_opcode_config_status_t belongs to esp_ble_mesh_opcode_t, this typedef is only 1515 * used to locate the opcodes used by the Config Model messages 1516 * The following opcodes are used by the BLE Mesh Config Server Model internally to respond 1517 * to the Config Client Model's request messages. 1518 */ 1519 typedef uint32_t esp_ble_mesh_opcode_config_status_t; 1520 1521 #define ESP_BLE_MESH_MODEL_OP_BEACON_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0B) 1522 #define ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_STATUS ESP_BLE_MESH_MODEL_OP_1(0x02) 1523 #define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0E) 1524 #define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x14) 1525 #define ESP_BLE_MESH_MODEL_OP_RELAY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x28) 1526 #define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x19) 1527 #define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1F) 1528 #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2A) 1529 #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2C) 1530 #define ESP_BLE_MESH_MODEL_OP_NET_KEY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x44) 1531 #define ESP_BLE_MESH_MODEL_OP_NET_KEY_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x43) 1532 #define ESP_BLE_MESH_MODEL_OP_APP_KEY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x03) 1533 #define ESP_BLE_MESH_MODEL_OP_APP_KEY_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x02) 1534 #define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x48) 1535 #define ESP_BLE_MESH_MODEL_OP_MODEL_APP_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3E) 1536 #define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4C) 1537 #define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4E) 1538 #define ESP_BLE_MESH_MODEL_OP_NODE_RESET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4A) 1539 #define ESP_BLE_MESH_MODEL_OP_FRIEND_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x11) 1540 #define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x17) 1541 #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_STATUS ESP_BLE_MESH_MODEL_OP_1(0x06) 1542 #define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3C) 1543 #define ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2E) 1544 #define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x25) 1545 1546 /** 1547 * This typedef is only used to indicate the status code contained in some of 1548 * the Configuration Server Model status message. 1549 */ 1550 typedef uint8_t esp_ble_mesh_cfg_status_t; 1551 1552 #define ESP_BLE_MESH_CFG_STATUS_SUCCESS 0x00 1553 #define ESP_BLE_MESH_CFG_STATUS_INVALID_ADDRESS 0x01 1554 #define ESP_BLE_MESH_CFG_STATUS_INVALID_MODEL 0x02 1555 #define ESP_BLE_MESH_CFG_STATUS_INVALID_APPKEY 0x03 1556 #define ESP_BLE_MESH_CFG_STATUS_INVALID_NETKEY 0x04 1557 #define ESP_BLE_MESH_CFG_STATUS_INSUFFICIENT_RESOURCES 0x05 1558 #define ESP_BLE_MESH_CFG_STATUS_KEY_INDEX_ALREADY_STORED 0x06 1559 #define ESP_BLE_MESH_CFG_STATUS_INVALID_PUBLISH_PARAMETERS 0x07 1560 #define ESP_BLE_MESH_CFG_STATUS_NOT_A_SUBSCRIBE_MODEL 0x08 1561 #define ESP_BLE_MESH_CFG_STATUS_STORAGE_FAILURE 0x09 1562 #define ESP_BLE_MESH_CFG_STATUS_FEATURE_NOT_SUPPORTED 0x0A 1563 #define ESP_BLE_MESH_CFG_STATUS_CANNOT_UPDATE 0x0B 1564 #define ESP_BLE_MESH_CFG_STATUS_CANNOT_REMOVE 0x0C 1565 #define ESP_BLE_MESH_CFG_STATUS_CANNOT_BIND 0x0D 1566 #define ESP_BLE_MESH_CFG_STATUS_TEMP_UNABLE_TO_CHANGE_STATE 0x0E 1567 #define ESP_BLE_MESH_CFG_STATUS_CANNOT_SET 0x0F 1568 #define ESP_BLE_MESH_CFG_STATUS_UNSPECIFIED_ERROR 0x10 1569 #define ESP_BLE_MESH_CFG_STATUS_INVALID_BINDING 0x11 1570 1571 /** 1572 * esp_ble_mesh_opcode_health_client_get_t belongs to esp_ble_mesh_opcode_t, this typedef is 1573 * only used to locate the opcodes used by esp_ble_mesh_health_client_get_state. 1574 * The following opcodes will only be used in the esp_ble_mesh_health_client_get_state function. 1575 */ 1576 typedef uint32_t esp_ble_mesh_opcode_health_client_get_t; 1577 1578 #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x31) /*!< Health Fault Get */ 1579 #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x34) /*!< Health Period Get */ 1580 #define ESP_BLE_MESH_MODEL_OP_ATTENTION_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x04) /*!< Health Attention Get */ 1581 1582 /** 1583 * esp_ble_mesh_opcode_health_client_set_t belongs to esp_ble_mesh_opcode_t, this typedef is 1584 * only used to locate the opcodes used by esp_ble_mesh_health_client_set_state. 1585 * The following opcodes will only be used in the esp_ble_mesh_health_client_set_state function. 1586 */ 1587 typedef uint32_t esp_ble_mesh_opcode_health_client_set_t; 1588 1589 #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2F) /*!< Health Fault Clear */ 1590 #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x30) /*!< Health Fault Clear Unacknowledged */ 1591 #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x32) /*!< Health Fault Test */ 1592 #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x33) /*!< Health Fault Test Unacknowledged */ 1593 #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x35) /*!< Health Period Set */ 1594 #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x36) /*!< Health Period Set Unacknowledged */ 1595 #define ESP_BLE_MESH_MODEL_OP_ATTENTION_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x05) /*!< Health Attention Set */ 1596 #define ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x06) /*!< Health Attention Set Unacknowledged */ 1597 1598 /** 1599 * esp_ble_mesh_health_model_status_t belongs to esp_ble_mesh_opcode_t, this typedef is 1600 * only used to locate the opcodes used by the Health Model messages. 1601 * The following opcodes are used by the BLE Mesh Health Server Model internally to 1602 * respond to the Health Client Model's request messages. 1603 */ 1604 typedef uint32_t esp_ble_mesh_health_model_status_t; 1605 1606 #define ESP_BLE_MESH_MODEL_OP_HEALTH_CURRENT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x04) 1607 #define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x05) 1608 #define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x37) 1609 #define ESP_BLE_MESH_MODEL_OP_ATTENTION_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x07) 1610 1611 /** 1612 * esp_ble_mesh_generic_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is 1613 * only used to locate the opcodes used by functions esp_ble_mesh_generic_client_get_state 1614 * & esp_ble_mesh_generic_client_set_state. 1615 */ 1616 typedef uint32_t esp_ble_mesh_generic_message_opcode_t; 1617 1618 /*!< Generic OnOff Message Opcode */ 1619 #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x01) 1620 #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x02) 1621 #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x03) 1622 #define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x04) 1623 1624 /*!< Generic Level Message Opcode */ 1625 #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x05) 1626 #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x06) 1627 #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x07) 1628 #define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x08) 1629 #define ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x09) 1630 #define ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0A) 1631 #define ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0B) 1632 #define ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0C) 1633 1634 /*!< Generic Default Transition Time Message Opcode */ 1635 #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0D) 1636 #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0E) 1637 #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0F) 1638 #define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x10) 1639 1640 /*!< Generic Power OnOff Message Opcode */ 1641 #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x11) 1642 #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x12) 1643 1644 /*!< Generic Power OnOff Setup Message Opcode */ 1645 #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x13) 1646 #define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x14) 1647 1648 /*!< Generic Power Level Message Opcode */ 1649 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x15) 1650 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x16) 1651 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x17) 1652 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x18) 1653 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x19) 1654 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1A) 1655 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1B) 1656 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1C) 1657 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1D) 1658 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1E) 1659 1660 /*!< Generic Power Level Setup Message Opcode */ 1661 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1F) 1662 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x20) 1663 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x21) 1664 #define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x22) 1665 1666 /*!< Generic Battery Message Opcode */ 1667 #define ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x23) 1668 #define ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x24) 1669 1670 /*!< Generic Location Message Opcode */ 1671 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x25) 1672 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_STATUS ESP_BLE_MESH_MODEL_OP_1(0x40) 1673 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x26) 1674 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x27) 1675 1676 /*!< Generic Location Setup Message Opcode */ 1677 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET ESP_BLE_MESH_MODEL_OP_1(0x41) 1678 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x42) 1679 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x28) 1680 #define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x29) 1681 1682 /*!< Generic Manufacturer Property Message Opcode */ 1683 #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2A) 1684 #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x43) 1685 #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2B) 1686 #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x44) 1687 #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x45) 1688 #define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x46) 1689 1690 /*!< Generic Admin Property Message Opcode */ 1691 #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2C) 1692 #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x47) 1693 #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2D) 1694 #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x48) 1695 #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x49) 1696 #define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4A) 1697 1698 /*!< Generic User Property Message Opcode */ 1699 #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2E) 1700 #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4B) 1701 #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2F) 1702 #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x4C) 1703 #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x4D) 1704 #define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4E) 1705 1706 /*!< Generic Client Property Message Opcode */ 1707 #define ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_1(0x4F) 1708 #define ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x50) 1709 1710 /** 1711 * esp_ble_mesh_sensor_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is 1712 * only used to locate the opcodes used by functions esp_ble_mesh_sensor_client_get_state 1713 * & esp_ble_mesh_sensor_client_set_state. 1714 */ 1715 typedef uint32_t esp_ble_mesh_sensor_message_opcode_t; 1716 1717 /*!< Sensor Message Opcode */ 1718 #define ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x30) 1719 #define ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_STATUS ESP_BLE_MESH_MODEL_OP_1(0x51) 1720 #define ESP_BLE_MESH_MODEL_OP_SENSOR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x31) 1721 #define ESP_BLE_MESH_MODEL_OP_SENSOR_STATUS ESP_BLE_MESH_MODEL_OP_1(0x52) 1722 #define ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x32) 1723 #define ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_STATUS ESP_BLE_MESH_MODEL_OP_1(0x53) 1724 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x33) 1725 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x54) 1726 1727 /*!< Sensor Setup Message Opcode */ 1728 #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x34) 1729 #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET ESP_BLE_MESH_MODEL_OP_1(0x55) 1730 #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x56) 1731 #define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_STATUS ESP_BLE_MESH_MODEL_OP_1(0x57) 1732 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x35) 1733 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_STATUS ESP_BLE_MESH_MODEL_OP_1(0x58) 1734 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x36) 1735 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET ESP_BLE_MESH_MODEL_OP_1(0x59) 1736 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x5A) 1737 #define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5B) 1738 1739 /** 1740 * esp_ble_mesh_time_scene_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is 1741 * only used to locate the opcodes used by functions esp_ble_mesh_time_scene_client_get_state 1742 * & esp_ble_mesh_time_scene_client_set_state. 1743 */ 1744 typedef uint32_t esp_ble_mesh_time_scene_message_opcode_t; 1745 1746 /*!< Time Message Opcode */ 1747 #define ESP_BLE_MESH_MODEL_OP_TIME_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x37) 1748 #define ESP_BLE_MESH_MODEL_OP_TIME_SET ESP_BLE_MESH_MODEL_OP_1(0x5C) 1749 #define ESP_BLE_MESH_MODEL_OP_TIME_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5D) 1750 #define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x38) 1751 #define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x39) 1752 #define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3A) 1753 #define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3B) 1754 #define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3C) 1755 #define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3D) 1756 #define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3E) 1757 #define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3F) 1758 #define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x40) 1759 1760 /*!< Scene Message Opcode */ 1761 #define ESP_BLE_MESH_MODEL_OP_SCENE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x41) 1762 #define ESP_BLE_MESH_MODEL_OP_SCENE_RECALL ESP_BLE_MESH_MODEL_OP_2(0x82, 0x42) 1763 #define ESP_BLE_MESH_MODEL_OP_SCENE_RECALL_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x43) 1764 #define ESP_BLE_MESH_MODEL_OP_SCENE_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5E) 1765 #define ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x44) 1766 #define ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x45) 1767 1768 /*!< Scene Setup Message Opcode */ 1769 #define ESP_BLE_MESH_MODEL_OP_SCENE_STORE ESP_BLE_MESH_MODEL_OP_2(0x82, 0x46) 1770 #define ESP_BLE_MESH_MODEL_OP_SCENE_STORE_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x47) 1771 #define ESP_BLE_MESH_MODEL_OP_SCENE_DELETE ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9E) 1772 #define ESP_BLE_MESH_MODEL_OP_SCENE_DELETE_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9F) 1773 1774 /*!< Scheduler Message Opcode */ 1775 #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x48) 1776 #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5F) 1777 #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x49) 1778 #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4A) 1779 1780 /*!< Scheduler Setup Message Opcode */ 1781 #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET ESP_BLE_MESH_MODEL_OP_1(0x60) 1782 #define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x61) 1783 1784 /** 1785 * esp_ble_mesh_light_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is 1786 * only used to locate the opcodes used by functions esp_ble_mesh_light_client_get_state 1787 * & esp_ble_mesh_light_client_set_state. 1788 */ 1789 typedef uint32_t esp_ble_mesh_light_message_opcode_t; 1790 1791 /*!< Light Lightness Message Opcode */ 1792 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4B) 1793 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4C) 1794 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4D) 1795 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4E) 1796 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4F) 1797 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x50) 1798 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x51) 1799 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x52) 1800 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x53) 1801 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x54) 1802 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x55) 1803 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x56) 1804 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x57) 1805 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x58) 1806 1807 /*!< Light Lightness Setup Message Opcode */ 1808 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x59) 1809 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5A) 1810 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5B) 1811 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5C) 1812 1813 /*!< Light CTL Message Opcode */ 1814 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5D) 1815 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5E) 1816 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5F) 1817 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x60) 1818 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x61) 1819 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x62) 1820 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x63) 1821 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x64) 1822 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x65) 1823 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x66) 1824 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x67) 1825 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x68) 1826 1827 /*!< Light CTL Setup Message Opcode */ 1828 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x69) 1829 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6A) 1830 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6B) 1831 #define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6C) 1832 1833 /*!< Light HSL Message Opcode */ 1834 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6D) 1835 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6E) 1836 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6F) 1837 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x70) 1838 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x71) 1839 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x72) 1840 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x73) 1841 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x74) 1842 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x75) 1843 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x76) 1844 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x77) 1845 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x78) 1846 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x79) 1847 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7A) 1848 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7B) 1849 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7C) 1850 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7D) 1851 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7E) 1852 1853 /*!< Light HSL Setup Message Opcode */ 1854 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7F) 1855 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x80) 1856 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x81) 1857 #define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x82) 1858 1859 /*!< Light xyL Message Opcode */ 1860 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x83) 1861 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x84) 1862 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x85) 1863 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x86) 1864 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x87) 1865 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x88) 1866 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x89) 1867 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8A) 1868 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8B) 1869 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8C) 1870 1871 /*!< Light xyL Setup Message Opcode */ 1872 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8D) 1873 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8E) 1874 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8F) 1875 #define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x90) 1876 1877 /*!< Light Control Message Opcode */ 1878 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x91) 1879 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x92) 1880 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x93) 1881 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x94) 1882 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x95) 1883 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x96) 1884 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x97) 1885 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x98) 1886 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x99) 1887 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9A) 1888 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9B) 1889 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9C) 1890 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9D) 1891 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x62) 1892 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x63) 1893 #define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x64) 1894 1895 typedef uint32_t esp_ble_mesh_opcode_t; 1896 /*!< End of defines of esp_ble_mesh_opcode_t */ 1897 1898 /** 1899 * This typedef is only used to indicate the status code contained in some of the 1900 * server models (e.g. Generic Server Model) status message. 1901 */ 1902 typedef uint8_t esp_ble_mesh_model_status_t; 1903 1904 #define ESP_BLE_MESH_MODEL_STATUS_SUCCESS 0x00 1905 #define ESP_BLE_MESH_MODEL_STATUS_CANNOT_SET_RANGE_MIN 0x01 1906 #define ESP_BLE_MESH_MODEL_STATUS_CANNOT_SET_RANGE_MAX 0x02 1907 1908 /** 1909 * @brief BLE Mesh client models related definitions 1910 */ 1911 1912 /** Client model Get/Set message opcode and corresponding Status message opcode */ 1913 typedef struct { 1914 uint32_t cli_op; /*!< The client message opcode */ 1915 uint32_t status_op; /*!< The server status opcode corresponding to the client message opcode */ 1916 } esp_ble_mesh_client_op_pair_t; 1917 1918 /** Client Model user data context. */ 1919 typedef struct { 1920 esp_ble_mesh_model_t *model; /*!< Pointer to the client model. Initialized by the stack. */ 1921 int op_pair_size; /*!< Size of the op_pair */ 1922 const esp_ble_mesh_client_op_pair_t *op_pair; /*!< Table containing get/set message opcode and corresponding status message opcode */ 1923 uint32_t publish_status; /*!< Callback used to handle the received unsolicited message. Initialized by the stack. */ 1924 void *internal_data; /*!< Pointer to the internal data of client model */ 1925 uint8_t msg_role; /*!< Role of the device (Node/Provisioner) that is going to send messages */ 1926 } esp_ble_mesh_client_t; 1927 1928 /** Common parameters of the messages sent by Client Model. */ 1929 typedef struct { 1930 esp_ble_mesh_opcode_t opcode; /*!< Message opcode */ 1931 esp_ble_mesh_model_t *model; /*!< Pointer to the client model structure */ 1932 esp_ble_mesh_msg_ctx_t ctx; /*!< The context used to send message */ 1933 int32_t msg_timeout; /*!< Timeout value (ms) to get response to the sent message */ 1934 /*!< Note: if using default timeout value in menuconfig, make sure to set this value to 0 */ 1935 uint8_t msg_role; /*!< Role of the device - Node/Provisioner */ 1936 } esp_ble_mesh_client_common_param_t; 1937 1938 /** 1939 * @brief BLE Mesh server models related definitions 1940 */ 1941 1942 /** This enum value is the flag of transition timer operation */ 1943 enum { 1944 ESP_BLE_MESH_SERVER_TRANS_TIMER_START, /* Proper transition timer has been started */ 1945 ESP_BLE_MESH_SERVER_FLAG_MAX, 1946 }; 1947 1948 /** Parameters of the server model state transition */ 1949 typedef struct { 1950 bool just_started; /*!< Indicate if the state transition has just started */ 1951 1952 uint8_t trans_time; /*!< State transition time */ 1953 uint8_t remain_time; /*!< Remaining time of state transition */ 1954 uint8_t delay; /*!< Delay before starting state transition */ 1955 uint32_t quo_tt; /*!< Duration of each divided transition step */ 1956 uint32_t counter; /*!< Number of steps which the transition duration is divided */ 1957 uint32_t total_duration; /*!< State transition total duration */ 1958 int64_t start_timestamp; /*!< Time when the state transition is started */ 1959 1960 /** 1961 * Flag used to indicate if the transition timer has been started internally. 1962 * 1963 * If the model which contains esp_ble_mesh_state_transition_t sets "set_auto_rsp" 1964 * to ESP_BLE_MESH_SERVER_RSP_BY_APP, the handler of the timer shall be initialized 1965 * by the users. 1966 * 1967 * And users can use this flag to indicate whether the timer is started or not. 1968 */ 1969 BLE_MESH_ATOMIC_DEFINE(flag, ESP_BLE_MESH_SERVER_FLAG_MAX); 1970 struct k_delayed_work timer; /*!< Timer used for state transition */ 1971 } esp_ble_mesh_state_transition_t; 1972 1973 /** Parameters of the server model received last same set message. */ 1974 typedef struct { 1975 uint8_t tid; /*!< Transaction number of the last message */ 1976 uint16_t src; /*!< Source address of the last message */ 1977 uint16_t dst; /*!< Destination address of the last message */ 1978 int64_t timestamp; /*!< Time when the last message is received */ 1979 } esp_ble_mesh_last_msg_info_t; 1980 1981 #define ESP_BLE_MESH_SERVER_RSP_BY_APP 0 /*!< Response need to be sent in the application */ 1982 #define ESP_BLE_MESH_SERVER_AUTO_RSP 1 /*!< Response will be sent internally */ 1983 1984 /** Parameters of the Server Model response control */ 1985 typedef struct { 1986 /** 1987 * @brief BLE Mesh Server Response Option 1988 * 1. If get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the 1989 * response of Client Get messages need to be replied by the application; 1990 * 2. If get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the 1991 * response of Client Get messages will be replied by the server models; 1992 * 3. If set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the 1993 * response of Client Set messages need to be replied by the application; 1994 * 4. If set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the 1995 * response of Client Set messages will be replied by the server models; 1996 * 5. If status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the 1997 * response of Server Status messages need to be replied by the application; 1998 * 6. If status_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the 1999 * response of Server Status messages will be replied by the server models; 2000 */ 2001 uint8_t get_auto_rsp : 1, /*!< Response control for Client Get messages */ 2002 set_auto_rsp : 1, /*!< Response control for Client Set messages */ 2003 status_auto_rsp : 1; /*!< Response control for Server Status messages */ 2004 } esp_ble_mesh_server_rsp_ctrl_t; 2005 2006 /** 2007 * @brief Server model state value union 2008 */ 2009 typedef union { 2010 struct { 2011 uint8_t onoff; /*!< The value of the Generic OnOff state */ 2012 } gen_onoff; /*!< The Generic OnOff state */ 2013 struct { 2014 int16_t level; /*!< The value of the Generic Level state */ 2015 } gen_level; /*!< The Generic Level state */ 2016 struct { 2017 uint8_t onpowerup; /*!< The value of the Generic OnPowerUp state */ 2018 } gen_onpowerup; /*!< The Generic OnPowerUp state */ 2019 struct { 2020 uint16_t power; /*!< The value of the Generic Power Actual state */ 2021 } gen_power_actual; /*!< The Generic Power Actual state */ 2022 struct { 2023 uint16_t lightness; /*!< The value of the Light Lightness Actual state */ 2024 } light_lightness_actual; /*!< The Light Lightness Actual state */ 2025 struct { 2026 uint16_t lightness; /*!< The value of the Light Lightness Linear state */ 2027 } light_lightness_linear; /*!< The Light Lightness Linear state */ 2028 struct { 2029 uint16_t lightness; /*!< The value of the Light CTL Lightness state */ 2030 } light_ctl_lightness; /*!< The Light CTL Lightness state */ 2031 struct { 2032 uint16_t temperature; /*!< The value of the Light CTL Temperature state */ 2033 int16_t delta_uv; /*!< The value of the Light CTL Delta UV state */ 2034 } light_ctl_temp_delta_uv; /*!< The Light CTL Temperature & Delta UV states */ 2035 struct { 2036 uint16_t lightness; /*!< The value of the Light HSL Lightness state */ 2037 } light_hsl_lightness; /*!< The Light HSL Lightness state */ 2038 struct { 2039 uint16_t hue; /*!< The value of the Light HSL Hue state */ 2040 } light_hsl_hue; /*!< The Light HSL Hue state */ 2041 struct { 2042 uint16_t saturation; /*!< The value of the Light HSL Saturation state */ 2043 } light_hsl_saturation; /*!< The Light HSL Saturation state */ 2044 struct { 2045 uint16_t lightness; /*!< The value of the Light xyL Lightness state */ 2046 } light_xyl_lightness; /*!< The Light xyL Lightness state */ 2047 struct { 2048 uint8_t onoff; /*!< The value of the Light LC Light OnOff state */ 2049 } light_lc_light_onoff; /*!< The Light LC Light OnOff state */ 2050 } esp_ble_mesh_server_state_value_t; 2051 2052 /** This enum value is the type of server model states */ 2053 typedef enum { 2054 ESP_BLE_MESH_GENERIC_ONOFF_STATE, 2055 ESP_BLE_MESH_GENERIC_LEVEL_STATE, 2056 ESP_BLE_MESH_GENERIC_ONPOWERUP_STATE, 2057 ESP_BLE_MESH_GENERIC_POWER_ACTUAL_STATE, 2058 ESP_BLE_MESH_LIGHT_LIGHTNESS_ACTUAL_STATE, 2059 ESP_BLE_MESH_LIGHT_LIGHTNESS_LINEAR_STATE, 2060 ESP_BLE_MESH_LIGHT_CTL_LIGHTNESS_STATE, 2061 ESP_BLE_MESH_LIGHT_CTL_TEMP_DELTA_UV_STATE, 2062 ESP_BLE_MESH_LIGHT_HSL_LIGHTNESS_STATE, 2063 ESP_BLE_MESH_LIGHT_HSL_HUE_STATE, 2064 ESP_BLE_MESH_LIGHT_HSL_SATURATION_STATE, 2065 ESP_BLE_MESH_LIGHT_XYL_LIGHTNESS_STATE, 2066 ESP_BLE_MESH_LIGHT_LC_LIGHT_ONOFF_STATE, 2067 ESP_BLE_MESH_SERVER_MODEL_STATE_MAX, 2068 } esp_ble_mesh_server_state_type_t; 2069 2070 /*!< This enum value is the event of undefined SIG models and vendor models */ 2071 typedef enum { 2072 ESP_BLE_MESH_MODEL_OPERATION_EVT, /*!< User-defined models receive messages from peer devices (e.g. get, set, status, etc) event */ 2073 ESP_BLE_MESH_MODEL_SEND_COMP_EVT, /*!< User-defined models send messages completion event */ 2074 ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT, /*!< User-defined models publish messages completion event */ 2075 ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT, /*!< User-defined client models receive publish messages event */ 2076 ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT, /*!< Timeout event for the user-defined client models that failed to receive response from peer server models */ 2077 ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT, /*!< When a model is configured to publish messages periodically, this event will occur during every publish period */ 2078 ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT, /*!< Server models update state value completion event */ 2079 ESP_BLE_MESH_MODEL_EVT_MAX, 2080 } esp_ble_mesh_model_cb_event_t; 2081 2082 /** 2083 * @brief BLE Mesh model callback parameters union 2084 */ 2085 typedef union { 2086 /** 2087 * @brief ESP_BLE_MESH_MODEL_OPERATION_EVT 2088 */ 2089 struct ble_mesh_model_operation_evt_param { 2090 uint32_t opcode; /*!< Opcode of the received message */ 2091 esp_ble_mesh_model_t *model; /*!< Pointer to the model which receives the message */ 2092 esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the received message */ 2093 uint16_t length; /*!< Length of the received message */ 2094 uint8_t *msg; /*!< Value of the received message */ 2095 } model_operation; /*!< Event parameter of ESP_BLE_MESH_MODEL_OPERATION_EVT */ 2096 /** 2097 * @brief ESP_BLE_MESH_MODEL_SEND_COMP_EVT 2098 */ 2099 struct ble_mesh_model_send_comp_param { 2100 int err_code; /*!< Indicate the result of sending a message */ 2101 uint32_t opcode; /*!< Opcode of the message */ 2102 esp_ble_mesh_model_t *model; /*!< Pointer to the model which sends the message */ 2103 esp_ble_mesh_msg_ctx_t *ctx; /*!< Context of the message */ 2104 } model_send_comp; /*!< Event parameter of ESP_BLE_MESH_MODEL_SEND_COMP_EVT */ 2105 /** 2106 * @brief ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT 2107 */ 2108 struct ble_mesh_model_publish_comp_param { 2109 int err_code; /*!< Indicate the result of publishing a message */ 2110 esp_ble_mesh_model_t *model; /*!< Pointer to the model which publishes the message */ 2111 } model_publish_comp; /*!< Event parameter of ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT */ 2112 /** 2113 * @brief ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT 2114 */ 2115 struct ble_mesh_mod_recv_publish_msg_param { 2116 uint32_t opcode; /*!< Opcode of the unsolicited received message */ 2117 esp_ble_mesh_model_t *model; /*!< Pointer to the model which receives the message */ 2118 esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the message */ 2119 uint16_t length; /*!< Length of the received message */ 2120 uint8_t *msg; /*!< Value of the received message */ 2121 } client_recv_publish_msg; /*!< Event parameter of ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT */ 2122 /** 2123 * @brief ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT 2124 */ 2125 struct ble_mesh_client_model_send_timeout_param { 2126 uint32_t opcode; /*!< Opcode of the previously sent message */ 2127 esp_ble_mesh_model_t *model; /*!< Pointer to the model which sends the previous message */ 2128 esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the previous message */ 2129 } client_send_timeout; /*!< Event parameter of ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT */ 2130 /** 2131 * @brief ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT 2132 */ 2133 struct ble_mesh_model_publish_update_evt_param { 2134 esp_ble_mesh_model_t *model; /*!< Pointer to the model which is going to update its publish message */ 2135 } model_publish_update; /*!< Event parameter of ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT */ 2136 /** 2137 * @brief ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT 2138 */ 2139 struct ble_mesh_server_model_update_state_comp_param { 2140 int err_code; /*!< Indicate the result of updating server model state */ 2141 esp_ble_mesh_model_t *model; /*!< Pointer to the server model which state value is updated */ 2142 esp_ble_mesh_server_state_type_t type; /*!< Type of the updated server state */ 2143 } server_model_update_state; /*!< Event parameter of ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT */ 2144 } esp_ble_mesh_model_cb_param_t; 2145 2146 #ifdef __cplusplus 2147 } 2148 #endif 2149 2150 #endif /* _ESP_BLE_MESH_DEFS_H_ */