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_NETWORKING_API_H_
8 #define _ESP_BLE_MESH_NETWORKING_API_H_
9 
10 #include "esp_ble_mesh_defs.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /** @brief: event, event code of user-defined model events; param, parameters of user-defined model events */
17 typedef void (* esp_ble_mesh_model_cb_t)(esp_ble_mesh_model_cb_event_t event,
18                                          esp_ble_mesh_model_cb_param_t *param);
19 
20 /**
21  * @brief         Register BLE Mesh callback for user-defined models' operations.
22  *                This callback can report the following events generated for the user-defined models:
23  *                - Call back the messages received by user-defined client and server models to the
24  *                  application layer;
25  *                - If users call esp_ble_mesh_server/client_model_send, this callback notifies the
26  *                  application layer of the send_complete event;
27  *                - If user-defined client model sends a message that requires response, and the response
28  *                  message is received after the timer expires, the response message will be reported
29  *                  to the application layer as published by a peer device;
30  *                - If the user-defined client model fails to receive the response message during a specified
31  *                  period of time, a timeout event will be reported to the application layer.
32  *
33  * @note          The client models (i.e. Config Client model, Health Client model, Generic
34  *                Client models, Sensor Client model, Scene Client model and Lighting Client models)
35  *                that have been realized internally have their specific register functions.
36  *                For example, esp_ble_mesh_register_config_client_callback is the register
37  *                function for Config Client Model.
38  *
39  * @param[in]     callback: Pointer to the callback function.
40  *
41  * @return        ESP_OK on success or error code otherwise.
42  *
43  */
44 esp_err_t esp_ble_mesh_register_custom_model_callback(esp_ble_mesh_model_cb_t callback);
45 
46 /**
47  * @brief        Add the message opcode to the beginning of the model message
48  *               before sending or publishing the model message.
49  *
50  * @note         This API is only used to set the opcode of the message.
51  *
52  * @param[in]    data: Pointer to the message data.
53  * @param[in]    opcode: The message opcode.
54  *
55  * @return       ESP_OK on success or error code otherwise.
56  *
57  */
58 esp_err_t esp_ble_mesh_model_msg_opcode_init(uint8_t *data, uint32_t opcode);
59 
60 /**
61  * @brief         Initialize the user-defined client model. All user-defined client models
62  *                shall call this function to initialize the client model internal data.
63  *                Node: Before calling this API, the op_pair_size and op_pair variabled within
64  *                      the user_data(defined using esp_ble_mesh_client_t_) of the client model
65  *                      need to be initialized.
66  *
67  * @param[in]     model: BLE Mesh Client model to which the message belongs.
68  *
69  * @return        ESP_OK on success or error code otherwise.
70  *
71  */
72 esp_err_t esp_ble_mesh_client_model_init(esp_ble_mesh_model_t *model);
73 
74 /**
75  * @brief         De-initialize the user-defined client model.
76  *
77  * @note          This function shall be invoked before esp_ble_mesh_deinit() is called.
78  *
79  * @param[in]     model: Pointer of the Client model.
80  *
81  * @return        ESP_OK on success or error code otherwise.
82  *
83  */
84 esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model);
85 
86 /**
87  * @brief         Send server model messages(such as server model status messages).
88  *
89  * @param[in]     model: BLE Mesh Server Model to which the message belongs.
90  * @param[in]     ctx:   Message context, includes keys, TTL, etc.
91  * @param[in]     opcode: Message opcode.
92  * @param[in]     length: Message length (exclude the message opcode).
93  * @param[in]     data: Parameters of Access Payload (exclude the message opcode) to be sent.
94  *
95  * @return        ESP_OK on success or error code otherwise.
96  *
97  */
98 esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
99                                              esp_ble_mesh_msg_ctx_t *ctx,
100                                              uint32_t opcode,
101                                              uint16_t length, uint8_t *data);
102 
103 /**
104  * @brief         Send client model message (such as model get, set, etc).
105  *
106  * @param[in]     model: BLE Mesh Client Model to which the message belongs.
107  * @param[in]     ctx:   Message context, includes keys, TTL, etc.
108  * @param[in]     opcode: Message opcode.
109  * @param[in]     length: Message length (exclude the message opcode).
110  * @param[in]     data: Parameters of the Access Payload (exclude the message opcode) to be sent.
111  * @param[in]     msg_timeout: Time to get response to the message (in milliseconds).
112  * @param[in]     need_rsp: TRUE if the opcode requires the peer device to reply, FALSE otherwise.
113  * @param[in]     device_role: Role of the device (Node/Provisioner) that sends the message.
114  *
115  * @return        ESP_OK on success or error code otherwise.
116  *
117  */
118 esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model,
119                                              esp_ble_mesh_msg_ctx_t *ctx,
120                                              uint32_t opcode,
121                                              uint16_t length, uint8_t *data,
122                                              int32_t msg_timeout, bool need_rsp,
123                                              esp_ble_mesh_dev_role_t device_role);
124 
125 /**
126  * @brief         Send a model publication message.
127  *
128  * @note          Before calling this function, the user needs to ensure that the model
129  *                publication message (@ref esp_ble_mesh_model_pub_t.msg) contains a valid
130  *                message to be sent. And if users want to update the publishing message,
131  *                this API should be called in ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT
132  *                with the message updated.
133  *
134  *
135  * @param[in]    model: Mesh (client) Model publishing the message.
136  * @param[in]    opcode: Message opcode.
137  * @param[in]    length: Message length (exclude the message opcode).
138  * @param[in]    data: Parameters of the Access Payload (exclude the message opcode) to be sent.
139  * @param[in]    device_role: Role of the device (node/provisioner) publishing the message of the type esp_ble_mesh_dev_role_t.
140  *
141  * @return       ESP_OK on success or error code otherwise.
142  *
143  */
144 esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcode,
145                                      uint16_t length, uint8_t *data,
146                                      esp_ble_mesh_dev_role_t device_role);
147 
148 /**
149  * @brief        Update a server model state value. If the model publication
150  *               state is set properly (e.g. publish address is set to a valid
151  *               address), it will publish corresponding status message.
152  *
153  * @note         Currently this API is used to update bound state value, not
154  *               for all server model states.
155  *
156  * @param[in]    model: Server model which is going to update the state.
157  * @param[in]    type:  Server model state type.
158  * @param[in]    value: Server model state value.
159  *
160  * @return       ESP_OK on success or error code otherwise.
161  *
162  */
163 esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model,
164                                                  esp_ble_mesh_server_state_type_t type,
165                                                  esp_ble_mesh_server_state_value_t *value);
166 
167 /**
168  * @brief         Reset the provisioning procedure of the local BLE Mesh node.
169  *
170  * @note          All provisioning information in this node will be deleted and the node
171  *                needs to be reprovisioned. The API function esp_ble_mesh_node_prov_enable()
172  *                needs to be called to start a new provisioning procedure.
173  *
174  * @return        ESP_OK on success or error code otherwise.
175  *
176  */
177 esp_err_t esp_ble_mesh_node_local_reset(void);
178 
179 /**
180  * @brief        This function is called to set the node (provisioned device) name.
181  *
182  * @param[in]    index: Index of the node in the node queue.
183  * @param[in]    name: Name (end by '\0') to be set for the node.
184  *
185  * @note         index is obtained from the parameters of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT.
186  *
187  * @return       ESP_OK on success or error code otherwise.
188  *
189  */
190 esp_err_t esp_ble_mesh_provisioner_set_node_name(uint16_t index, const char *name);
191 
192 /**
193  * @brief        This function is called to get the node (provisioned device) name.
194  *
195  * @param[in]    index: Index of the node in the node queue.
196  *
197  * @note         index is obtained from the parameters of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT.
198  *
199  * @return       Node name on success, or NULL on failure.
200  *
201  */
202 const char *esp_ble_mesh_provisioner_get_node_name(uint16_t index);
203 
204 /**
205  * @brief        This function is called to get the node (provisioned device) index.
206  *
207  * @param[in]    name: Name of the node (end by '\0').
208  *
209  * @return       Node index on success, or an invalid value (0xFFFF) on failure.
210  *
211  */
212 uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name);
213 
214 /**
215  * @brief        This function is called to store the Composition Data of the node.
216  *
217  * @param[in]    unicast_addr: Element address of the node
218  * @param[in]    data:         Pointer of Composition Data
219  * @param[in]    length:       Length of Composition Data
220  *
221  * @return       ESP_OK on success or error code otherwise.
222  *
223  */
224 esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr,
225                                                         uint8_t *data, uint16_t length);
226 
227 /**
228  * @brief        This function is called to get the provisioned node information
229  *               with the node device uuid.
230  *
231  * @param[in]    uuid: Device UUID of the node
232  *
233  * @return       Pointer of the node info struct or NULL on failure.
234  *
235  */
236 esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_uuid(const uint8_t uuid[16]);
237 
238 /**
239  * @brief        This function is called to get the provisioned node information
240  *               with the node unicast address.
241  *
242  * @param[in]    unicast_addr: Unicast address of the node
243  *
244  * @return       Pointer of the node info struct or NULL on failure.
245  *
246  */
247 esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_addr(uint16_t unicast_addr);
248 
249 /**
250  * @brief        This function is called to get the provisioned node information
251  *               with the node name.
252  *
253  * @param[in]    name: Name of the node (end by '\0').
254  *
255  * @return       Pointer of the node info struct or NULL on failure.
256  *
257  */
258 esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_name(const char *name);
259 
260 /**
261  * @brief         This function is called by Provisioner to get provisioned node count.
262  *
263  * @return        Number of the provisioned nodes.
264  *
265  */
266 uint16_t esp_ble_mesh_provisioner_get_prov_node_count(void);
267 
268 /**
269  * @brief         This function is called by Provisioner to get the entry of the node table.
270  *
271  * @note          After invoking the function to get the entry of nodes, users can use the "for"
272  *                loop combined with the macro CONFIG_BLE_MESH_MAX_PROV_NODES to get each node's
273  *                information. Before trying to read the node's information, users need to check
274  *                if the node exists, i.e. if the *(esp_ble_mesh_node_t **node) is NULL.
275  *                For example:
276  *                ```
277  *                const esp_ble_mesh_node_t **entry = esp_ble_mesh_provisioner_get_node_table_entry();
278  *                for (int i = 0; i < CONFIG_BLE_MESH_MAX_PROV_NODES; i++) {
279  *                    const esp_ble_mesh_node_t *node = entry[i];
280  *                    if (node) {
281  *                        ......
282  *                    }
283  *                }
284  *                ```
285  *
286  * @return        Pointer to the start of the node table.
287  *
288  */
289 const esp_ble_mesh_node_t **esp_ble_mesh_provisioner_get_node_table_entry(void);
290 
291 /**
292  * @brief        This function is called to delete the provisioned node information
293  *               with the node device uuid.
294  *
295  * @param[in]    uuid: Device UUID of the node
296  *
297  * @return       ESP_OK on success or error code otherwise.
298  *
299  */
300 esp_err_t esp_ble_mesh_provisioner_delete_node_with_uuid(const uint8_t uuid[16]);
301 
302 /**
303  * @brief        This function is called to delete the provisioned node information
304  *               with the node unicast address.
305  *
306  * @param[in]    unicast_addr: Unicast address of the node
307  *
308  * @return       ESP_OK on success or error code otherwise.
309  *
310  */
311 esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr);
312 
313 /**
314  * @brief         This function is called to add a local AppKey for Provisioner.
315  *
316  * @param[in]     app_key: The app key to be set for the local BLE Mesh stack.
317  * @param[in]     net_idx: The network key index.
318  * @param[in]     app_idx: The app key index.
319  *
320  * @note          app_key: If set to NULL, app_key will be generated internally.
321  *                net_idx: Should be an existing one.
322  *                app_idx: If it is going to be generated internally, it should be set to
323  *                         0xFFFF, and the new app_idx will be reported via an event.
324  *
325  * @return        ESP_OK on success or error code otherwise.
326  *
327  */
328 esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
329                                                      uint16_t net_idx, uint16_t app_idx);
330 
331 /**
332  * @brief         This function is used to update a local AppKey for Provisioner.
333  *
334  * @param[in]     app_key: Value of the AppKey.
335  * @param[in]     net_idx: Corresponding NetKey Index.
336  * @param[in]     app_idx: The AppKey Index
337  *
338  * @return        ESP_OK on success or error code otherwise.
339  *
340  */
341 esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16],
342                                                         uint16_t net_idx, uint16_t app_idx);
343 
344 /**
345  * @brief         This function is called by Provisioner to get the local app key value.
346  *
347  * @param[in]     net_idx: Network key index.
348  * @param[in]     app_idx: Application key index.
349  *
350  * @return        App key on success, or NULL on failure.
351  *
352  */
353 const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint16_t app_idx);
354 
355 /**
356  * @brief         This function is called by Provisioner to bind own model with proper app key.
357  *
358  * @param[in]     element_addr: Provisioner local element address
359  * @param[in]     app_idx: Provisioner local appkey index
360  * @param[in]     model_id: Provisioner local model id
361  * @param[in]     company_id: Provisioner local company id
362  *
363  * @note          company_id: If going to bind app_key with local vendor model, company_id
364  *                            should be set to 0xFFFF.
365  *
366  * @return        ESP_OK on success or error code otherwise.
367  *
368  */
369 esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx,
370                                                                uint16_t model_id, uint16_t company_id);
371 
372 /**
373  * @brief         This function is called by Provisioner to add local network key.
374  *
375  * @param[in]     net_key: The network key to be added to the Provisioner local BLE Mesh stack.
376  * @param[in]     net_idx: The network key index.
377  *
378  * @note          net_key: If set to NULL, net_key will be generated internally.
379  *                net_idx: If it is going to be generated internally, it should be set to
380  *                         0xFFFF, and the new net_idx will be reported via an event.
381  *
382  * @return        ESP_OK on success or error code otherwise.
383  *
384  */
385 esp_err_t esp_ble_mesh_provisioner_add_local_net_key(const uint8_t net_key[16], uint16_t net_idx);
386 
387 /**
388  * @brief         This function is called by Provisioner to update a local network key.
389  *
390  * @param[in]     net_key: Value of the NetKey.
391  * @param[in]     net_idx: The NetKey Index.
392  *
393  * @return        ESP_OK on success or error code otherwise.
394  *
395  */
396 esp_err_t esp_ble_mesh_provisioner_update_local_net_key(const uint8_t net_key[16], uint16_t net_idx);
397 
398 /**
399  * @brief         This function is called by Provisioner to get the local network key value.
400  *
401  * @param[in]     net_idx: Network key index.
402  *
403  * @return        Network key on success, or NULL on failure.
404  *
405  */
406 const uint8_t *esp_ble_mesh_provisioner_get_local_net_key(uint16_t net_idx);
407 
408 /**
409  * @brief         This function is called by Provisioner to enable or disable receiving
410  *                heartbeat messages.
411  *
412  * @note          If enabling receiving heartbeat message successfully, the filter will
413  *                be an empty rejectlist by default, which means all heartbeat messages
414  *                received by the Provisioner will be reported to the application layer.
415  *
416  * @param[in]     enable: Enable or disable receiving heartbeat messages.
417  *
418  * @return        ESP_OK on success or error code otherwise.
419  *
420  */
421 esp_err_t esp_ble_mesh_provisioner_recv_heartbeat(bool enable);
422 
423 /**
424  * @brief         This function is called by Provisioner to set the heartbeat filter type.
425  *
426  * @note          1. If the filter type is not the same with the current value, then all the
427  *                   filter entries will be cleaned.
428  *                2. If the previous type is rejectlist, and changed to acceptlist, then the
429  *                   filter will be an empty acceptlist, which means no heartbeat messages
430  *                   will be reported. Users need to add SRC or DST into the filter entry,
431  *                   then heartbeat messages from the SRC or to the DST will be reported.
432  *
433  * @param[in]     type: Heartbeat filter type (acceptlist or rejectlist).
434  *
435  * @return        ESP_OK on success or error code otherwise.
436  *
437  */
438 esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_type(uint8_t type);
439 
440 /**
441  * @brief         This function is called by Provisioner to add or remove a heartbeat filter entry.
442  *
443  * @note          1. If the operation is "ADD", the "hb_src" can be set to the SRC (can only be a
444  *                   unicast address) of heartbeat messages, and the "hb_dst" can be set to the
445  *                   DST (unicast address or group address), at least one of them needs to be set.
446  *                   - If only one of them is set, the filter entry will only use the configured
447  *                     SRC or DST to filter heartbeat messages.
448  *                   - If both of them are set, the SRC and DST will both be used to decide if a
449  *                     heartbeat message will be handled.
450  *                   - If SRC or DST already exists in some filter entry, then the corresponding
451  *                     entry will be cleaned firstly, then a new entry will be allocated to store
452  *                     the information.
453  *                2. If the operation is "REMOVE", the "hb_src" can be set to the SRC (can only be
454  *                   a unicast address) of heartbeat messages, and the "hb_dst" can be set to the
455  *                   DST (unicast address or group address), at least one of them needs to be set.
456  *                   - The filter entry with the same SRC or DST will be removed.
457  *
458  * @param[in]     op:   Add or REMOVE
459  * @param[in]     info: Heartbeat filter entry information, including:
460  *                      hb_src - Heartbeat source address;
461  *                      hb_dst - Heartbeat destination address;
462  *
463  * @return        ESP_OK on success or error code otherwise.
464  *
465  */
466 esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_info(uint8_t op, esp_ble_mesh_heartbeat_filter_info_t *info);
467 
468 /**
469  * @brief         This function is called by Provisioner to directly erase the mesh
470  *                information from nvs namespace.
471  *
472  * @note          This function can be invoked when the mesh stack is not initialized
473  *                or has been de-initialized.
474  *
475  * @return        ESP_OK on success or error code otherwise.
476  *
477  */
478 esp_err_t esp_ble_mesh_provisioner_direct_erase_settings(void);
479 
480 /**
481  * @brief         This function is called by Provisioner to open a nvs namespace
482  *                for storing mesh information.
483  *
484  * @note          Before open another nvs namespace, the previously opened nvs
485  *                namespace must be closed firstly.
486  *
487  * @param[in]     index: Settings index.
488  *
489  * @return        ESP_OK on success or error code otherwise.
490  *
491  */
492 esp_err_t esp_ble_mesh_provisioner_open_settings_with_index(uint8_t index);
493 
494 /**
495  * @brief         This function is called by Provisioner to open a nvs namespace
496  *                for storing mesh information.
497  *
498  * @note          Before open another nvs namespace, the previously opened nvs
499  *                namespace must be closed firstly.
500  *
501  * @param[in]     uid: Settings user id.
502  *
503  * @return        ESP_OK on success or error code otherwise.
504  *
505  */
506 esp_err_t esp_ble_mesh_provisioner_open_settings_with_uid(const char *uid);
507 
508 /**
509  * @brief         This function is called by Provisioner to close a nvs namespace
510  *                which is opened previously for storing mesh information.
511  *
512  * @note          1. Before closing the nvs namespace, it must be open.
513  *                2. When the function is invoked, the Provisioner functionality
514  *                   will be disabled firstly, and:
515  *                   a) If the "erase" flag is set to false, the mesh information
516  *                      will be cleaned (e.g. removing NetKey, AppKey, nodes, etc)
517  *                      from the mesh stack.
518  *                   b) If the "erase" flag is set to true, the mesh information
519  *                      stored in the nvs namespace will also be erased besides
520  *                      been cleaned from the mesh stack.
521  *                3. If Provisioner tries to work properly again, we can invoke the
522  *                   open function to open a new nvs namespace or a previously added
523  *                   one, and restore the mesh information from it if not erased.
524  *                4. The working process shall be as following:
525  *                   a) Open settings A
526  *                   b) Start to provision and control nodes
527  *                   c) Close settings A
528  *                   d) Open settings B
529  *                   e) Start to provision and control other nodes
530  *                   f) Close settings B
531  *                   g) ......
532  *
533  * @param[in]     index: Settings index.
534  * @param[in]     erase: Indicate if erasing mesh information.
535  *
536  * @return        ESP_OK on success or error code otherwise.
537  *
538  */
539 esp_err_t esp_ble_mesh_provisioner_close_settings_with_index(uint8_t index, bool erase);
540 
541 /**
542  * @brief         This function is called by Provisioner to close a nvs namespace
543  *                which is opened previously for storing mesh information.
544  *
545  * @note          1. Before closing the nvs namespace, it must be open.
546  *                2. When the function is invoked, the Provisioner functionality
547  *                   will be disabled firstly, and:
548  *                   a) If the "erase" flag is set to false, the mesh information
549  *                      will be cleaned (e.g. removing NetKey, AppKey, nodes, etc)
550  *                      from the mesh stack.
551  *                   b) If the "erase" flag is set to true, the mesh information
552  *                      stored in the nvs namespace will also be erased besides
553  *                      been cleaned from the mesh stack.
554  *                3. If Provisioner tries to work properly again, we can invoke the
555  *                   open function to open a new nvs namespace or a previously added
556  *                   one, and restore the mesh information from it if not erased.
557  *                4. The working process shall be as following:
558  *                   a) Open settings A
559  *                   b) Start to provision and control nodes
560  *                   c) Close settings A
561  *                   d) Open settings B
562  *                   e) Start to provision and control other nodes
563  *                   f) Close settings B
564  *                   g) ......
565  *
566  * @param[in]     uid: Settings user id.
567  * @param[in]     erase: Indicate if erasing mesh information.
568  *
569  * @return        ESP_OK on success or error code otherwise.
570  *
571  */
572 esp_err_t esp_ble_mesh_provisioner_close_settings_with_uid(const char *uid, bool erase);
573 
574 /**
575  * @brief         This function is called by Provisioner to erase the mesh information
576  *                and settings user id from a nvs namespace.
577  *
578  * @note          When this function is called, the nvs namespace must not be open.
579  *                This function is used to erase the mesh information and settings
580  *                user id which are not used currently.
581  *
582  * @param[in]     index: Settings index.
583  *
584  * @return        ESP_OK on success or error code otherwise.
585  *
586  */
587 esp_err_t esp_ble_mesh_provisioner_delete_settings_with_index(uint8_t index);
588 
589 /**
590  * @brief         This function is called by Provisioner to erase the mesh information
591  *                and settings user id from a nvs namespace.
592  *
593  * @note          When this function is called, the nvs namespace must not be open.
594  *                This function is used to erase the mesh information and settings
595  *                user id which are not used currently.
596  *
597  * @param[in]     uid: Settings user id.
598  *
599  * @return        ESP_OK on success or error code otherwise.
600  *
601  */
602 esp_err_t esp_ble_mesh_provisioner_delete_settings_with_uid(const char *uid);
603 
604 /**
605  * @brief         This function is called by Provisioner to get settings user id.
606  *
607  * @param[in]     index: Settings index.
608  *
609  * @return        Setting user id on success or NULL on failure.
610  *
611  */
612 const char *esp_ble_mesh_provisioner_get_settings_uid(uint8_t index);
613 
614 /**
615  * @brief         This function is called by Provisioner to get settings index.
616  *
617  * @param[in]     uid: Settings user id.
618  *
619  * @return        Settings index.
620  *
621  */
622 uint8_t esp_ble_mesh_provisioner_get_settings_index(const char *uid);
623 
624 /**
625  * @brief         This function is called by Provisioner to get the number of free
626  *                settings user id.
627  *
628  * @return        Number of free settings user id.
629  *
630  */
631 uint8_t esp_ble_mesh_provisioner_get_free_settings_count(void);
632 
633 /**
634  * @brief         This function is called to get fast provisioning application key.
635  *
636  * @param[in]     net_idx: Network key index.
637  * @param[in]     app_idx: Application key index.
638  *
639  * @return        Application key on success, or NULL on failure.
640  *
641  */
642 const uint8_t *esp_ble_mesh_get_fast_prov_app_key(uint16_t net_idx, uint16_t app_idx);
643 
644 #ifdef __cplusplus
645 }
646 #endif
647 
648 #endif /* _ESP_BLE_MESH_NETWORKING_API_H_ */
649