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