summaryrefslogtreecommitdiff
path: root/lib/bt/esp_ble_mesh/api
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-03-28 14:32:49 +1100
committerjacqueline <me@jacqueline.id.au>2024-03-28 14:32:49 +1100
commitee29c25b29eaa4fac4e897442634b69ecc8d8125 (patch)
tree8c5f1a140463f20f104316fa3492984e191154e9 /lib/bt/esp_ble_mesh/api
parent239e6d89507a24c849385f4bfa93ac4ad58e5de5 (diff)
downloadtangara-fw-ee29c25b29eaa4fac4e897442634b69ecc8d8125.tar.gz
Fork ESP-IDF's bluetooth component
i want better sbc encoding, and no cla will stop me
Diffstat (limited to 'lib/bt/esp_ble_mesh/api')
-rw-r--r--lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c102
-rw-r--r--lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c110
-rw-r--r--lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c221
-rw-r--r--lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c55
-rw-r--r--lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c853
-rw-r--r--lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c530
-rw-r--r--lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c249
-rw-r--r--lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_ble_api.h182
-rw-r--r--lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_common_api.h49
-rw-r--r--lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_local_data_operation_api.h225
-rw-r--r--lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_low_power_api.h61
-rw-r--r--lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_networking_api.h697
-rw-r--r--lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_provisioning_api.h394
-rw-r--r--lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_proxy_api.h170
-rw-r--r--lib/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h2507
-rw-r--r--lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c97
-rw-r--r--lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c94
-rw-r--r--lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c101
-rw-r--r--lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c81
-rw-r--r--lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c80
-rw-r--r--lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c81
-rw-r--r--lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_config_model_api.h832
-rw-r--r--lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_generic_model_api.h1296
-rw-r--r--lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_health_model_api.h406
-rw-r--r--lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_lighting_model_api.h1674
-rw-r--r--lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_sensor_model_api.h709
-rw-r--r--lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_time_scene_model_api.h911
27 files changed, 12767 insertions, 0 deletions
diff --git a/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c
new file mode 100644
index 00000000..559528e8
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c
@@ -0,0 +1,102 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "esp_err.h"
+
+#include "btc_ble_mesh_ble.h"
+#include "esp_ble_mesh_ble_api.h"
+
+#if CONFIG_BLE_MESH_BLE_COEX_SUPPORT
+esp_err_t esp_ble_mesh_register_ble_callback(esp_ble_mesh_ble_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_BLE_MESH_BLE_COEX, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_BLE_COEX_SUPPORT */
+
+#if CONFIG_BLE_MESH_SUPPORT_BLE_ADV
+esp_err_t esp_ble_mesh_start_ble_advertising(const esp_ble_mesh_ble_adv_param_t *param,
+ const esp_ble_mesh_ble_adv_data_t *data)
+{
+ btc_ble_mesh_ble_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (param == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_BLE_MESH_BLE_COEX;
+ msg.act = BTC_BLE_MESH_ACT_START_BLE_ADV;
+
+ memcpy(&arg.start_ble_adv.param, param, sizeof(esp_ble_mesh_ble_adv_param_t));
+ if (data) {
+ memcpy(&arg.start_ble_adv.data, data, sizeof(esp_ble_mesh_ble_adv_data_t));
+ }
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_stop_ble_advertising(uint8_t index)
+{
+ btc_ble_mesh_ble_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (index >= CONFIG_BLE_MESH_BLE_ADV_BUF_COUNT) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_BLE_MESH_BLE_COEX;
+ msg.act = BTC_BLE_MESH_ACT_STOP_BLE_ADV;
+
+ arg.stop_ble_adv.index = index;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */
+
+#if CONFIG_BLE_MESH_SUPPORT_BLE_SCAN
+esp_err_t esp_ble_mesh_start_ble_scanning(esp_ble_mesh_ble_scan_param_t *param)
+{
+ btc_ble_mesh_ble_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_BLE_MESH_BLE_COEX;
+ msg.act = BTC_BLE_MESH_ACT_START_BLE_SCAN;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_stop_ble_scanning(void)
+{
+ btc_ble_mesh_ble_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_BLE_MESH_BLE_COEX;
+ msg.act = BTC_BLE_MESH_ACT_STOP_BLE_SCAN;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_ble_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_SUPPORT_BLE_SCAN */
diff --git a/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c
new file mode 100644
index 00000000..9a12de17
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c
@@ -0,0 +1,110 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "freertos/FreeRTOS.h"
+#include "freertos/semphr.h"
+
+#include "esp_err.h"
+
+#include "btc_ble_mesh_prov.h"
+#include "esp_ble_mesh_defs.h"
+
+esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ SemaphoreHandle_t semaphore = NULL;
+ btc_msg_t msg = {0};
+ esp_err_t ret = ESP_OK;
+
+ if (prov == NULL || comp == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ ret = bt_mesh_host_init();
+ if (ret != ESP_OK) {
+ return ret;
+ }
+
+ // Create a semaphore
+ if ((semaphore = xSemaphoreCreateCounting(1, 0)) == NULL) {
+ BT_ERR("Failed to create semaphore");
+ return ESP_ERR_NO_MEM;
+ }
+
+ arg.mesh_init.prov = prov;
+ arg.mesh_init.comp = comp;
+ /* Transport semaphore pointer to BTC layer, and will give the semaphore in the BTC task */
+ arg.mesh_init.semaphore = semaphore;
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_MESH_INIT;
+
+ if (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) != BT_STATUS_SUCCESS) {
+ vSemaphoreDelete(semaphore);
+ BT_ERR("Failed to start mesh init");
+ return ESP_FAIL;
+ }
+
+ /* Take the Semaphore, wait BLE Mesh initialization to finish. */
+ xSemaphoreTake(semaphore, portMAX_DELAY);
+ /* Don't forget to delete the semaphore at the end. */
+ vSemaphoreDelete(semaphore);
+
+ return ESP_OK;
+}
+
+#if CONFIG_BLE_MESH_DEINIT
+esp_err_t esp_ble_mesh_deinit(esp_ble_mesh_deinit_param_t *param)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ SemaphoreHandle_t semaphore = NULL;
+ btc_msg_t msg = {0};
+ esp_err_t ret = ESP_OK;
+
+ if (param == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ // Create a semaphore
+ if ((semaphore = xSemaphoreCreateCounting(1, 0)) == NULL) {
+ BT_ERR("Failed to create semaphore");
+ return ESP_ERR_NO_MEM;
+ }
+
+ arg.mesh_deinit.param.erase_flash = param->erase_flash;
+ /* Transport semaphore pointer to BTC layer, and will give the semaphore in the BTC task */
+ arg.mesh_deinit.semaphore = semaphore;
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_DEINIT_MESH;
+
+ if (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) != BT_STATUS_SUCCESS) {
+ vSemaphoreDelete(semaphore);
+ BT_ERR("Failed to start mesh deinit");
+ return ESP_FAIL;
+ }
+
+ /* Take the Semaphore, wait BLE Mesh de-initialization to finish. */
+ xSemaphoreTake(semaphore, portMAX_DELAY);
+ /* Don't forget to delete the semaphore at the end. */
+ vSemaphoreDelete(semaphore);
+
+ ret = bt_mesh_host_deinit();
+ if (ret != ESP_OK) {
+ return ret;
+ }
+
+ return ESP_OK;
+}
+#endif /* CONFIG_BLE_MESH_DEINIT */
diff --git a/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c
new file mode 100644
index 00000000..e4f2e67b
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c
@@ -0,0 +1,221 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "esp_err.h"
+
+#include "btc_ble_mesh_prov.h"
+#include "esp_ble_mesh_defs.h"
+
+int32_t esp_ble_mesh_get_model_publish_period(esp_ble_mesh_model_t *model)
+{
+ if (model == NULL) {
+ return 0;
+ }
+
+ return btc_ble_mesh_model_pub_period_get(model);
+}
+
+uint16_t esp_ble_mesh_get_primary_element_address(void)
+{
+ return btc_ble_mesh_get_primary_addr();
+}
+
+uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model,
+ uint16_t group_addr)
+{
+ if (model == NULL) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_model_find_group(model, group_addr);
+}
+
+esp_ble_mesh_elem_t *esp_ble_mesh_find_element(uint16_t element_addr)
+{
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(element_addr)) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_elem_find(element_addr);
+}
+
+uint8_t esp_ble_mesh_get_element_count(void)
+{
+ return btc_ble_mesh_elem_count();
+}
+
+esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *element,
+ uint16_t company_id, uint16_t model_id)
+{
+ if (element == NULL) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_model_find_vnd(element, company_id, model_id);
+}
+
+esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element,
+ uint16_t model_id)
+{
+ if (element == NULL) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_model_find(element, model_id);
+}
+
+const esp_ble_mesh_comp_t *esp_ble_mesh_get_composition_data(void)
+{
+ return btc_ble_mesh_comp_get();
+}
+
+esp_err_t esp_ble_mesh_model_subscribe_group_addr(uint16_t element_addr, uint16_t company_id,
+ uint16_t model_id, uint16_t group_addr)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(element_addr) ||
+ !ESP_BLE_MESH_ADDR_IS_GROUP(group_addr)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_MODEL_SUBSCRIBE_GROUP_ADDR;
+
+ arg.model_sub_group_addr.element_addr = element_addr;
+ arg.model_sub_group_addr.company_id = company_id;
+ arg.model_sub_group_addr.model_id = model_id;
+ arg.model_sub_group_addr.group_addr = group_addr;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_model_unsubscribe_group_addr(uint16_t element_addr, uint16_t company_id,
+ uint16_t model_id, uint16_t group_addr)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(element_addr) ||
+ !ESP_BLE_MESH_ADDR_IS_GROUP(group_addr)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_MODEL_UNSUBSCRIBE_GROUP_ADDR;
+
+ arg.model_unsub_group_addr.element_addr = element_addr;
+ arg.model_unsub_group_addr.company_id = company_id;
+ arg.model_unsub_group_addr.model_id = model_id;
+ arg.model_unsub_group_addr.group_addr = group_addr;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+#if CONFIG_BLE_MESH_DF_SRV
+esp_err_t esp_ble_mesh_enable_directed_forwarding(uint16_t net_idx, bool directed_forwarding,
+ bool directed_forwarding_relay)
+{
+ return btc_ble_mesh_enable_directed_forwarding(net_idx, directed_forwarding,
+ directed_forwarding_relay);
+}
+#endif /* CONFIG_BLE_MESH_DF_SRV */
+
+#if CONFIG_BLE_MESH_NODE
+
+const uint8_t *esp_ble_mesh_node_get_local_net_key(uint16_t net_idx)
+{
+ return btc_ble_mesh_node_get_local_net_key(net_idx);
+}
+
+const uint8_t *esp_ble_mesh_node_get_local_app_key(uint16_t app_idx)
+{
+ return btc_ble_mesh_node_get_local_app_key(app_idx);
+}
+
+esp_err_t esp_ble_mesh_node_add_local_net_key(const uint8_t net_key[16], uint16_t net_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (net_key == NULL || net_idx > 0xFFF) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_NODE_ADD_LOCAL_NET_KEY;
+
+ arg.node_add_local_net_key.net_idx = net_idx;
+ memcpy(arg.node_add_local_net_key.net_key, net_key, 16);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_node_add_local_app_key(const uint8_t app_key[16], uint16_t net_idx, uint16_t app_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (app_key == NULL || net_idx > 0xFFF || app_idx > 0xFFF) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_NODE_ADD_LOCAL_APP_KEY;
+
+ arg.node_add_local_app_key.net_idx = net_idx;
+ arg.node_add_local_app_key.app_idx = app_idx;
+ memcpy(arg.node_add_local_app_key.app_key, app_key, 16);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_node_bind_app_key_to_local_model(uint16_t element_addr, uint16_t company_id,
+ uint16_t model_id, uint16_t app_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(element_addr) || app_idx > 0xFFF) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_NODE_BIND_APP_KEY_TO_MODEL;
+
+ arg.node_local_mod_app_bind.element_addr = element_addr;
+ arg.node_local_mod_app_bind.model_id = model_id;
+ arg.node_local_mod_app_bind.company_id = company_id;
+ arg.node_local_mod_app_bind.app_idx = app_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+#endif /* CONFIG_BLE_MESH_NODE */
diff --git a/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c
new file mode 100644
index 00000000..a030b636
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c
@@ -0,0 +1,55 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "esp_err.h"
+
+#include "btc_ble_mesh_prov.h"
+#include "esp_ble_mesh_defs.h"
+
+esp_err_t esp_ble_mesh_lpn_enable(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_LPN_ENABLE;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_lpn_disable(bool force)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_LPN_DISABLE;
+
+ arg.lpn_disable.force = force;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_lpn_poll(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_LPN_POLL;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
diff --git a/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c
new file mode 100644
index 00000000..16b0805d
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c
@@ -0,0 +1,853 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "esp_err.h"
+
+#include "btc_ble_mesh_prov.h"
+#include "esp_ble_mesh_networking_api.h"
+
+#define ESP_BLE_MESH_TX_SDU_MAX ((CONFIG_BLE_MESH_ADV_BUF_COUNT - 3) * 12)
+
+static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
+ esp_ble_mesh_msg_ctx_t *ctx,
+ uint32_t opcode,
+ btc_ble_mesh_model_act_t act,
+ uint16_t length, uint8_t *data,
+ int32_t msg_timeout, bool need_rsp,
+ esp_ble_mesh_dev_role_t device_role)
+{
+ btc_ble_mesh_model_args_t arg = {0};
+ uint8_t op_len = 0, mic_len = 0;
+ uint8_t *msg_data = NULL;
+ btc_msg_t msg = {0};
+ esp_err_t status = ESP_OK;
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ if (ctx && ctx->addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ BT_ERR("Invalid destination address 0x0000");
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ /* When data is NULL, it is mandatory to set length to 0 to prevent users from misinterpreting parameters. */
+ if (data == NULL) {
+ length = 0;
+ }
+
+ if (opcode < 0x100) {
+ op_len = 1;
+ } else if (opcode < 0x10000) {
+ op_len = 2;
+ } else {
+ op_len = 3;
+ }
+
+ if (act == BTC_BLE_MESH_ACT_MODEL_PUBLISH) {
+ if (op_len + length > model->pub->msg->size) {
+ BT_ERR("Too small publication msg size %d", model->pub->msg->size);
+ return ESP_ERR_INVALID_ARG;
+ }
+ }
+
+ if (act == BTC_BLE_MESH_ACT_MODEL_PUBLISH) {
+ /* When "send_rel" is true and "send_szmic" is 1, 8-octets TransMIC will
+ * be used, otherwise 4-octets TransMIC will be used.
+ */
+ mic_len = (model->pub->send_rel && model->pub->send_szmic) ?
+ ESP_BLE_MESH_MIC_LONG : ESP_BLE_MESH_MIC_SHORT;
+ } else {
+ /* When the message is tagged with the send-segmented tag and "send_szmic"
+ * is 1, 8-octets TransMIC will be used, otherwise 4-octets TransMIC will
+ * be used.
+ */
+ mic_len = ((ctx->send_tag & ESP_BLE_MESH_TAG_SEND_SEGMENTED) && ctx->send_szmic) ?
+ ESP_BLE_MESH_MIC_LONG : ESP_BLE_MESH_MIC_SHORT;
+ }
+
+ if (op_len + length + mic_len > MIN(ESP_BLE_MESH_SDU_MAX_LEN, ESP_BLE_MESH_TX_SDU_MAX)) {
+ BT_ERR("Too large data length %d", length);
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ if (act == BTC_BLE_MESH_ACT_MODEL_PUBLISH) {
+ bt_mesh_model_msg_init(model->pub->msg, opcode);
+ net_buf_simple_add_mem(model->pub->msg, data, length);
+ } else {
+ msg_data = (uint8_t *)bt_mesh_malloc(op_len + length);
+ if (msg_data == NULL) {
+ return ESP_ERR_NO_MEM;
+ }
+ esp_ble_mesh_model_msg_opcode_init(msg_data, opcode);
+ memcpy(msg_data + op_len, data, length);
+ }
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_MODEL;
+ msg.act = act;
+
+ if (act == BTC_BLE_MESH_ACT_MODEL_PUBLISH) {
+ arg.model_publish.model = model;
+ } else {
+ arg.model_send.model = model;
+ arg.model_send.ctx = ctx;
+ arg.model_send.need_rsp = need_rsp;
+ arg.model_send.opcode = opcode;
+ arg.model_send.length = op_len + length;
+ arg.model_send.data = msg_data;
+ arg.model_send.msg_timeout = msg_timeout;
+ }
+
+ status = (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_model_args_t), btc_ble_mesh_model_arg_deep_copy,
+ btc_ble_mesh_model_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+
+ bt_mesh_free(msg_data);
+
+ return status;
+}
+
+esp_err_t esp_ble_mesh_register_custom_model_callback(esp_ble_mesh_model_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_MODEL, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_model_msg_opcode_init(uint8_t *data, uint32_t opcode)
+{
+ uint16_t val = 0;
+
+ if (data == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ if (opcode < 0x100) {
+ /* 1-byte OpCode */
+ data[0] = opcode & 0xff;
+ return ESP_OK;
+ }
+
+ if (opcode < 0x10000) {
+ /* 2-byte OpCode, big endian */
+ val = sys_cpu_to_be16 (opcode);
+ memcpy(data, &val, 2);
+ return ESP_OK;
+ }
+
+ /* 3-byte OpCode, note that little endian for the least 2 bytes(Company ID) of opcode */
+ data[0] = (opcode >> 16) & 0xff;
+ val = sys_cpu_to_le16(opcode & 0xffff);
+ memcpy(&data[1], &val, 2);
+
+ return ESP_OK;
+}
+
+esp_err_t esp_ble_mesh_client_model_init(esp_ble_mesh_model_t *model)
+{
+ if (model == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return btc_ble_mesh_client_model_init(model);
+}
+
+#if CONFIG_BLE_MESH_DEINIT
+esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model)
+{
+ if (model == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return btc_ble_mesh_client_model_deinit(model);
+}
+#endif /* CONFIG_BLE_MESH_DEINIT */
+
+esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
+ esp_ble_mesh_msg_ctx_t *ctx,
+ uint32_t opcode,
+ uint16_t length, uint8_t *data)
+{
+ if (model == NULL || ctx == NULL ||
+ ctx->net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ ctx->app_idx == ESP_BLE_MESH_KEY_UNUSED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ return ble_mesh_model_send_msg(model, ctx, opcode, BTC_BLE_MESH_ACT_SERVER_MODEL_SEND,
+ length, data, 0, false, ROLE_NODE);
+}
+
+esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model,
+ esp_ble_mesh_msg_ctx_t *ctx,
+ uint32_t opcode,
+ uint16_t length, uint8_t *data,
+ int32_t msg_timeout, bool need_rsp,
+ esp_ble_mesh_dev_role_t device_role)
+{
+ if (model == NULL || ctx == NULL ||
+ ctx->net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ ctx->app_idx == ESP_BLE_MESH_KEY_UNUSED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ return ble_mesh_model_send_msg(model, ctx, opcode, BTC_BLE_MESH_ACT_CLIENT_MODEL_SEND,
+ length, data, msg_timeout, need_rsp, device_role);
+}
+
+esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcode,
+ uint16_t length, uint8_t *data,
+ esp_ble_mesh_dev_role_t device_role)
+{
+ if (model == NULL || model->pub == NULL || model->pub->msg == NULL ||
+ model->pub->publish_addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ return ble_mesh_model_send_msg(model, NULL, opcode, BTC_BLE_MESH_ACT_MODEL_PUBLISH,
+ length, data, 0, false, device_role);
+}
+
+#if CONFIG_BLE_MESH_SERVER_MODEL
+esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model,
+ esp_ble_mesh_server_state_type_t type,
+ esp_ble_mesh_server_state_value_t *value)
+{
+ btc_ble_mesh_model_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!model || !value || type >= ESP_BLE_MESH_SERVER_MODEL_STATE_MAX) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ arg.model_update_state.model = model;
+ arg.model_update_state.type = type;
+ arg.model_update_state.value = value;
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_MODEL;
+ msg.act = BTC_BLE_MESH_ACT_SERVER_MODEL_UPDATE_STATE;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_model_args_t), btc_ble_mesh_model_arg_deep_copy,
+ btc_ble_mesh_model_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_SERVER_MODEL */
+
+esp_err_t esp_ble_mesh_node_local_reset(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_NODE_RESET;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+#if CONFIG_BLE_MESH_PROVISIONER
+esp_err_t esp_ble_mesh_provisioner_set_node_name(uint16_t index, const char *name)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!name || (strlen(name) > ESP_BLE_MESH_NODE_NAME_MAX_LEN)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_NODE_NAME;
+
+ arg.set_node_name.index = index;
+ memset(arg.set_node_name.name, 0, sizeof(arg.set_node_name.name));
+ strncpy(arg.set_node_name.name, name, ESP_BLE_MESH_NODE_NAME_MAX_LEN);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+const char *esp_ble_mesh_provisioner_get_node_name(uint16_t index)
+{
+ return bt_mesh_provisioner_get_node_name(index);
+}
+
+uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name)
+{
+ if (!name || (strlen(name) > ESP_BLE_MESH_NODE_NAME_MAX_LEN)) {
+ return ESP_BLE_MESH_INVALID_NODE_INDEX;
+ }
+
+ return bt_mesh_provisioner_get_node_index(name);
+}
+
+esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr,
+ uint8_t *data, uint16_t length)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(unicast_addr) || !data || length <= 14) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_STORE_NODE_COMP_DATA;
+
+ arg.store_node_comp_data.unicast_addr = unicast_addr;
+ arg.store_node_comp_data.length = length;
+ arg.store_node_comp_data.data = data;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy,
+ btc_ble_mesh_prov_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_uuid(const uint8_t uuid[16])
+{
+ if (!uuid) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_provisioner_get_node_with_uuid(uuid);
+}
+
+esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_addr(uint16_t unicast_addr)
+{
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(unicast_addr)) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_provisioner_get_node_with_addr(unicast_addr);
+}
+
+esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_name(const char *name)
+{
+ if (!name || (strlen(name) > ESP_BLE_MESH_NODE_NAME_MAX_LEN)) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_provisioner_get_node_with_name(name);
+}
+
+uint16_t esp_ble_mesh_provisioner_get_prov_node_count(void)
+{
+ return btc_ble_mesh_provisioner_get_prov_node_count();
+}
+
+const esp_ble_mesh_node_t **esp_ble_mesh_provisioner_get_node_table_entry(void)
+{
+ return btc_ble_mesh_provisioner_get_node_table_entry();
+}
+
+esp_err_t esp_ble_mesh_provisioner_delete_node_with_uuid(const uint8_t uuid[16])
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!uuid) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DELETE_NODE_WITH_UUID;
+
+ memcpy(arg.delete_node_with_uuid.uuid, uuid, 16);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(unicast_addr)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DELETE_NODE_WITH_ADDR;
+
+ arg.delete_node_with_addr.unicast_addr = unicast_addr;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
+ uint16_t net_idx, uint16_t app_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_ADD_LOCAL_APP_KEY;
+
+ arg.add_local_app_key.net_idx = net_idx;
+ arg.add_local_app_key.app_idx = app_idx;
+ if (app_key) {
+ memcpy(arg.add_local_app_key.app_key, app_key, 16);
+ } else {
+ bzero(arg.add_local_app_key.app_key, 16);
+ }
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16],
+ uint16_t net_idx, uint16_t app_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (app_key == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_UPDATE_LOCAL_APP_KEY;
+
+ memcpy(arg.update_local_app_key.app_key, app_key, 16);
+ arg.update_local_app_key.net_idx = net_idx;
+ arg.update_local_app_key.app_idx = app_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint16_t app_idx)
+{
+ return bt_mesh_provisioner_local_app_key_get(net_idx, app_idx);
+}
+
+esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx,
+ uint16_t model_id, uint16_t company_id)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(element_addr)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_BIND_LOCAL_MOD_APP;
+
+ arg.local_mod_app_bind.elem_addr = element_addr;
+ arg.local_mod_app_bind.app_idx = app_idx;
+ arg.local_mod_app_bind.model_id = model_id;
+ arg.local_mod_app_bind.cid = company_id;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_add_local_net_key(const uint8_t net_key[16], uint16_t net_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (net_idx == ESP_BLE_MESH_KEY_PRIMARY) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_ADD_LOCAL_NET_KEY;
+
+ arg.add_local_net_key.net_idx = net_idx;
+ if (net_key) {
+ memcpy(arg.add_local_net_key.net_key, net_key, 16);
+ } else {
+ bzero(arg.add_local_net_key.net_key, 16);
+ }
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_update_local_net_key(const uint8_t net_key[16], uint16_t net_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (net_key == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_UPDATE_LOCAL_NET_KEY;
+
+ memcpy(arg.update_local_net_key.net_key, net_key, 16);
+ arg.update_local_net_key.net_idx = net_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+const uint8_t *esp_ble_mesh_provisioner_get_local_net_key(uint16_t net_idx)
+{
+ return bt_mesh_provisioner_net_key_get(net_idx);
+}
+
+#if CONFIG_BLE_MESH_PROVISIONER_RECV_HB
+esp_err_t esp_ble_mesh_provisioner_recv_heartbeat(bool enable)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_ENABLE_HEARTBEAT_RECV;
+
+ arg.enable_heartbeat_recv.enable = enable;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_type(uint8_t type)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (type > ESP_BLE_MESH_HEARTBEAT_FILTER_REJECTLIST) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE;
+
+ arg.set_heartbeat_filter_type.type = type;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_info(uint8_t op, esp_ble_mesh_heartbeat_filter_info_t *info)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (op > ESP_BLE_MESH_HEARTBEAT_FILTER_REMOVE || info == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(info->hb_src) &&
+ !ESP_BLE_MESH_ADDR_IS_UNICAST(info->hb_dst) &&
+ !ESP_BLE_MESH_ADDR_IS_GROUP(info->hb_dst)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_HEARTBEAT_FILTER_INFO;
+
+ arg.set_heartbeat_filter_info.op = op;
+ arg.set_heartbeat_filter_info.hb_src = info->hb_src;
+ arg.set_heartbeat_filter_info.hb_dst = info->hb_dst;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_PROVISIONER_RECV_HB */
+
+#if CONFIG_BLE_MESH_SETTINGS
+esp_err_t esp_ble_mesh_provisioner_direct_erase_settings(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DIRECT_ERASE_SETTINGS;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_SETTINGS */
+
+#if CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE
+esp_err_t esp_ble_mesh_provisioner_open_settings_with_index(uint8_t index)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (index >= CONFIG_BLE_MESH_MAX_NVS_NAMESPACE) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_OPEN_SETTINGS_WITH_INDEX;
+
+ arg.open_settings_with_index.index = index;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_open_settings_with_uid(const char *uid)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!uid || strlen(uid) > ESP_BLE_MESH_SETTINGS_UID_SIZE) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_OPEN_SETTINGS_WITH_UID;
+
+ strncpy(arg.open_settings_with_uid.uid, uid, ESP_BLE_MESH_SETTINGS_UID_SIZE);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_close_settings_with_index(uint8_t index, bool erase)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (index >= CONFIG_BLE_MESH_MAX_NVS_NAMESPACE) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_CLOSE_SETTINGS_WITH_INDEX;
+
+ arg.close_settings_with_index.index = index;
+ arg.close_settings_with_index.erase = erase;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_close_settings_with_uid(const char *uid, bool erase)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!uid || strlen(uid) > ESP_BLE_MESH_SETTINGS_UID_SIZE) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_CLOSE_SETTINGS_WITH_UID;
+
+ strncpy(arg.close_settings_with_uid.uid, uid, ESP_BLE_MESH_SETTINGS_UID_SIZE);
+ arg.close_settings_with_uid.erase = erase;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_delete_settings_with_index(uint8_t index)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (index >= CONFIG_BLE_MESH_MAX_NVS_NAMESPACE) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DELETE_SETTINGS_WITH_INDEX;
+
+ arg.delete_settings_with_index.index = index;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_delete_settings_with_uid(const char *uid)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!uid || strlen(uid) > ESP_BLE_MESH_SETTINGS_UID_SIZE) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DELETE_SETTINGS_WITH_UID;
+
+ strncpy(arg.delete_settings_with_uid.uid, uid, ESP_BLE_MESH_SETTINGS_UID_SIZE);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+const char *esp_ble_mesh_provisioner_get_settings_uid(uint8_t index)
+{
+ if (index >= CONFIG_BLE_MESH_MAX_NVS_NAMESPACE) {
+ return NULL;
+ }
+
+ return btc_ble_mesh_provisioner_get_settings_uid(index);
+}
+
+uint8_t esp_ble_mesh_provisioner_get_settings_index(const char *uid)
+{
+ if (!uid || strlen(uid) > ESP_BLE_MESH_SETTINGS_UID_SIZE) {
+ return ESP_BLE_MESH_INVALID_SETTINGS_IDX;
+ }
+
+ return btc_ble_mesh_provisioner_get_settings_index(uid);
+}
+
+uint8_t esp_ble_mesh_provisioner_get_free_settings_count(void)
+{
+ return btc_ble_mesh_provisioner_get_free_settings_count();
+}
+#endif /* CONFIG_BLE_MESH_USE_MULTIPLE_NAMESPACE */
+
+#if CONFIG_BLE_MESH_CERT_BASED_PROV
+esp_err_t esp_ble_mesh_provisioner_send_prov_records_get(uint16_t link_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SEND_PROV_RECORDS_GET;
+
+ arg.send_prov_records_get.link_idx = link_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_send_prov_record_req(uint16_t link_idx, uint16_t record_id,
+ uint16_t frag_offset, uint16_t max_size)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (record_id >= ESP_BLE_MESH_PROV_RECORD_MAX_ID) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SEND_PROV_RECORD_REQUEST;
+
+ arg.send_prov_record_req.link_idx = link_idx;
+ arg.send_prov_record_req.record_id = record_id;
+ arg.send_prov_record_req.frag_offset = frag_offset;
+ arg.send_prov_record_req.max_size = max_size;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_send_prov_invite(uint16_t link_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SEND_PROV_INVITE;
+
+ arg.send_prov_invite.link_idx = link_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_send_link_close(uint16_t link_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SEND_LINK_CLOSE;
+
+ arg.send_link_close.link_idx = link_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_CERT_BASED_PROV */
+#endif /* CONFIG_BLE_MESH_PROVISIONER */
+
+#if CONFIG_BLE_MESH_FAST_PROV
+const uint8_t *esp_ble_mesh_get_fast_prov_app_key(uint16_t net_idx, uint16_t app_idx)
+{
+ return bt_mesh_get_fast_prov_app_key(net_idx, app_idx);
+}
+#endif /* CONFIG_BLE_MESH_FAST_PROV */
diff --git a/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c
new file mode 100644
index 00000000..c89903a1
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c
@@ -0,0 +1,530 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "esp_err.h"
+
+#include "btc_ble_mesh_prov.h"
+#include "esp_ble_mesh_provisioning_api.h"
+
+#define MAX_PROV_LINK_IDX (CONFIG_BLE_MESH_PBA_SAME_TIME + CONFIG_BLE_MESH_PBG_SAME_TIME)
+#define MAX_OOB_INPUT_NUM 0x5F5E0FF /* Decimal: 99999999 */
+
+esp_err_t esp_ble_mesh_register_prov_callback(esp_ble_mesh_prov_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_PROV, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+bool esp_ble_mesh_node_is_provisioned(void)
+{
+ return bt_mesh_is_provisioned();
+}
+
+static bool prov_bearers_valid(esp_ble_mesh_prov_bearer_t bearers)
+{
+ if ((!(bearers & (ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT))) ||
+ (IS_ENABLED(CONFIG_BLE_MESH_PB_ADV) &&
+ !IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
+ !(bearers & ESP_BLE_MESH_PROV_ADV)) ||
+ (!IS_ENABLED(CONFIG_BLE_MESH_PB_ADV) &&
+ IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
+ !(bearers & ESP_BLE_MESH_PROV_GATT))) {
+ return false;
+ }
+
+ return true;
+}
+
+esp_err_t esp_ble_mesh_node_prov_enable(esp_ble_mesh_prov_bearer_t bearers)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (prov_bearers_valid(bearers) == false) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROV_ENABLE;
+ arg.node_prov_enable.bearers = bearers;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (prov_bearers_valid(bearers) == false) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROV_DISABLE;
+ arg.node_prov_disable.bearers = bearers;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_node_set_oob_pub_key(uint8_t pub_key_x[32], uint8_t pub_key_y[32],
+ uint8_t private_key[32])
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!pub_key_x || !pub_key_y || !private_key) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_SET_OOB_PUB_KEY;
+
+ memcpy(arg.set_oob_pub_key.pub_key_x, pub_key_x, 32);
+ memcpy(arg.set_oob_pub_key.pub_key_y, pub_key_y, 32);
+ memcpy(arg.set_oob_pub_key.private_key, private_key, 32);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_node_input_number(uint32_t number)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (number > MAX_OOB_INPUT_NUM) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_INPUT_NUMBER;
+ arg.input_number.number = number;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_node_input_string(const char *string)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!string || strlen(string) > ESP_BLE_MESH_PROV_INPUT_OOB_MAX_LEN) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_INPUT_STRING;
+
+ arg.input_string.string[sizeof(arg.input_string.string) - 1] = 0;
+ strncpy(arg.input_string.string, string, sizeof(arg.input_string.string) - 1);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!name || strlen(name) > ESP_BLE_MESH_DEVICE_NAME_MAX_LEN) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_SET_DEVICE_NAME;
+
+ arg.set_device_name.name[sizeof(arg.set_device_name.name) - 1] = 0;
+ strncpy(arg.set_device_name.name, name, sizeof(arg.set_device_name.name) - 1);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+#if CONFIG_BLE_MESH_PROVISIONER
+esp_err_t esp_ble_mesh_provisioner_read_oob_pub_key(uint8_t link_idx, uint8_t pub_key_x[32],
+ uint8_t pub_key_y[32])
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!pub_key_x || !pub_key_y || link_idx >= MAX_PROV_LINK_IDX) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_READ_OOB_PUB_KEY;
+
+ arg.provisioner_read_oob_pub_key.link_idx = link_idx;
+ memcpy(arg.provisioner_read_oob_pub_key.pub_key_x, pub_key_x, 32);
+ memcpy(arg.provisioner_read_oob_pub_key.pub_key_y, pub_key_y, 32);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_input_string(const char *string, uint8_t link_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!string || strlen(string) > ESP_BLE_MESH_PROV_OUTPUT_OOB_MAX_LEN ||
+ link_idx >= MAX_PROV_LINK_IDX) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_INPUT_STR;
+
+ arg.provisioner_input_str.string[sizeof(arg.provisioner_input_str.string) - 1] = 0;
+ strncpy(arg.provisioner_input_str.string, string, sizeof(arg.provisioner_input_str.string) - 1);
+ arg.provisioner_input_str.link_idx = link_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_input_number(uint32_t number, uint8_t link_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (number > MAX_OOB_INPUT_NUM || link_idx >= MAX_PROV_LINK_IDX) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_INPUT_NUM;
+
+ arg.provisioner_input_num.number = number;
+ arg.provisioner_input_num.link_idx = link_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_prov_enable(esp_ble_mesh_prov_bearer_t bearers)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (prov_bearers_valid(bearers) == false) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_ENABLE;
+
+ arg.provisioner_enable.bearers = bearers;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t bearers)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (prov_bearers_valid(bearers) == false) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DISABLE;
+
+ arg.provisioner_disable.bearers = bearers;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t *add_dev,
+ esp_ble_mesh_dev_add_flag_t flags)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (add_dev == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DEV_ADD;
+
+ arg.provisioner_dev_add.add_dev.addr_type = add_dev->addr_type;
+ arg.provisioner_dev_add.add_dev.oob_info = add_dev->oob_info;
+ arg.provisioner_dev_add.add_dev.bearer = add_dev->bearer;
+ memcpy(arg.provisioner_dev_add.add_dev.addr, add_dev->addr, sizeof(esp_ble_mesh_bd_addr_t));
+ memcpy(arg.provisioner_dev_add.add_dev.uuid, add_dev->uuid, 16);
+ arg.provisioner_dev_add.flags = flags;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_prov_device_with_addr(const uint8_t uuid[16],
+ esp_ble_mesh_bd_addr_t addr,
+ esp_ble_mesh_addr_type_t addr_type,
+ esp_ble_mesh_prov_bearer_t bearer,
+ uint16_t oob_info, uint16_t unicast_addr)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (uuid == NULL || (bearer == ESP_BLE_MESH_PROV_GATT && (addr == NULL ||
+ addr_type > ESP_BLE_MESH_ADDR_TYPE_RANDOM)) ||
+ (bearer != ESP_BLE_MESH_PROV_ADV && bearer != ESP_BLE_MESH_PROV_GATT) ||
+ !ESP_BLE_MESH_ADDR_IS_UNICAST(unicast_addr)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_PROV_DEV_WITH_ADDR;
+
+ memcpy(arg.provisioner_prov_dev_with_addr.uuid, uuid, 16);
+ if (addr) {
+ memcpy(arg.provisioner_prov_dev_with_addr.addr, addr, BD_ADDR_LEN);
+ arg.provisioner_prov_dev_with_addr.addr_type = addr_type;
+ }
+ arg.provisioner_prov_dev_with_addr.bearer = bearer;
+ arg.provisioner_prov_dev_with_addr.oob_info = oob_info;
+ arg.provisioner_prov_dev_with_addr.unicast_addr = unicast_addr;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_delete_dev(esp_ble_mesh_device_delete_t *del_dev)
+{
+ uint8_t val = DEL_DEV_ADDR_FLAG | DEL_DEV_UUID_FLAG;
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (del_dev == NULL || (__builtin_popcount(del_dev->flag & val) != 1)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_DEV_DEL;
+
+ arg.provisioner_dev_del.del_dev.flag = del_dev->flag;
+ if (del_dev->flag & DEL_DEV_ADDR_FLAG) {
+ arg.provisioner_dev_del.del_dev.addr_type = del_dev->addr_type;
+ memcpy(arg.provisioner_dev_del.del_dev.addr, del_dev->addr, sizeof(esp_ble_mesh_bd_addr_t));
+ } else if (del_dev->flag & DEL_DEV_UUID_FLAG) {
+ memcpy(arg.provisioner_dev_del.del_dev.uuid, del_dev->uuid, 16);
+ }
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_set_dev_uuid_match(const uint8_t *match_val, uint8_t match_len,
+ uint8_t offset, bool prov_after_match)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (match_len + offset > ESP_BLE_MESH_OCTET16_LEN) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_DEV_UUID_MATCH;
+
+ if (match_len && match_val) {
+ memcpy(arg.set_dev_uuid_match.match_val, match_val, match_len);
+ }
+ arg.set_dev_uuid_match.match_len = match_len;
+ arg.set_dev_uuid_match.offset = offset;
+ arg.set_dev_uuid_match.prov_after_match = prov_after_match;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_set_prov_data_info(esp_ble_mesh_prov_data_info_t *prov_data_info)
+{
+ uint8_t val = PROV_DATA_NET_IDX_FLAG | PROV_DATA_FLAGS_FLAG | PROV_DATA_IV_INDEX_FLAG;
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (prov_data_info == NULL || (__builtin_popcount(prov_data_info->flag & val) != 1)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_PROV_DATA_INFO;
+
+ arg.set_prov_data_info.prov_data.flag = prov_data_info->flag;
+ if (prov_data_info->flag & PROV_DATA_NET_IDX_FLAG) {
+ arg.set_prov_data_info.prov_data.net_idx = prov_data_info->net_idx;
+ } else if (prov_data_info->flag & PROV_DATA_FLAGS_FLAG) {
+ arg.set_prov_data_info.prov_data.flags = prov_data_info->flags;
+ } else if (prov_data_info->flag & PROV_DATA_IV_INDEX_FLAG) {
+ arg.set_prov_data_info.prov_data.iv_index = prov_data_info->iv_index;
+ }
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_set_static_oob_value(const uint8_t *value, uint8_t length)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (value == NULL || length == 0 || length > 16) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_STATIC_OOB_VAL;
+
+ arg.set_static_oob_val.length = length;
+ memcpy(arg.set_static_oob_val.value, value, length);
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_provisioner_set_primary_elem_addr(uint16_t addr)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!ESP_BLE_MESH_ADDR_IS_UNICAST(addr)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROVISIONER_SET_PRIMARY_ELEM_ADDR;
+
+ arg.set_primary_elem_addr.addr = addr;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_PROVISIONER */
+
+/* The following APIs are for fast provisioning */
+
+#if CONFIG_BLE_MESH_FAST_PROV
+esp_err_t esp_ble_mesh_set_fast_prov_info(esp_ble_mesh_fast_prov_info_t *fast_prov_info)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (fast_prov_info == NULL || (fast_prov_info->offset +
+ fast_prov_info->match_len > ESP_BLE_MESH_OCTET16_LEN)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_SET_FAST_PROV_INFO;
+
+ arg.set_fast_prov_info.unicast_min = fast_prov_info->unicast_min;
+ arg.set_fast_prov_info.unicast_max = fast_prov_info->unicast_max;
+ arg.set_fast_prov_info.net_idx = fast_prov_info->net_idx;
+ arg.set_fast_prov_info.flags = fast_prov_info->flags;
+ arg.set_fast_prov_info.iv_index = fast_prov_info->iv_index;
+ arg.set_fast_prov_info.offset = fast_prov_info->offset;
+ arg.set_fast_prov_info.match_len = fast_prov_info->match_len;
+ if (fast_prov_info->match_len) {
+ memcpy(arg.set_fast_prov_info.match_val, fast_prov_info->match_val, fast_prov_info->match_len);
+ }
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_set_fast_prov_action(esp_ble_mesh_fast_prov_action_t action)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (action >= FAST_PROV_ACT_MAX) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_SET_FAST_PROV_ACTION;
+
+ arg.set_fast_prov_action.action = action;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_FAST_PROV */
diff --git a/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c
new file mode 100644
index 00000000..0365711d
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c
@@ -0,0 +1,249 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "esp_err.h"
+
+#include "btc_ble_mesh_prov.h"
+#include "esp_ble_mesh_defs.h"
+#include "esp_ble_mesh_local_data_operation_api.h"
+#include "esp_ble_mesh_proxy_api.h"
+
+esp_err_t esp_ble_mesh_proxy_identity_enable(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_IDENTITY_ENABLE;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_proxy_gatt_enable(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_GATT_ENABLE;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_proxy_gatt_disable(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_GATT_DISABLE;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+#if CONFIG_BLE_MESH_PRB_SRV
+esp_err_t esp_ble_mesh_private_proxy_identity_enable(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PRIVATE_PROXY_IDENTITY_ENABLE;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_private_proxy_identity_disable(void)
+{
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PRIVATE_PROXY_IDENTITY_DISABLE;
+
+ return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_PRB_SRV */
+
+esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr,
+ esp_ble_mesh_addr_type_t addr_type,
+ uint16_t net_idx)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!addr || addr_type > ESP_BLE_MESH_ADDR_TYPE_RANDOM) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_CLIENT_CONNECT;
+
+ memcpy(arg.proxy_client_connect.addr, addr, BD_ADDR_LEN);
+ arg.proxy_client_connect.addr_type = addr_type;
+ arg.proxy_client_connect.net_idx = net_idx;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_proxy_client_disconnect(uint8_t conn_handle)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_CLIENT_DISCONNECT;
+
+ arg.proxy_client_disconnect.conn_handle = conn_handle;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle, uint16_t net_idx,
+ esp_ble_mesh_proxy_filter_type_t filter_type)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (filter_type > PROXY_FILTER_BLACKLIST) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_CLIENT_SET_FILTER_TYPE;
+
+ arg.proxy_client_set_filter_type.conn_handle = conn_handle;
+ arg.proxy_client_set_filter_type.net_idx = net_idx;
+ arg.proxy_client_set_filter_type.filter_type = filter_type;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle, uint16_t net_idx,
+ uint16_t *addr, uint16_t addr_num)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!addr || addr_num == 0) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_CLIENT_ADD_FILTER_ADDR;
+
+ arg.proxy_client_add_filter_addr.conn_handle = conn_handle;
+ arg.proxy_client_add_filter_addr.net_idx = net_idx;
+ arg.proxy_client_add_filter_addr.addr_num = addr_num;
+ arg.proxy_client_add_filter_addr.addr = addr;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy,
+ btc_ble_mesh_prov_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle, uint16_t net_idx,
+ uint16_t *addr, uint16_t addr_num)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (!addr || addr_num == 0) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_CLIENT_REMOVE_FILTER_ADDR;
+
+ arg.proxy_client_remove_filter_addr.conn_handle = conn_handle;
+ arg.proxy_client_remove_filter_addr.net_idx = net_idx;
+ arg.proxy_client_remove_filter_addr.addr_num = addr_num;
+ arg.proxy_client_remove_filter_addr.addr = addr;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy,
+ btc_ble_mesh_prov_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+#if CONFIG_BLE_MESH_DF_CLI
+esp_err_t esp_ble_mesh_proxy_client_directed_proxy_set(uint8_t conn_handle, uint16_t net_idx,
+ uint8_t use_directed)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (use_directed > ESP_BLE_MESH_PROXY_CLI_DIRECTED_FORWARDING_ENABLE) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_CLIENT_DIRECTED_PROXY_SET;
+
+ arg.proxy_client_directed_proxy_set.conn_handle = conn_handle;
+ arg.proxy_client_directed_proxy_set.net_idx = net_idx;
+ arg.proxy_client_directed_proxy_set.use_directed = use_directed;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), btc_ble_mesh_prov_arg_deep_copy, btc_ble_mesh_prov_arg_deep_free)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_DF_CLI */
+
+#if CONFIG_BLE_MESH_PROXY_SOLIC_PDU_TX
+esp_err_t esp_ble_mesh_proxy_client_send_solic_pdu(uint8_t net_idx, uint16_t ssrc, uint16_t dst)
+{
+ btc_ble_mesh_prov_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (esp_ble_mesh_find_element(ssrc) == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_PROV;
+ msg.act = BTC_BLE_MESH_ACT_PROXY_CLIENT_SEND_SOLIC_PDU;
+
+ arg.proxy_client_send_solic_pdu.net_idx = net_idx;
+ arg.proxy_client_send_solic_pdu.ssrc = ssrc;
+ arg.proxy_client_send_solic_pdu.dst = dst;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_PROXY_SOLIC_PDU_TX */
diff --git a/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_ble_api.h b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_ble_api.h
new file mode 100644
index 00000000..6818ba18
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_ble_api.h
@@ -0,0 +1,182 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_BLE_API_H_
+#define _ESP_BLE_MESH_BLE_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** This enum value is the event of BLE operations */
+typedef enum {
+ ESP_BLE_MESH_START_BLE_ADVERTISING_COMP_EVT, /*!< Start BLE advertising completion event */
+ ESP_BLE_MESH_STOP_BLE_ADVERTISING_COMP_EVT, /*!< Stop BLE advertising completion event */
+ ESP_BLE_MESH_START_BLE_SCANNING_COMP_EVT, /*!< Start BLE scanning completion event */
+ ESP_BLE_MESH_STOP_BLE_SCANNING_COMP_EVT, /*!< Stop BLE scanning completion event */
+ ESP_BLE_MESH_SCAN_BLE_ADVERTISING_PKT_EVT, /*!< Scanning BLE advertising packets event */
+ ESP_BLE_MESH_BLE_EVT_MAX,
+} esp_ble_mesh_ble_cb_event_t;
+
+/** BLE operation callback parameters */
+typedef union {
+ /**
+ * @brief ESP_BLE_MESH_START_BLE_ADVERTISING_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of starting BLE advertising */
+ uint8_t index; /*!< Index of the BLE advertising */
+ } start_ble_advertising_comp; /*!< Event parameters of ESP_BLE_MESH_START_BLE_ADVERTISING_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_STOP_BLE_ADVERTISING_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of stopping BLE advertising */
+ uint8_t index; /*!< Index of the BLE advertising */
+ } stop_ble_advertising_comp; /*!< Event parameters of ESP_BLE_MESH_STOP_BLE_ADVERTISING_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_START_BLE_SCANNING_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of starting BLE scanning */
+ } start_ble_scan_comp; /*!< Event parameters of ESP_BLE_MESH_START_BLE_SCANNING_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_STOP_BLE_SCANNING_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of stopping BLE scanning */
+ } stop_ble_scan_comp; /*!< Event parameters of ESP_BLE_MESH_STOP_BLE_SCANNING_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_SCAN_BLE_ADVERTISING_PKT_EVT
+ */
+ struct {
+ uint8_t addr[6]; /*!< Device address */
+ uint8_t addr_type; /*!< Device address type */
+ uint8_t adv_type; /*!< Advertising data type */
+ uint8_t *data; /*!< Advertising data */
+ uint16_t length; /*!< Advertising data length */
+ int8_t rssi; /*!< RSSI of the advertising packet */
+ } scan_ble_adv_pkt; /*!< Event parameters of ESP_BLE_MESH_SCAN_BLE_ADVERTISING_PKT_EVT */
+} esp_ble_mesh_ble_cb_param_t;
+
+/**
+ * @brief BLE scanning callback function type
+ *
+ * @param event: BLE scanning callback event type
+ * @param param: BLE scanning callback parameter
+ */
+typedef void (* esp_ble_mesh_ble_cb_t)(esp_ble_mesh_ble_cb_event_t event,
+ esp_ble_mesh_ble_cb_param_t *param);
+
+/**
+ * @brief Register BLE scanning callback.
+ *
+ * @param[in] callback: Pointer to the BLE scanning callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_ble_callback(esp_ble_mesh_ble_cb_t callback);
+
+/** Count for sending BLE advertising packet infinitely */
+#define ESP_BLE_MESH_BLE_ADV_INFINITE 0xFFFF
+
+/*!< This enum value is the priority of BLE advertising packet */
+typedef enum {
+ ESP_BLE_MESH_BLE_ADV_PRIO_LOW,
+ ESP_BLE_MESH_BLE_ADV_PRIO_HIGH,
+} esp_ble_mesh_ble_adv_priority_t;
+
+/** Context of BLE advertising parameters. */
+typedef struct {
+ uint16_t interval; /*!< BLE advertising interval */
+ uint8_t adv_type; /*!< BLE advertising type */
+ uint8_t own_addr_type; /*!< Own address type */
+ uint8_t peer_addr_type; /*!< Peer address type */
+ uint8_t peer_addr[BD_ADDR_LEN]; /*!< Peer address */
+ uint16_t duration; /*!< Duration is milliseconds */
+ uint16_t period; /*!< Period in milliseconds */
+ uint16_t count; /*!< Number of advertising duration */
+ uint8_t priority:2; /*!< Priority of BLE advertising packet */
+} esp_ble_mesh_ble_adv_param_t;
+
+/** Context of BLE advertising data. */
+typedef struct {
+ uint8_t adv_data_len; /*!< Advertising data length */
+ uint8_t adv_data[31]; /*!< Advertising data */
+ uint8_t scan_rsp_data_len; /*!< Scan response data length */
+ uint8_t scan_rsp_data[31]; /*!< Scan response data */
+} esp_ble_mesh_ble_adv_data_t;
+
+/**
+ * @brief This function is called to start BLE advertising with the corresponding data
+ * and parameters while BLE Mesh is working at the same time.
+ *
+ * @note 1. When this function is called, the BLE advertising packet will be posted to
+ * the BLE mesh adv queue in the mesh stack and waited to be sent.
+ * 2. In the BLE advertising parameters, the "duration" means the time used for
+ * sending the BLE advertising packet each time, it shall not be smaller than the
+ * advertising interval. When the packet is sent successfully, it will be posted
+ * to the adv queue again after the "period" time if the "count" is bigger than 0.
+ * The "count" means how many durations the packet will be sent after it is sent
+ * successfully for the first time. And if the "count" is set to 0xFFFF, which
+ * means the packet will be sent infinitely.
+ * 3. The "priority" means the priority of BLE advertising packet compared with
+ * BLE Mesh packets. Currently two options (i.e. low/high) are provided. If the
+ * "priority" is high, the BLE advertising packet will be posted to the front of
+ * adv queue. Otherwise it will be posted to the back of adv queue.
+ *
+ * @param[in] param: Pointer to the BLE advertising parameters
+ * @param[in] data: Pointer to the BLE advertising data and scan response data
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_start_ble_advertising(const esp_ble_mesh_ble_adv_param_t *param,
+ const esp_ble_mesh_ble_adv_data_t *data);
+
+/**
+ * @brief This function is called to stop BLE advertising with the corresponding index.
+ *
+ * @param[in] index: Index of BLE advertising
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_stop_ble_advertising(uint8_t index);
+
+/** Context of BLE scanning parameters. */
+typedef struct {
+ uint32_t duration; /*!< Duration used to scan normal BLE advertising packets */
+} esp_ble_mesh_ble_scan_param_t;
+
+/**
+ * @brief This function is called to start scanning normal BLE advertising packets
+ * and notifying the packets to the application layer.
+ *
+ * @param[in] param: Pointer to the BLE scanning parameters
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_start_ble_scanning(esp_ble_mesh_ble_scan_param_t *param);
+
+/**
+ * @brief This function is called to stop notifying normal BLE advertising packets
+ * to the application layer.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_stop_ble_scanning(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_BLE_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_common_api.h b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_common_api.h
new file mode 100644
index 00000000..f7209d8e
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_common_api.h
@@ -0,0 +1,49 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_COMMON_API_H_
+#define _ESP_BLE_MESH_COMMON_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Initialize BLE Mesh module.
+ * This API initializes provisioning capabilities and composition data information.
+ *
+ * @note After calling this API, the device needs to call esp_ble_mesh_prov_enable()
+ * to enable provisioning functionality again.
+ *
+ * @param[in] prov: Pointer to the device provisioning capabilities. This pointer must
+ * remain valid during the lifetime of the BLE Mesh device.
+ * @param[in] comp: Pointer to the device composition data information. This pointer
+ * must remain valid during the lifetime of the BLE Mesh device.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp);
+
+/**
+ * @brief De-initialize BLE Mesh module.
+ *
+ * @note This function shall be invoked after esp_ble_mesh_client_model_deinit().
+ *
+ * @param[in] param: Pointer to the structure of BLE Mesh deinit parameters.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_deinit(esp_ble_mesh_deinit_param_t *param);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_COMMON_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_local_data_operation_api.h b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_local_data_operation_api.h
new file mode 100644
index 00000000..e5e7c721
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_local_data_operation_api.h
@@ -0,0 +1,225 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_LOCAL_DATA_OPERATION_API_H_
+#define _ESP_BLE_MESH_LOCAL_DATA_OPERATION_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Get the model publish period, the unit is ms.
+ *
+ * @param[in] model: Model instance pointer.
+ *
+ * @return Publish period value on success, 0 or (negative) error code from errno.h on failure.
+ *
+ */
+int32_t esp_ble_mesh_get_model_publish_period(esp_ble_mesh_model_t *model);
+
+/**
+ * @brief Get the address of the primary element.
+ *
+ * @return Address of the primary element on success, or
+ * ESP_BLE_MESH_ADDR_UNASSIGNED on failure which means the device has not been provisioned.
+ *
+ */
+uint16_t esp_ble_mesh_get_primary_element_address(void);
+
+/**
+ * @brief Check if the model has subscribed to the given group address.
+ * Note: E.g., once a status message is received and the destination address
+ * is a group address, the model uses this API to check if it is successfully subscribed
+ * to the given group address.
+ *
+ * @param[in] model: Pointer to the model.
+ * @param[in] group_addr: Group address.
+ *
+ * @return Pointer to the group address within the Subscription List of the model on success, or
+ * NULL on failure which means the model has not subscribed to the given group address.
+ * Note: With the pointer to the group address returned, you can reset the group address
+ * to 0x0000 in order to unsubscribe the model from the group.
+ *
+ */
+uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model,
+ uint16_t group_addr);
+
+/**
+ * @brief Find the BLE Mesh element pointer via the element address.
+ *
+ * @param[in] element_addr: Element address.
+ *
+ * @return Pointer to the element on success, or NULL on failure.
+ *
+ */
+esp_ble_mesh_elem_t *esp_ble_mesh_find_element(uint16_t element_addr);
+
+/**
+ * @brief Get the number of elements that have been registered.
+ *
+ * @return Number of elements.
+ *
+ */
+uint8_t esp_ble_mesh_get_element_count(void);
+
+/**
+ * @brief Find the Vendor specific model with the given element,
+ * the company ID and the Vendor Model ID.
+ *
+ * @param[in] element: Element to which the model belongs.
+ * @param[in] company_id: A 16-bit company identifier assigned by the Bluetooth SIG.
+ * @param[in] model_id: A 16-bit vendor-assigned model identifier.
+ *
+ * @return Pointer to the Vendor Model on success, or NULL on failure which means the Vendor Model is not found.
+ *
+ */
+esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *element,
+ uint16_t company_id, uint16_t model_id);
+
+/**
+ * @brief Find the SIG model with the given element and Model id.
+ *
+ * @param[in] element: Element to which the model belongs.
+ * @param[in] model_id: SIG model identifier.
+ *
+ * @return Pointer to the SIG Model on success, or NULL on failure which means the SIG Model is not found.
+ *
+ */
+esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element,
+ uint16_t model_id);
+
+/**
+ * @brief Get the Composition data which has been registered.
+ *
+ * @return Pointer to the Composition data on success, or NULL on failure which means the Composition data is not initialized.
+ *
+ */
+const esp_ble_mesh_comp_t *esp_ble_mesh_get_composition_data(void);
+
+/**
+ * @brief A local model of node or Provisioner subscribes a group address.
+ *
+ * @note This function shall not be invoked before node is provisioned or Provisioner is enabled.
+ *
+ * @param[in] element_addr: Unicast address of the element to which the model belongs.
+ * @param[in] company_id: A 16-bit company identifier.
+ * @param[in] model_id: A 16-bit model identifier.
+ * @param[in] group_addr: The group address to be subscribed.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_model_subscribe_group_addr(uint16_t element_addr, uint16_t company_id,
+ uint16_t model_id, uint16_t group_addr);
+
+/**
+ * @brief A local model of node or Provisioner unsubscribes a group address.
+ *
+ * @note This function shall not be invoked before node is provisioned or Provisioner is enabled.
+ *
+ * @param[in] element_addr: Unicast address of the element to which the model belongs.
+ * @param[in] company_id: A 16-bit company identifier.
+ * @param[in] model_id: A 16-bit model identifier.
+ * @param[in] group_addr: The subscribed group address.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_model_unsubscribe_group_addr(uint16_t element_addr, uint16_t company_id,
+ uint16_t model_id, uint16_t group_addr);
+
+/**
+ * @brief This function is called by Node to get the local NetKey.
+ *
+ * @param[in] net_idx: NetKey index.
+ *
+ * @return NetKey on success, or NULL on failure.
+ *
+ */
+const uint8_t *esp_ble_mesh_node_get_local_net_key(uint16_t net_idx);
+
+/**
+ * @brief This function is called by Node to get the local AppKey.
+ *
+ * @param[in] app_idx: AppKey index.
+ *
+ * @return AppKey on success, or NULL on failure.
+ *
+ */
+const uint8_t *esp_ble_mesh_node_get_local_app_key(uint16_t app_idx);
+
+/**
+ * @brief This function is called by Node to add a local NetKey.
+ *
+ * @param[in] net_key: NetKey to be added.
+ * @param[in] net_idx: NetKey Index.
+ *
+ * @note This function can only be called after the device is provisioned.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_add_local_net_key(const uint8_t net_key[16], uint16_t net_idx);
+
+/**
+ * @brief This function is called by Node to add a local AppKey.
+ *
+ * @param[in] app_key: AppKey to be added.
+ * @param[in] net_idx: NetKey Index.
+ * @param[in] app_idx: AppKey Index.
+ *
+ * @note The net_idx must be an existing one.
+ * This function can only be called after the device is provisioned.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_add_local_app_key(const uint8_t app_key[16], uint16_t net_idx, uint16_t app_idx);
+
+/**
+ * @brief This function is called by Node to bind AppKey to model locally.
+ *
+ * @param[in] element_addr: Node local element address
+ * @param[in] company_id: Node local company id
+ * @param[in] model_id: Node local model id
+ * @param[in] app_idx: Node local appkey index
+ *
+ * @note If going to bind app_key with local vendor model, the company_id
+ * shall be set to 0xFFFF.
+ * This function can only be called after the device is provisioned.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_bind_app_key_to_local_model(uint16_t element_addr, uint16_t company_id,
+ uint16_t model_id, uint16_t app_idx);
+
+/**
+ * @brief This function used to enable directed forwarding and directed forwarding relay on self.
+ *
+ * @param[in] net_idx: NetKey Index.
+ * @param[in] directed_forwarding: Enable or Disable directed forwarding.
+ * @param[in] directed_forwarding_relay: Enable or Disable directed forwarding relay.
+ *
+ * @note If the directed forwarding was set to disable, the directed forwarding relay
+ * must also be set to disable.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+*/
+#if CONFIG_BLE_MESH_DF_SRV
+esp_err_t esp_ble_mesh_enable_directed_forwarding(uint16_t net_idx, bool directed_forwarding,
+ bool directed_forwarding_relay);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_LOCAL_DATA_OPERATION_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_low_power_api.h b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_low_power_api.h
new file mode 100644
index 00000000..e55c6a71
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_low_power_api.h
@@ -0,0 +1,61 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_LOW_POWER_API_H_
+#define _ESP_BLE_MESH_LOW_POWER_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enable BLE Mesh device LPN functionality.
+ *
+ * @note This API enables LPN functionality. Once called, the proper
+ * Friend Request will be sent.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_lpn_enable(void);
+
+/**
+ * @brief Disable BLE Mesh device LPN functionality.
+ *
+ * @param[in] force: when disabling LPN functionality, use this flag to indicate
+ * whether directly clear corresponding information or just
+ * send friend clear to disable it if friendship has already
+ * been established.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_lpn_disable(bool force);
+
+/**
+ * @brief LPN tries to poll messages from the Friend Node.
+ *
+ * @note The Friend Poll message is sent by a Low Power node to ask the Friend
+ * node to send a message that it has stored for the Low Power node.
+ * Users can call this API to send Friend Poll message manually. If this
+ * API is not invoked, the bottom layer of the Low Power node will send
+ * Friend Poll before the PollTimeout timer expires.
+ * If the corresponding Friend Update is received and MD is set to 0,
+ * which means there are no messages for the Low Power node, then the
+ * Low Power node will stop scanning.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_lpn_poll(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_LOW_POWER_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_networking_api.h b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_networking_api.h
new file mode 100644
index 00000000..2b512f1c
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_networking_api.h
@@ -0,0 +1,697 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_NETWORKING_API_H_
+#define _ESP_BLE_MESH_NETWORKING_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @brief: event, event code of user-defined model events; param, parameters of user-defined model events */
+typedef void (* esp_ble_mesh_model_cb_t)(esp_ble_mesh_model_cb_event_t event,
+ esp_ble_mesh_model_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh callback for user-defined models' operations.
+ * This callback can report the following events generated for the user-defined models:
+ * - Call back the messages received by user-defined client and server models to the
+ * application layer;
+ * - If users call esp_ble_mesh_server/client_model_send, this callback notifies the
+ * application layer of the send_complete event;
+ * - If user-defined client model sends a message that requires response, and the response
+ * message is received after the timer expires, the response message will be reported
+ * to the application layer as published by a peer device;
+ * - If the user-defined client model fails to receive the response message during a specified
+ * period of time, a timeout event will be reported to the application layer.
+ *
+ * @note The client models (i.e. Config Client model, Health Client model, Generic
+ * Client models, Sensor Client model, Scene Client model and Lighting Client models)
+ * that have been realized internally have their specific register functions.
+ * For example, esp_ble_mesh_register_config_client_callback is the register
+ * function for Config Client Model.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_custom_model_callback(esp_ble_mesh_model_cb_t callback);
+
+/**
+ * @brief Add the message opcode to the beginning of the model message
+ * before sending or publishing the model message.
+ *
+ * @note This API is only used to set the opcode of the message.
+ *
+ * @param[in] data: Pointer to the message data.
+ * @param[in] opcode: The message opcode.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_model_msg_opcode_init(uint8_t *data, uint32_t opcode);
+
+/**
+ * @brief Initialize the user-defined client model. All user-defined client models
+ * shall call this function to initialize the client model internal data.
+ * Node: Before calling this API, the op_pair_size and op_pair variables within
+ * the user_data(defined using esp_ble_mesh_client_t_) of the client model
+ * need to be initialized.
+ *
+ * @param[in] model: BLE Mesh Client model to which the message belongs.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_client_model_init(esp_ble_mesh_model_t *model);
+
+/**
+ * @brief De-initialize the user-defined client model.
+ *
+ * @note This function shall be invoked before esp_ble_mesh_deinit() is called.
+ *
+ * @param[in] model: Pointer of the Client model.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model);
+
+/**
+ * @brief Send server model messages(such as server model status messages).
+ *
+ * @param[in] model: BLE Mesh Server Model to which the message belongs.
+ * @param[in] ctx: Message context, includes keys, TTL, etc.
+ * @param[in] opcode: Message opcode.
+ * @param[in] length: Message length (exclude the message opcode).
+ * @param[in] data: Parameters of Access Payload (exclude the message opcode) to be sent.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
+ esp_ble_mesh_msg_ctx_t *ctx,
+ uint32_t opcode,
+ uint16_t length, uint8_t *data);
+
+/**
+ * @brief Send client model message (such as model get, set, etc).
+ *
+ * @param[in] model: BLE Mesh Client Model to which the message belongs.
+ * @param[in] ctx: Message context, includes keys, TTL, etc.
+ * @param[in] opcode: Message opcode.
+ * @param[in] length: Message length (exclude the message opcode).
+ * @param[in] data: Parameters of the Access Payload (exclude the message opcode) to be sent.
+ * @param[in] msg_timeout: Time to get response to the message (in milliseconds).
+ * @param[in] need_rsp: TRUE if the opcode requires the peer device to reply, FALSE otherwise.
+ * @param[in] device_role: Role of the device (Node/Provisioner) that sends the message.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model,
+ esp_ble_mesh_msg_ctx_t *ctx,
+ uint32_t opcode,
+ uint16_t length, uint8_t *data,
+ int32_t msg_timeout, bool need_rsp,
+ esp_ble_mesh_dev_role_t device_role);
+
+/**
+ * @brief Send a model publication message.
+ *
+ * @note Before calling this function, the user needs to ensure that the model
+ * publication message (@ref esp_ble_mesh_model_pub_t.msg) contains a valid
+ * message to be sent. And if users want to update the publishing message,
+ * this API should be called in ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT
+ * with the message updated.
+ *
+ *
+ * @param[in] model: Mesh (client) Model publishing the message.
+ * @param[in] opcode: Message opcode.
+ * @param[in] length: Message length (exclude the message opcode).
+ * @param[in] data: Parameters of the Access Payload (exclude the message opcode) to be sent.
+ * @param[in] device_role: Role of the device (node/provisioner) publishing the message of the type esp_ble_mesh_dev_role_t.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcode,
+ uint16_t length, uint8_t *data,
+ esp_ble_mesh_dev_role_t device_role);
+
+/**
+ * @brief Update a server model state value. If the model publication
+ * state is set properly (e.g. publish address is set to a valid
+ * address), it will publish corresponding status message.
+ *
+ * @note Currently this API is used to update bound state value, not
+ * for all server model states.
+ *
+ * @param[in] model: Server model which is going to update the state.
+ * @param[in] type: Server model state type.
+ * @param[in] value: Server model state value.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model,
+ esp_ble_mesh_server_state_type_t type,
+ esp_ble_mesh_server_state_value_t *value);
+
+/**
+ * @brief Reset the provisioning procedure of the local BLE Mesh node.
+ *
+ * @note All provisioning information in this node will be deleted and the node
+ * needs to be re-provisioned. The API function esp_ble_mesh_node_prov_enable()
+ * needs to be called to start a new provisioning procedure.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_local_reset(void);
+
+/**
+ * @brief This function is called to set the node (provisioned device) name.
+ *
+ * @param[in] index: Index of the node in the node queue.
+ * @param[in] name: Name (end by '\0') to be set for the node.
+ *
+ * @note index is obtained from the parameters of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_set_node_name(uint16_t index, const char *name);
+
+/**
+ * @brief This function is called to get the node (provisioned device) name.
+ *
+ * @param[in] index: Index of the node in the node queue.
+ *
+ * @note index is obtained from the parameters of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT.
+ *
+ * @return Node name on success, or NULL on failure.
+ *
+ */
+const char *esp_ble_mesh_provisioner_get_node_name(uint16_t index);
+
+/**
+ * @brief This function is called to get the node (provisioned device) index.
+ *
+ * @param[in] name: Name of the node (end by '\0').
+ *
+ * @return Node index on success, or an invalid value (0xFFFF) on failure.
+ *
+ */
+uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name);
+
+/**
+ * @brief This function is called to store the Composition Data of the node.
+ *
+ * @param[in] unicast_addr: Element address of the node
+ * @param[in] data: Pointer of Composition Data
+ * @param[in] length: Length of Composition Data
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr,
+ uint8_t *data, uint16_t length);
+
+/**
+ * @brief This function is called to get the provisioned node information
+ * with the node device uuid.
+ *
+ * @param[in] uuid: Device UUID of the node
+ *
+ * @return Pointer of the node info struct or NULL on failure.
+ *
+ */
+esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_uuid(const uint8_t uuid[16]);
+
+/**
+ * @brief This function is called to get the provisioned node information
+ * with the node unicast address.
+ *
+ * @param[in] unicast_addr: Unicast address of the node
+ *
+ * @return Pointer of the node info struct or NULL on failure.
+ *
+ */
+esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_addr(uint16_t unicast_addr);
+
+/**
+ * @brief This function is called to get the provisioned node information
+ * with the node name.
+ *
+ * @param[in] name: Name of the node (end by '\0').
+ *
+ * @return Pointer of the node info struct or NULL on failure.
+ *
+ */
+esp_ble_mesh_node_t *esp_ble_mesh_provisioner_get_node_with_name(const char *name);
+
+/**
+ * @brief This function is called by Provisioner to get provisioned node count.
+ *
+ * @return Number of the provisioned nodes.
+ *
+ */
+uint16_t esp_ble_mesh_provisioner_get_prov_node_count(void);
+
+/**
+ * @brief This function is called by Provisioner to get the entry of the node table.
+ *
+ * @note After invoking the function to get the entry of nodes, users can use the "for"
+ * loop combined with the macro CONFIG_BLE_MESH_MAX_PROV_NODES to get each node's
+ * information. Before trying to read the node's information, users need to check
+ * if the node exists, i.e. if the *(esp_ble_mesh_node_t **node) is NULL.
+ * For example:
+ * ```
+ * const esp_ble_mesh_node_t **entry = esp_ble_mesh_provisioner_get_node_table_entry();
+ * for (int i = 0; i < CONFIG_BLE_MESH_MAX_PROV_NODES; i++) {
+ * const esp_ble_mesh_node_t *node = entry[i];
+ * if (node) {
+ * ......
+ * }
+ * }
+ * ```
+ *
+ * @return Pointer to the start of the node table.
+ *
+ */
+const esp_ble_mesh_node_t **esp_ble_mesh_provisioner_get_node_table_entry(void);
+
+/**
+ * @brief This function is called to delete the provisioned node information
+ * with the node device uuid.
+ *
+ * @param[in] uuid: Device UUID of the node
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_delete_node_with_uuid(const uint8_t uuid[16]);
+
+/**
+ * @brief This function is called to delete the provisioned node information
+ * with the node unicast address.
+ *
+ * @param[in] unicast_addr: Unicast address of the node
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr);
+
+/**
+ * @brief This function is called to add a local AppKey for Provisioner.
+ *
+ * @param[in] app_key: The app key to be set for the local BLE Mesh stack.
+ * @param[in] net_idx: The network key index.
+ * @param[in] app_idx: The app key index.
+ *
+ * @note app_key: If set to NULL, app_key will be generated internally.
+ * net_idx: Should be an existing one.
+ * app_idx: If it is going to be generated internally, it should be set to
+ * 0xFFFF, and the new app_idx will be reported via an event.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
+ uint16_t net_idx, uint16_t app_idx);
+
+/**
+ * @brief This function is used to update a local AppKey for Provisioner.
+ *
+ * @param[in] app_key: Value of the AppKey.
+ * @param[in] net_idx: Corresponding NetKey Index.
+ * @param[in] app_idx: The AppKey Index
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16],
+ uint16_t net_idx, uint16_t app_idx);
+
+/**
+ * @brief This function is called by Provisioner to get the local app key value.
+ *
+ * @param[in] net_idx: Network key index.
+ * @param[in] app_idx: Application key index.
+ *
+ * @return App key on success, or NULL on failure.
+ *
+ */
+const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint16_t app_idx);
+
+/**
+ * @brief This function is called by Provisioner to bind own model with proper app key.
+ *
+ * @param[in] element_addr: Provisioner local element address
+ * @param[in] app_idx: Provisioner local appkey index
+ * @param[in] model_id: Provisioner local model id
+ * @param[in] company_id: Provisioner local company id
+ *
+ * @note company_id: If going to bind app_key with local vendor model, company_id
+ * should be set to 0xFFFF.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx,
+ uint16_t model_id, uint16_t company_id);
+
+/**
+ * @brief This function is called by Provisioner to add local network key.
+ *
+ * @param[in] net_key: The network key to be added to the Provisioner local BLE Mesh stack.
+ * @param[in] net_idx: The network key index.
+ *
+ * @note net_key: If set to NULL, net_key will be generated internally.
+ * net_idx: If it is going to be generated internally, it should be set to
+ * 0xFFFF, and the new net_idx will be reported via an event.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_add_local_net_key(const uint8_t net_key[16], uint16_t net_idx);
+
+/**
+ * @brief This function is called by Provisioner to update a local network key.
+ *
+ * @param[in] net_key: Value of the NetKey.
+ * @param[in] net_idx: The NetKey Index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_update_local_net_key(const uint8_t net_key[16], uint16_t net_idx);
+
+/**
+ * @brief This function is called by Provisioner to get the local network key value.
+ *
+ * @param[in] net_idx: Network key index.
+ *
+ * @return Network key on success, or NULL on failure.
+ *
+ */
+const uint8_t *esp_ble_mesh_provisioner_get_local_net_key(uint16_t net_idx);
+
+/**
+ * @brief This function is called by Provisioner to enable or disable receiving
+ * heartbeat messages.
+ *
+ * @note If enabling receiving heartbeat message successfully, the filter will
+ * be an empty rejectlist by default, which means all heartbeat messages
+ * received by the Provisioner will be reported to the application layer.
+ *
+ * @param[in] enable: Enable or disable receiving heartbeat messages.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_recv_heartbeat(bool enable);
+
+/**
+ * @brief This function is called by Provisioner to set the heartbeat filter type.
+ *
+ * @note 1. If the filter type is not the same with the current value, then all the
+ * filter entries will be cleaned.
+ * 2. If the previous type is rejectlist, and changed to acceptlist, then the
+ * filter will be an empty acceptlist, which means no heartbeat messages
+ * will be reported. Users need to add SRC or DST into the filter entry,
+ * then heartbeat messages from the SRC or to the DST will be reported.
+ *
+ * @param[in] type: Heartbeat filter type (acceptlist or rejectlist).
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_type(uint8_t type);
+
+/**
+ * @brief This function is called by Provisioner to add or remove a heartbeat filter entry.
+ *
+ * @note 1. If the operation is "ADD", the "hb_src" can be set to the SRC (can only be a
+ * unicast address) of heartbeat messages, and the "hb_dst" can be set to the
+ * DST (unicast address or group address), at least one of them needs to be set.
+ * - If only one of them is set, the filter entry will only use the configured
+ * SRC or DST to filter heartbeat messages.
+ * - If both of them are set, the SRC and DST will both be used to decide if a
+ * heartbeat message will be handled.
+ * - If SRC or DST already exists in some filter entry, then the corresponding
+ * entry will be cleaned firstly, then a new entry will be allocated to store
+ * the information.
+ * 2. If the operation is "REMOVE", the "hb_src" can be set to the SRC (can only be
+ * a unicast address) of heartbeat messages, and the "hb_dst" can be set to the
+ * DST (unicast address or group address), at least one of them needs to be set.
+ * - The filter entry with the same SRC or DST will be removed.
+ *
+ * @param[in] op: Add or REMOVE
+ * @param[in] info: Heartbeat filter entry information, including:
+ * hb_src - Heartbeat source address;
+ * hb_dst - Heartbeat destination address;
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_info(uint8_t op, esp_ble_mesh_heartbeat_filter_info_t *info);
+
+/**
+ * @brief This function is called by Provisioner to directly erase the mesh
+ * information from nvs namespace.
+ *
+ * @note This function can be invoked when the mesh stack is not initialized
+ * or has been de-initialized.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_direct_erase_settings(void);
+
+/**
+ * @brief This function is called by Provisioner to open a nvs namespace
+ * for storing mesh information.
+ *
+ * @note Before open another nvs namespace, the previously opened nvs
+ * namespace must be closed firstly.
+ *
+ * @param[in] index: Settings index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_open_settings_with_index(uint8_t index);
+
+/**
+ * @brief This function is called by Provisioner to open a nvs namespace
+ * for storing mesh information.
+ *
+ * @note Before open another nvs namespace, the previously opened nvs
+ * namespace must be closed firstly.
+ *
+ * @param[in] uid: Settings user id.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_open_settings_with_uid(const char *uid);
+
+/**
+ * @brief This function is called by Provisioner to close a nvs namespace
+ * which is opened previously for storing mesh information.
+ *
+ * @note 1. Before closing the nvs namespace, it must be open.
+ * 2. When the function is invoked, the Provisioner functionality
+ * will be disabled firstly, and:
+ * a) If the "erase" flag is set to false, the mesh information
+ * will be cleaned (e.g. removing NetKey, AppKey, nodes, etc)
+ * from the mesh stack.
+ * b) If the "erase" flag is set to true, the mesh information
+ * stored in the nvs namespace will also be erased besides
+ * been cleaned from the mesh stack.
+ * 3. If Provisioner tries to work properly again, we can invoke the
+ * open function to open a new nvs namespace or a previously added
+ * one, and restore the mesh information from it if not erased.
+ * 4. The working process shall be as following:
+ * a) Open settings A
+ * b) Start to provision and control nodes
+ * c) Close settings A
+ * d) Open settings B
+ * e) Start to provision and control other nodes
+ * f) Close settings B
+ * g) ......
+ *
+ * @param[in] index: Settings index.
+ * @param[in] erase: Indicate if erasing mesh information.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_close_settings_with_index(uint8_t index, bool erase);
+
+/**
+ * @brief This function is called by Provisioner to close a nvs namespace
+ * which is opened previously for storing mesh information.
+ *
+ * @note 1. Before closing the nvs namespace, it must be open.
+ * 2. When the function is invoked, the Provisioner functionality
+ * will be disabled firstly, and:
+ * a) If the "erase" flag is set to false, the mesh information
+ * will be cleaned (e.g. removing NetKey, AppKey, nodes, etc)
+ * from the mesh stack.
+ * b) If the "erase" flag is set to true, the mesh information
+ * stored in the nvs namespace will also be erased besides
+ * been cleaned from the mesh stack.
+ * 3. If Provisioner tries to work properly again, we can invoke the
+ * open function to open a new nvs namespace or a previously added
+ * one, and restore the mesh information from it if not erased.
+ * 4. The working process shall be as following:
+ * a) Open settings A
+ * b) Start to provision and control nodes
+ * c) Close settings A
+ * d) Open settings B
+ * e) Start to provision and control other nodes
+ * f) Close settings B
+ * g) ......
+ *
+ * @param[in] uid: Settings user id.
+ * @param[in] erase: Indicate if erasing mesh information.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_close_settings_with_uid(const char *uid, bool erase);
+
+/**
+ * @brief This function is called by Provisioner to erase the mesh information
+ * and settings user id from a nvs namespace.
+ *
+ * @note When this function is called, the nvs namespace must not be open.
+ * This function is used to erase the mesh information and settings
+ * user id which are not used currently.
+ *
+ * @param[in] index: Settings index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_delete_settings_with_index(uint8_t index);
+
+/**
+ * @brief This function is called by Provisioner to erase the mesh information
+ * and settings user id from a nvs namespace.
+ *
+ * @note When this function is called, the nvs namespace must not be open.
+ * This function is used to erase the mesh information and settings
+ * user id which are not used currently.
+ *
+ * @param[in] uid: Settings user id.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_delete_settings_with_uid(const char *uid);
+
+/**
+ * @brief This function is called by Provisioner to get settings user id.
+ *
+ * @param[in] index: Settings index.
+ *
+ * @return Setting user id on success or NULL on failure.
+ *
+ */
+const char *esp_ble_mesh_provisioner_get_settings_uid(uint8_t index);
+
+/**
+ * @brief This function is called by Provisioner to get settings index.
+ *
+ * @param[in] uid: Settings user id.
+ *
+ * @return Settings index.
+ *
+ */
+uint8_t esp_ble_mesh_provisioner_get_settings_index(const char *uid);
+
+/**
+ * @brief This function is called by Provisioner to get the number of free
+ * settings user id.
+ *
+ * @return Number of free settings user id.
+ *
+ */
+uint8_t esp_ble_mesh_provisioner_get_free_settings_count(void);
+
+/**
+ * @brief This function is called to get fast provisioning application key.
+ *
+ * @param[in] net_idx: Network key index.
+ * @param[in] app_idx: Application key index.
+ *
+ * @return Application key on success, or NULL on failure.
+ *
+ */
+const uint8_t *esp_ble_mesh_get_fast_prov_app_key(uint16_t net_idx, uint16_t app_idx);
+
+#if CONFIG_BLE_MESH_CERT_BASED_PROV
+/**
+ * @brief This function is called by provisioner to send provisioning records
+ * get message.
+ *
+ * @param[in] link_idx: The provisioning link index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_send_prov_records_get(uint16_t link_idx);
+
+/**
+ * @brief This function is called by provisioner to send provisioning record
+ * request message.
+ *
+ * @param[in] link_idx: The provisioning link index.
+ * @param[in] record_id: The record identity.
+ * @param[in] frag_offset: The starting offset of the fragment.
+ * @param[in] max_size: The max record fragment size.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_send_prov_record_req(uint16_t link_idx, uint16_t record_id,
+ uint16_t frag_offset, uint16_t max_size);
+
+/**
+ * @brief This function is called by provisioner to send provisioning invite
+ * message.
+ *
+ * @param[in] link_idx: The provisioning link index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_send_prov_invite(uint16_t link_idx);
+
+/**
+ * @brief This function is called by provisioner to send link close
+ *
+ * @param[in] link_idx: The provisioning link index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_send_link_close(uint16_t link_idx);
+#endif /* #if CONFIG_BLE_MESH_CERT_BASED_PROV */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_NETWORKING_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_provisioning_api.h b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_provisioning_api.h
new file mode 100644
index 00000000..58ad2804
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_provisioning_api.h
@@ -0,0 +1,394 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_PROVISIONING_API_H_
+#define _ESP_BLE_MESH_PROVISIONING_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @brief: event, event code of provisioning events; param, parameters of provisioning events */
+typedef void (* esp_ble_mesh_prov_cb_t)(esp_ble_mesh_prov_cb_event_t event,
+ esp_ble_mesh_prov_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh provisioning callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_prov_callback(esp_ble_mesh_prov_cb_t callback);
+
+/**
+ * @brief Check if a device has been provisioned.
+ *
+ * @return TRUE if the device is provisioned, FALSE if the device is unprovisioned.
+ *
+ */
+bool esp_ble_mesh_node_is_provisioned(void);
+
+/**
+ * @brief Enable specific provisioning bearers to get the device ready for provisioning.
+ *
+ * @note PB-ADV: send unprovisioned device beacon.
+ * PB-GATT: send connectable advertising packets.
+ *
+ * @param bearers: Bit-wise OR of provisioning bearers.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_prov_enable(esp_ble_mesh_prov_bearer_t bearers);
+
+/**
+ * @brief Disable specific provisioning bearers to make a device inaccessible for provisioning.
+ *
+ * @param bearers: Bit-wise OR of provisioning bearers.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers);
+
+/**
+ * @brief Unprovisioned device set own oob public key & private key pair.
+ *
+ * @note In order to avoid suffering brute-forcing attack (CVE-2020-26559).
+ * The Bluetooth SIG recommends that potentially vulnerable mesh provisioners
+ * use an out-of-band mechanism to exchange the public keys.
+ * So as an unprovisioned device, it should use this function to input
+ * the Public Key exchanged through the out-of-band mechanism.
+ *
+ * @param[in] pub_key_x: Unprovisioned device's Public Key X
+ * @param[in] pub_key_y: Unprovisioned device's Public Key Y
+ * @param[in] private_key: Unprovisioned device's Private Key
+ *
+ * @return ESP_OK on success or error code otherwise.
+ */
+esp_err_t esp_ble_mesh_node_set_oob_pub_key(uint8_t pub_key_x[32], uint8_t pub_key_y[32],
+ uint8_t private_key[32]);
+
+/**
+ * @brief Provide provisioning input OOB number.
+ *
+ * @note This is intended to be called if the user has received ESP_BLE_MESH_NODE_PROV_INPUT_EVT
+ * with ESP_BLE_MESH_ENTER_NUMBER as the action.
+ *
+ * @param[in] number: Number input by device.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_input_number(uint32_t number);
+
+/**
+ * @brief Provide provisioning input OOB string.
+ *
+ * @note This is intended to be called if the user has received ESP_BLE_MESH_NODE_PROV_INPUT_EVT
+ * with ESP_BLE_MESH_ENTER_STRING as the action.
+ *
+ * @param[in] string: String input by device.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_node_input_string(const char *string);
+
+/**
+ * @brief Using this function, an unprovisioned device can set its own device name,
+ * which will be broadcasted in its advertising data.
+ *
+ * @param[in] name: Unprovisioned device name
+ *
+ * @note This API applicable to PB-GATT mode only by setting the name to the scan response data,
+ * it doesn't apply to PB-ADV mode.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name);
+
+/**
+ * @brief Provisioner inputs unprovisioned device's oob public key.
+ *
+ * @note In order to avoid suffering brute-forcing attack (CVE-2020-26559).
+ * The Bluetooth SIG recommends that potentially vulnerable mesh provisioners
+ * use an out-of-band mechanism to exchange the public keys.
+ *
+ * @param[in] link_idx: The provisioning link index
+ * @param[in] pub_key_x: Unprovisioned device's Public Key X
+ * @param[in] pub_key_y: Unprovisioned device's Public Key Y
+ *
+ * @return ESP_OK on success or error code otherwise.
+ */
+esp_err_t esp_ble_mesh_provisioner_read_oob_pub_key(uint8_t link_idx, uint8_t pub_key_x[32],
+ uint8_t pub_key_y[32]);
+
+/**
+ * @brief Provide provisioning input OOB string.
+ *
+ * This is intended to be called after the esp_ble_mesh_prov_t prov_input_num
+ * callback has been called with ESP_BLE_MESH_ENTER_STRING as the action.
+ *
+ * @param[in] string: String input by Provisioner.
+ * @param[in] link_idx: The provisioning link index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_input_string(const char *string, uint8_t link_idx);
+
+/**
+ * @brief Provide provisioning input OOB number.
+ *
+ * This is intended to be called after the esp_ble_mesh_prov_t prov_input_num
+ * callback has been called with ESP_BLE_MESH_ENTER_NUMBER as the action.
+ *
+ * @param[in] number: Number input by Provisioner.
+ * @param[in] link_idx: The provisioning link index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_input_number(uint32_t number, uint8_t link_idx);
+
+/**
+ * @brief Enable one or more provisioning bearers.
+ *
+ * @param[in] bearers: Bit-wise OR of provisioning bearers.
+ *
+ * @note PB-ADV: Enable BLE scan.
+ * PB-GATT: Initialize corresponding BLE Mesh Proxy info.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_prov_enable(esp_ble_mesh_prov_bearer_t bearers);
+
+/**
+ * @brief Disable one or more provisioning bearers.
+ *
+ * @param[in] bearers: Bit-wise OR of provisioning bearers.
+ *
+ * @note PB-ADV: Disable BLE scan.
+ * PB-GATT: Break any existing BLE Mesh Provisioning connections.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t bearers);
+
+/**
+ * @brief Add unprovisioned device info to the unprov_dev queue.
+ *
+ * @param[in] add_dev: Pointer to a struct containing the device information
+ * @param[in] flags: Flags indicate several operations on the device information
+ * - Remove device information from queue after device has been provisioned (BIT0)
+ * - Start provisioning immediately after device is added to queue (BIT1)
+ * - Device can be removed if device queue is full (BIT2)
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ * @note: 1. Currently address type only supports public address and static random address.
+ * 2. If device UUID and/or device address as well as address type already exist in the
+ * device queue, but the bearer is different from the existing one, add operation
+ * will also be successful and it will update the provision bearer supported by
+ * the device.
+ * 3. For example, if the Provisioner wants to add an unprovisioned device info before
+ * receiving its unprovisioned device beacon or Mesh Provisioning advertising packets,
+ * the Provisioner can use this API to add the device info with each one or both of
+ * device UUID and device address added. When the Provisioner gets the device's
+ * advertising packets, it will start provisioning the device internally.
+ * - In this situation, the Provisioner can set bearers with each one or both of
+ * ESP_BLE_MESH_PROV_ADV and ESP_BLE_MESH_PROV_GATT enabled, and cannot set flags
+ * with ADD_DEV_START_PROV_NOW_FLAG enabled.
+ * 4. Another example is when the Provisioner receives the unprovisioned device's beacon or
+ * Mesh Provisioning advertising packets, the advertising packets will be reported on to
+ * the application layer using the callback registered by the function
+ * esp_ble_mesh_register_prov_callback. And in the callback, the Provisioner
+ * can call this API to start provisioning the device.
+ * - If the Provisioner uses PB-ADV to provision, either one or both of device UUID and
+ * device address can be added, bearers shall be set with ESP_BLE_MESH_PROV_ADV
+ * enabled and the flags shall be set with ADD_DEV_START_PROV_NOW_FLAG enabled.
+ * - If the Provisioner uses PB-GATT to provision, both the device UUID and device
+ * address need to be added, bearers shall be set with ESP_BLE_MESH_PROV_GATT enabled,
+ * and the flags shall be set with ADD_DEV_START_PROV_NOW_FLAG enabled.
+ * - If the Provisioner just wants to store the unprovisioned device info when receiving
+ * its advertising packets and start to provision it the next time (e.g. after receiving
+ * its advertising packets again), then it can add the device info with either one or both
+ * of device UUID and device address included. Bearers can be set with either one or both
+ * of ESP_BLE_MESH_PROV_ADV and ESP_BLE_MESH_PROV_GATT enabled (recommend to enable the
+ * bearer which will receive its advertising packets, because if the other bearer is
+ * enabled, the Provisioner is not aware if the device supports the bearer), and flags
+ * cannot be set with ADD_DEV_START_PROV_NOW_FLAG enabled.
+ * - Note: ESP_BLE_MESH_PROV_ADV, ESP_BLE_MESH_PROV_GATT and ADD_DEV_START_PROV_NOW_FLAG
+ * can not be enabled at the same time.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t *add_dev,
+ esp_ble_mesh_dev_add_flag_t flags);
+
+/** @brief Provision an unprovisioned device and assign a fixed unicast address for it in advance.
+ *
+ * @param[in] uuid: Device UUID of the unprovisioned device
+ * @param[in] addr: Device address of the unprovisioned device
+ * @param[in] addr_type: Device address type of the unprovisioned device
+ * @param[in] bearer: Provisioning bearer going to be used by Provisioner
+ * @param[in] oob_info: OOB info of the unprovisioned device
+ * @param[in] unicast_addr: Unicast address going to be allocated for the unprovisioned device
+ *
+ * @return Zero on success or (negative) error code otherwise.
+ *
+ * @note: 1. Currently address type only supports public address and static random address.
+ * 2. Bearer must be equal to ESP_BLE_MESH_PROV_ADV or ESP_BLE_MESH_PROV_GATT, since
+ * Provisioner will start to provision a device immediately once this function is
+ * invoked. And the input bearer must be identical with the one within the parameters
+ * of the ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT event.
+ * 3. If this function is used by a Provisioner to provision devices, the application
+ * should take care of the assigned unicast address and avoid overlap of the unicast
+ * addresses of different nodes.
+ * 4. Recommend to use only one of the functions "esp_ble_mesh_provisioner_add_unprov_dev"
+ * and "esp_ble_mesh_provisioner_prov_device_with_addr" by a Provisioner.
+ */
+esp_err_t esp_ble_mesh_provisioner_prov_device_with_addr(const uint8_t uuid[16],
+ esp_ble_mesh_bd_addr_t addr,
+ esp_ble_mesh_addr_type_t addr_type,
+ esp_ble_mesh_prov_bearer_t bearer,
+ uint16_t oob_info, uint16_t unicast_addr);
+
+/**
+ * @brief Delete device from queue, and reset current provisioning link with the device.
+ *
+ * @note If the device is in the queue, remove it from the queue; if the device is
+ * being provisioned, terminate the provisioning procedure. Either one of the
+ * device address or device UUID can be used as input.
+ *
+ * @param[in] del_dev: Pointer to a struct containing the device information.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_delete_dev(esp_ble_mesh_device_delete_t *del_dev);
+
+/**
+ * @brief Callback for Provisioner that received advertising packets from unprovisioned devices which are
+ * not in the unprovisioned device queue.
+ *
+ * Report on the unprovisioned device beacon and mesh provisioning service adv data to application.
+ *
+ * @param[in] addr: Pointer to the unprovisioned device address.
+ * @param[in] addr_type: Unprovisioned device address type.
+ * @param[in] adv_type: Adv packet type(ADV_IND or ADV_NONCONN_IND).
+ * @param[in] dev_uuid: Unprovisioned device UUID pointer.
+ * @param[in] oob_info: OOB information of the unprovisioned device.
+ * @param[in] bearer: Adv packet received from PB-GATT or PB-ADV bearer.
+ *
+ */
+typedef void (*esp_ble_mesh_prov_adv_cb_t)(const esp_ble_mesh_bd_addr_t addr, const esp_ble_mesh_addr_type_t addr_type,
+ const uint8_t adv_type, const uint8_t *dev_uuid,
+ uint16_t oob_info, esp_ble_mesh_prov_bearer_t bearer);
+
+/**
+ * @brief This function is called by Provisioner to set the part of the device UUID
+ * to be compared before starting to provision.
+ *
+ * @param[in] match_val: Value to be compared with the part of the device UUID.
+ * @param[in] match_len: Length of the compared match value.
+ * @param[in] offset: Offset of the device UUID to be compared (based on zero).
+ * @param[in] prov_after_match: Flag used to indicate whether provisioner should start to provision
+ * the device immediately if the part of the UUID matches.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_set_dev_uuid_match(const uint8_t *match_val, uint8_t match_len,
+ uint8_t offset, bool prov_after_match);
+
+/**
+ * @brief This function is called by Provisioner to set provisioning data information
+ * before starting to provision.
+ *
+ * @param[in] prov_data_info: Pointer to a struct containing net_idx or flags or iv_index.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_set_prov_data_info(esp_ble_mesh_prov_data_info_t *prov_data_info);
+
+/**
+ * @brief This function is called by Provisioner to set static oob value used for provisioning.
+ *
+ * @note The Bluetooth SIG recommends that mesh implementations enforce a randomly selected
+ * AuthValue using all of the available bits, where permitted by the implementation.
+ * A large entropy helps ensure that a brute-force of the AuthValue, even a static
+ * AuthValue, cannot normally be completed in a reasonable time (CVE-2020-26557).
+ *
+ * AuthValues selected using a cryptographically secure random or pseudorandom number
+ * generator and having the maximum permitted entropy (128-bits) will be most difficult
+ * to brute-force. AuthValues with reduced entropy or generated in a predictable manner
+ * will not grant the same level of protection against this vulnerability. Selecting a
+ * new AuthValue with each provisioning attempt can also make it more difficult to launch
+ * a brute-force attack by requiring the attacker to restart the search with each
+ * provisioning attempt (CVE-2020-26556).
+ *
+ * @param[in] value: Pointer to the static oob value.
+ * @param[in] length: Length of the static oob value.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_set_static_oob_value(const uint8_t *value, uint8_t length);
+
+/**
+ * @brief This function is called by Provisioner to set own Primary element address.
+ *
+ * @note This API must be invoked when BLE Mesh initialization is completed successfully,
+ * and can be invoked before Provisioner functionality is enabled.
+ * Once this API is invoked successfully, the prov_unicast_addr value in the struct
+ * esp_ble_mesh_prov_t will be ignored, and Provisioner will use this address as its
+ * own primary element address.
+ * And if the unicast address going to assigned for the next unprovisioned device is
+ * smaller than the input address + element number of Provisioner, then the address
+ * for the next unprovisioned device will be recalculated internally.
+ *
+ * @param[in] addr: Unicast address of the Primary element of Provisioner.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_provisioner_set_primary_elem_addr(uint16_t addr);
+
+/**
+ * @brief This function is called to set provisioning data information before starting
+ * fast provisioning.
+ *
+ * @param[in] fast_prov_info: Pointer to a struct containing unicast address range, net_idx, etc.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_set_fast_prov_info(esp_ble_mesh_fast_prov_info_t *fast_prov_info);
+
+/**
+ * @brief This function is called to start/suspend/exit fast provisioning.
+ *
+ * @param[in] action: fast provisioning action (i.e. enter, suspend, exit).
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_set_fast_prov_action(esp_ble_mesh_fast_prov_action_t action);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_PROVISIONING_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_proxy_api.h b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_proxy_api.h
new file mode 100644
index 00000000..66b1e1d4
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/core/include/esp_ble_mesh_proxy_api.h
@@ -0,0 +1,170 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_PROXY_API_H_
+#define _ESP_BLE_MESH_PROXY_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ESP_BLE_MESH_PROXY_CLI_DIRECTED_FORWARDING_ENABLE 0x01
+#define ESP_BLE_MESH_PROXY_CLI_DIRECTED_FORWARDING_DISABLE 0x00
+
+/**
+ * @brief Enable advertising with Node Identity.
+ *
+ * @note This API requires that GATT Proxy support be enabled. Once called,
+ * each subnet starts advertising using Node Identity for the next 60
+ * seconds, and after 60s Network ID will be advertised.
+ * Under normal conditions, the BLE Mesh Proxy Node Identity and
+ * Network ID advertising will be enabled automatically by BLE Mesh
+ * stack after the device is provisioned.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_identity_enable(void);
+
+/**
+ * @brief Enable BLE Mesh GATT Proxy Service.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_gatt_enable(void);
+
+/**
+ * @brief Disconnect the BLE Mesh GATT Proxy connection if there is any, and
+ * disable the BLE Mesh GATT Proxy Service.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_gatt_disable(void);
+
+/**
+ * @brief Enable advertising with Private Node Identity.
+ *
+ * @note This API requires that GATT Proxy support be enabled. Once called,
+ * each subnet starts advertising using Private Node Identity for the
+ * next 60 seconds, and after 60s Private Network ID will be advertised.
+ * Under normal conditions, the BLE Mesh Proxy Node Identity, Network
+ * ID advertising, Proxy Private Node Identity and Private Network
+ * ID advertising will be enabled automatically by BLE Mesh stack
+ * after the device is provisioned.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_private_proxy_identity_enable(void);
+
+/**
+ * @brief Disable advertising with Private Node Identity.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_private_proxy_identity_disable(void);
+
+/**
+ * @brief Proxy Client creates a connection with the Proxy Server.
+ *
+ * @param[in] addr: Device address of the Proxy Server.
+ * @param[in] addr_type: Device address type(public or static random).
+ * @param[in] net_idx: NetKey Index related with Network ID in the Mesh Proxy
+ * advertising packet.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr,
+ esp_ble_mesh_addr_type_t addr_type,
+ uint16_t net_idx);
+
+/**
+ * @brief Proxy Client terminates a connection with the Proxy Server.
+ *
+ * @param[in] conn_handle: Proxy connection handle.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_client_disconnect(uint8_t conn_handle);
+
+/**
+ * @brief Proxy Client sets the filter type of the Proxy Server.
+ *
+ * @param[in] conn_handle: Proxy connection handle.
+ * @param[in] net_idx: Corresponding NetKey Index.
+ * @param[in] filter_type: whitelist or blacklist.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle, uint16_t net_idx,
+ esp_ble_mesh_proxy_filter_type_t filter_type);
+
+/**
+ * @brief Proxy Client adds address to the Proxy Server filter list.
+ *
+ * @param[in] conn_handle: Proxy connection handle.
+ * @param[in] net_idx: Corresponding NetKey Index.
+ * @param[in] addr: Pointer to the filter address.
+ * @param[in] addr_num: Number of the filter address.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle, uint16_t net_idx,
+ uint16_t *addr, uint16_t addr_num);
+
+/**
+ * @brief Proxy Client removes address from the Proxy Server filter list.
+ *
+ * @param[in] conn_handle: Proxy connection handle.
+ * @param[in] net_idx: Corresponding NetKey Index.
+ * @param[in] addr: Pointer to the filter address.
+ * @param[in] addr_num: Number of the filter address.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle, uint16_t net_idx,
+ uint16_t *addr, uint16_t addr_num);
+
+/**
+ * @brief Proxy Client sets whether or not the Directed Proxy Server uses directed forwarding
+ * for Directed Proxy Client messages.
+ *
+ * @param[in] conn_handle: Proxy connection handle.
+ * @param[in] net_idx: Corresponding NetKey Index.
+ * @param[in] use_directed: Whether or not to send message by directed forwarding.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_client_directed_proxy_set(uint8_t conn_handle, uint16_t net_idx,
+ uint8_t use_directed);
+/**
+ * @brief Proxy Client sends Solicitation PDU.
+ *
+ * @param[in] net_idx: Corresponding NetKey Index.
+ * @param[in] ssrc: Solicitation SRC, shall be one of its element address.
+ * @param[in] dst: Solicitation DST (TBD).
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_proxy_client_send_solic_pdu(uint8_t net_idx, uint16_t ssrc, uint16_t dst);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_PROXY_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h b/lib/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h
new file mode 100644
index 00000000..efbf2df5
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h
@@ -0,0 +1,2507 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_DEFS_H_
+#define _ESP_BLE_MESH_DEFS_H_
+
+#include <stdint.h>
+
+#include "mesh/config.h"
+#include "mesh/common.h"
+#include "proxy_server.h"
+#include "pvnr_mgmt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*!< The maximum length of a BLE Mesh message, including Opcode, Payload and TransMIC */
+#define ESP_BLE_MESH_SDU_MAX_LEN 384
+
+/*!< Length of a short Mesh MIC. */
+#define ESP_BLE_MESH_MIC_SHORT 4
+
+/*!< Length of a long Mesh MIC. */
+#define ESP_BLE_MESH_MIC_LONG 8
+
+/*!< The maximum length of a BLE Mesh provisioned node name */
+#define ESP_BLE_MESH_NODE_NAME_MAX_LEN 31
+
+/*!< The maximum length of a BLE Mesh unprovisioned device name */
+#define ESP_BLE_MESH_DEVICE_NAME_MAX_LEN DEVICE_NAME_SIZE
+
+/*!< The maximum length of settings user id */
+#define ESP_BLE_MESH_SETTINGS_UID_SIZE 20
+
+/*!< The default value of Random Update Interval Steps */
+#define ESP_BLE_MESH_RAND_UPDATE_INTERVAL_DEFAULT 0x3C
+
+/*!< Invalid settings index */
+#define ESP_BLE_MESH_INVALID_SETTINGS_IDX 0xFF
+
+/*!< Define the BLE Mesh octet 16 bytes size */
+#define ESP_BLE_MESH_OCTET16_LEN 16
+typedef uint8_t esp_ble_mesh_octet16_t[ESP_BLE_MESH_OCTET16_LEN];
+
+/*!< Define the BLE Mesh octet 8 bytes size */
+#define ESP_BLE_MESH_OCTET8_LEN 8
+typedef uint8_t esp_ble_mesh_octet8_t[ESP_BLE_MESH_OCTET8_LEN];
+
+/*!< Invalid Company ID */
+#define ESP_BLE_MESH_CID_NVAL 0xFFFF
+
+/*!< Special TTL value to request using configured default TTL */
+#define ESP_BLE_MESH_TTL_DEFAULT 0xFF
+
+/*!< Maximum allowed TTL value */
+#define ESP_BLE_MESH_TTL_MAX 0x7F
+
+#define ESP_BLE_MESH_ADDR_UNASSIGNED 0x0000
+#define ESP_BLE_MESH_ADDR_ALL_NODES 0xFFFF
+#define ESP_BLE_MESH_ADDR_PROXIES 0xFFFC
+#define ESP_BLE_MESH_ADDR_FRIENDS 0xFFFD
+#define ESP_BLE_MESH_ADDR_RELAYS 0xFFFE
+
+#define ESP_BLE_MESH_KEY_UNUSED 0xFFFF
+#define ESP_BLE_MESH_KEY_DEV 0xFFFE
+
+#define ESP_BLE_MESH_KEY_PRIMARY 0x0000
+#define ESP_BLE_MESH_KEY_ANY 0xFFFF
+
+/*!< Internal macros used to initialize array members */
+#define ESP_BLE_MESH_KEY_UNUSED_ELT_(IDX, _) ESP_BLE_MESH_KEY_UNUSED
+#define ESP_BLE_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) ESP_BLE_MESH_ADDR_UNASSIGNED
+#define ESP_BLE_MESH_MODEL_KEYS_UNUSED \
+ { LISTIFY(CONFIG_BLE_MESH_MODEL_KEY_COUNT, ESP_BLE_MESH_KEY_UNUSED_ELT_, (,)) }
+#define ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED \
+ { LISTIFY(CONFIG_BLE_MESH_MODEL_GROUP_COUNT, ESP_BLE_MESH_ADDR_UNASSIGNED_ELT_, (,)) }
+
+/*!< Primary Network Key index */
+#define ESP_BLE_MESH_NET_PRIMARY 0x000
+
+/*!< Relay state value */
+#define ESP_BLE_MESH_RELAY_DISABLED 0x00
+#define ESP_BLE_MESH_RELAY_ENABLED 0x01
+#define ESP_BLE_MESH_RELAY_NOT_SUPPORTED 0x02
+
+/*!< Beacon state value */
+#define ESP_BLE_MESH_BEACON_DISABLED 0x00
+#define ESP_BLE_MESH_BEACON_ENABLED 0x01
+
+#define ESP_BLE_MESH_PRIVATE_BEACON_DISABLE 0x00
+#define ESP_BLE_MESH_PRIVATE_BEACON_ENABLE 0x01
+
+/*!< GATT Proxy state value */
+#define ESP_BLE_MESH_GATT_PROXY_DISABLED 0x00
+#define ESP_BLE_MESH_GATT_PROXY_ENABLED 0x01
+#define ESP_BLE_MESH_GATT_PROXY_NOT_SUPPORTED 0x02
+
+#define ESP_BLE_MESH_PRIVATE_GATT_PROXY_DISABLED 0x00
+#define ESP_BLE_MESH_PRIVATE_GATT_PROXY_ENABLED 0x01
+#define ESP_BLE_MESH_PRIVATE_GATT_PROXY_NOT_SUPPORTED 0x02
+
+#define ESP_BLE_MESH_PRIVATE_NODE_IDENTITY_DISABLED 0x00
+#define ESP_BLE_MESH_PRIVATE_NODE_IDENTITY_ENABLED 0x01
+#define ESP_BLE_MESH_PRIVATE_NODE_IDENTITY_NOT_SUPPORTED 0x02
+
+/*!< Friend state value */
+#define ESP_BLE_MESH_FRIEND_DISABLED 0x00
+#define ESP_BLE_MESH_FRIEND_ENABLED 0x01
+#define ESP_BLE_MESH_FRIEND_NOT_SUPPORTED 0x02
+
+/*!< Node identity state value */
+#define ESP_BLE_MESH_NODE_IDENTITY_STOPPED 0x00
+#define ESP_BLE_MESH_NODE_IDENTITY_RUNNING 0x01
+#define ESP_BLE_MESH_NODE_IDENTITY_NOT_SUPPORTED 0x02
+
+/*!< Subnet Bridge state value */
+#define ESP_BLE_MESH_SUBNET_BRIDGE_DISABLED 0x00
+#define ESP_BLE_MESH_SUBNET_BRIDGE_ENABLED 0x01
+
+/*!< Supported features */
+#define ESP_BLE_MESH_FEATURE_RELAY BIT(0)
+#define ESP_BLE_MESH_FEATURE_PROXY BIT(1)
+#define ESP_BLE_MESH_FEATURE_FRIEND BIT(2)
+#define ESP_BLE_MESH_FEATURE_LOW_POWER BIT(3)
+#define ESP_BLE_MESH_FEATURE_ALL_SUPPORTED (ESP_BLE_MESH_FEATURE_RELAY | \
+ ESP_BLE_MESH_FEATURE_PROXY | \
+ ESP_BLE_MESH_FEATURE_FRIEND | \
+ ESP_BLE_MESH_FEATURE_LOW_POWER)
+
+#define ESP_BLE_MESH_ADDR_IS_UNICAST(addr) ((addr) && (addr) < 0x8000)
+#define ESP_BLE_MESH_ADDR_IS_GROUP(addr) ((addr) >= 0xC000 && (addr) <= 0xFF00)
+#define ESP_BLE_MESH_ADDR_IS_VIRTUAL(addr) ((addr) >= 0x8000 && (addr) < 0xC000)
+#define ESP_BLE_MESH_ADDR_IS_RFU(addr) ((addr) >= 0xFF00 && (addr) <= 0xFFFB)
+
+#define ESP_BLE_MESH_INVALID_NODE_INDEX 0xFFFF
+
+#define ESP_BLE_MESH_PROV_RECORD_MAX_ID 0x0013
+
+/** @def ESP_BLE_MESH_TRANSMIT
+ *
+ * @brief Encode transmission count & interval steps.
+ *
+ * @note For example, ESP_BLE_MESH_TRANSMIT(2, 20) means that the message
+ * will be sent about 90ms(count is 3, step is 1, interval is 30 ms
+ * which includes 10ms of advertising interval random delay).
+ *
+ * @param count Number of retransmissions (first transmission is excluded).
+ * @param int_ms Interval steps in milliseconds. Must be greater than 0
+ * and a multiple of 10.
+ *
+ * @return BLE Mesh transmit value that can be used e.g. for the default
+ * values of the Configuration Model data.
+ */
+#define ESP_BLE_MESH_TRANSMIT(count, int_ms) ((count) | (((int_ms / 10) - 1) << 3))
+
+/** @def ESP_BLE_MESH_GET_TRANSMIT_COUNT
+ *
+ * @brief Decode transmit count from a transmit value.
+ *
+ * @param transmit Encoded transmit count & interval value.
+ *
+ * @return Transmission count (actual transmissions equal to N + 1).
+ */
+#define ESP_BLE_MESH_GET_TRANSMIT_COUNT(transmit) (((transmit) & (uint8_t)BIT_MASK(3)))
+
+/** @def ESP_BLE_MESH_GET_TRANSMIT_INTERVAL
+ *
+ * @brief Decode transmit interval from a transmit value.
+ *
+ * @param transmit Encoded transmit count & interval value.
+ *
+ * @return Transmission interval in milliseconds.
+ */
+#define ESP_BLE_MESH_GET_TRANSMIT_INTERVAL(transmit) ((((transmit) >> 3) + 1) * 10)
+
+/** @def ESP_BLE_MESH_PUBLISH_TRANSMIT
+ *
+ * @brief Encode Publish Retransmit count & interval steps.
+ *
+ * @param count Number of retransmissions (first transmission is excluded).
+ * @param int_ms Interval steps in milliseconds. Must be greater than 0
+ * and a multiple of 50.
+ *
+ * @return BLE Mesh transmit value that can be used e.g. for the default
+ * values of the Configuration Model data.
+ */
+#define ESP_BLE_MESH_PUBLISH_TRANSMIT(count, int_ms) ESP_BLE_MESH_TRANSMIT(count, (int_ms) / 5)
+
+/** @def ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_COUNT
+ *
+ * @brief Decode Publish Retransmit count from a given value.
+ *
+ * @param transmit Encoded Publish Retransmit count & interval value.
+ *
+ * @return Retransmission count (actual transmissions equal to N + 1).
+ */
+#define ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_COUNT(transmit) ESP_BLE_MESH_GET_TRANSMIT_COUNT(transmit)
+
+/** @def ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_INTERVAL
+ *
+ * @brief Decode Publish Retransmit interval from a given value.
+ *
+ * @param transmit Encoded Publish Retransmit count & interval value.
+ *
+ * @return Transmission interval in milliseconds.
+ */
+#define ESP_BLE_MESH_GET_PUBLISH_TRANSMIT_INTERVAL(transmit) ((((transmit) >> 3) + 1) * 50)
+
+/*!< Callbacks which are not needed to be initialized by users (set with 0 and will be initialized internally) */
+typedef uint32_t esp_ble_mesh_cb_t;
+
+typedef enum {
+ ESP_BLE_MESH_TYPE_PROV_CB,
+ ESP_BLE_MESH_TYPE_OUTPUT_NUM_CB,
+ ESP_BLE_MESH_TYPE_OUTPUT_STR_CB,
+ ESP_BLE_MESH_TYPE_INTPUT_CB,
+ ESP_BLE_MESH_TYPE_LINK_OPEN_CB,
+ ESP_BLE_MESH_TYPE_LINK_CLOSE_CB,
+ ESP_BLE_MESH_TYPE_COMPLETE_CB,
+ ESP_BLE_MESH_TYPE_RESET_CB,
+} esp_ble_mesh_cb_type_t;
+
+/*!< This enum value is provisioning authentication oob method */
+typedef enum {
+ ESP_BLE_MESH_NO_OOB,
+ ESP_BLE_MESH_STATIC_OOB,
+ ESP_BLE_MESH_OUTPUT_OOB,
+ ESP_BLE_MESH_INPUT_OOB,
+} esp_ble_mesh_oob_method_t;
+
+/*!< This enum value is associated with bt_mesh_output_action_t in mesh_main.h */
+typedef enum {
+ ESP_BLE_MESH_NO_OUTPUT = 0,
+ ESP_BLE_MESH_BLINK = BIT(0),
+ ESP_BLE_MESH_BEEP = BIT(1),
+ ESP_BLE_MESH_VIBRATE = BIT(2),
+ ESP_BLE_MESH_DISPLAY_NUMBER = BIT(3),
+ ESP_BLE_MESH_DISPLAY_STRING = BIT(4),
+} esp_ble_mesh_output_action_t;
+
+/*!< This enum value is associated with bt_mesh_input_action_t in mesh_main.h */
+typedef enum {
+ ESP_BLE_MESH_NO_INPUT = 0,
+ ESP_BLE_MESH_PUSH = BIT(0),
+ ESP_BLE_MESH_TWIST = BIT(1),
+ ESP_BLE_MESH_ENTER_NUMBER = BIT(2),
+ ESP_BLE_MESH_ENTER_STRING = BIT(3),
+} esp_ble_mesh_input_action_t;
+
+/*!< This enum value is associated with bt_mesh_prov_bearer_t in mesh_main.h */
+typedef enum {
+ ESP_BLE_MESH_PROV_ADV = BIT(0),
+ ESP_BLE_MESH_PROV_GATT = BIT(1),
+} esp_ble_mesh_prov_bearer_t;
+
+/*!< This enum value is associated with bt_mesh_prov_oob_info_t in mesh_main.h */
+typedef enum {
+ ESP_BLE_MESH_PROV_OOB_OTHER = BIT(0),
+ ESP_BLE_MESH_PROV_OOB_URI = BIT(1),
+ ESP_BLE_MESH_PROV_OOB_2D_CODE = BIT(2),
+ ESP_BLE_MESH_PROV_OOB_BAR_CODE = BIT(3),
+ ESP_BLE_MESH_PROV_OOB_NFC = BIT(4),
+ ESP_BLE_MESH_PROV_OOB_NUMBER = BIT(5),
+ ESP_BLE_MESH_PROV_OOB_STRING = BIT(6),
+ ESP_BLE_MESH_PROV_CERT_BASED = BIT(7),
+ ESP_BLE_MESH_PROV_RECORDS = BIT(8),
+ /* 9 - 10 are reserved */
+ ESP_BLE_MESH_PROV_OOB_ON_BOX = BIT(11),
+ ESP_BLE_MESH_PROV_OOB_IN_BOX = BIT(12),
+ ESP_BLE_MESH_PROV_OOB_ON_PAPER = BIT(13),
+ ESP_BLE_MESH_PROV_OOB_IN_MANUAL = BIT(14),
+ ESP_BLE_MESH_PROV_OOB_ON_DEV = BIT(15),
+} esp_ble_mesh_prov_oob_info_t;
+
+/*!< Maximum length of value used by Static OOB authentication */
+#define ESP_BLE_MESH_PROV_STATIC_OOB_MAX_LEN 16
+
+/*!< Maximum length of string used by Output OOB authentication */
+#define ESP_BLE_MESH_PROV_OUTPUT_OOB_MAX_LEN 8
+
+/*!< Maximum length of string used by Output OOB authentication */
+#define ESP_BLE_MESH_PROV_INPUT_OOB_MAX_LEN 8
+
+/*!< Macros used to define message opcode */
+#define ESP_BLE_MESH_MODEL_OP_1(b0) (b0)
+#define ESP_BLE_MESH_MODEL_OP_2(b0, b1) (((b0) << 8) | (b1))
+#define ESP_BLE_MESH_MODEL_OP_3(b0, cid) ((((b0) << 16) | 0xC00000) | (cid))
+
+/*!< This macro is associated with BLE_MESH_MODEL_CB in mesh_access.h */
+#define ESP_BLE_MESH_SIG_MODEL(_id, _op, _pub, _user_data) \
+{ \
+ .model_id = (_id), \
+ .pub = _pub, \
+ .keys = ESP_BLE_MESH_MODEL_KEYS_UNUSED, \
+ .groups = ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED, \
+ .op = _op, \
+ .user_data = _user_data, \
+}
+
+/*!< This macro is associated with BLE_MESH_MODEL_VND_CB in mesh_access.h */
+#define ESP_BLE_MESH_VENDOR_MODEL(_company, _id, _op, _pub, _user_data) \
+{ \
+ .vnd = { \
+ .company_id = (_company), \
+ .model_id = (_id), \
+ }, \
+ .pub = _pub, \
+ .keys = ESP_BLE_MESH_MODEL_KEYS_UNUSED, \
+ .groups = ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED, \
+ .op = _op, \
+ .user_data = _user_data, \
+}
+
+/** @brief Helper to define a BLE Mesh element within an array.
+ *
+ * In case the element has no SIG or Vendor models, the helper
+ * macro ESP_BLE_MESH_MODEL_NONE can be given instead.
+ *
+ * @note This macro is associated with BLE_MESH_ELEM in mesh_access.h
+ *
+ * @param _loc Location Descriptor.
+ * @param _mods Array of SIG models.
+ * @param _vnd_mods Array of vendor models.
+ */
+#define ESP_BLE_MESH_ELEMENT(_loc, _mods, _vnd_mods) \
+{ \
+ .location = (_loc), \
+ .sig_model_count = ARRAY_SIZE(_mods), \
+ .vnd_model_count = ARRAY_SIZE(_vnd_mods), \
+ .sig_models = (_mods), \
+ .vnd_models = (_vnd_mods), \
+}
+
+#define ESP_BLE_MESH_PROV(uuid, sta_val, sta_val_len, out_size, out_act, in_size, in_act) { \
+ .uuid = uuid, \
+ .static_val = sta_val, \
+ .static_val_len = sta_val_len, \
+ .output_size = out_size, \
+ .output_action = out_act, \
+ .input_size = in_size, \
+ .input_action = in_act, \
+}
+
+typedef uint8_t UINT8 __attribute__((deprecated));
+typedef uint16_t UINT16 __attribute__((deprecated));
+typedef uint32_t UINT32 __attribute__((deprecated));
+typedef uint64_t UINT64 __attribute__((deprecated));
+
+#ifndef BT_OCTET32_LEN
+#define BT_OCTET32_LEN 32
+typedef UINT8 BT_OCTET32[BT_OCTET32_LEN] __attribute__((deprecated));
+#endif
+
+#ifndef BD_ADDR_LEN
+#define BD_ADDR_LEN 6
+typedef uint8_t BD_ADDR[BD_ADDR_LEN] __attribute__((deprecated));
+#endif
+
+typedef uint8_t esp_ble_mesh_bd_addr_t[BD_ADDR_LEN];
+
+#define ESP_BLE_MESH_ADDR_TYPE_PUBLIC 0x00
+#define ESP_BLE_MESH_ADDR_TYPE_RANDOM 0x01
+#define ESP_BLE_MESH_ADDR_TYPE_RPA_PUBLIC 0x02
+#define ESP_BLE_MESH_ADDR_TYPE_RPA_RANDOM 0x03
+/// BLE device address type
+typedef uint8_t esp_ble_mesh_addr_type_t;
+
+#define ESP_BLE_MESH_DIRECTED_FORWARDING_DISABLED 0x00
+#define ESP_BLE_MESH_DIRECTED_FORWARDING_ENABLED 0x01
+
+#define ESP_BLE_MESH_DIRECTED_RELAY_DISABLED 0x00
+#define ESP_BLE_MESH_DIRECTED_RELAY_ENABLED 0x01
+
+#define ESP_BLE_MESH_DIRECTED_PROXY_IGNORE 0xFF
+#define ESP_BLE_MESH_DIRECTED_PROXY_USE_DEFAULT_IGNORE 0xFF
+#define ESP_BLE_MESH_DIRECTED_FRIEND_IGNORE 0xFF
+
+#define ESP_BLE_MESH_DIRECTED_PROXY_DISABLED 0x00
+#define ESP_BLE_MESH_DIRECTED_PROXY_ENABLED 0x01
+#define ESP_BLE_MESH_DIRECTED_PROXY_NOT_SUPPORTED 0x02
+
+#define ESP_BLE_MESH_DIRECTED_PROXY_USE_DEF_DISABLED 0x00
+#define ESP_BLE_MESH_DIRECTED_PROXY_USE_DEF_ENABLED 0x01
+#define ESP_BLE_MESH_DIRECTED_PROXY_USE_DEF_NOT_SUPPORTED 0x02
+
+#define ESP_BLE_MESH_DIRECTED_FRIEND_DISABLED 0x00
+#define ESP_BLE_MESH_DIRECTED_FRIEND_ENABLED 0x01
+#define ESP_BLE_MESH_DIRECTED_FRIEND_NOT_SUPPORTED 0x02
+
+#define ESP_BLE_MESH_DIRECTED_PUB_POLICY_FLOODING 0x00
+#define ESP_BLE_MESH_DIRECTED_PUB_POLICY_FORWARD 0x01
+
+#define ESP_BLE_MESH_PROXY_USE_DIRECTED_DISABLED 0x00
+#define ESP_BLE_MESH_PROXY_USE_DIRECTED_ENABLED 0x01
+
+#define ESP_BLE_MESH_FLOODING_CRED 0x00 /* Managed flooding security credentials */
+#define ESP_BLE_MESH_FRIENDSHIP_CRED 0x01 /* Friendship security credentials */
+#define ESP_BLE_MESH_DIRECTED_CRED 0x02 /* Directed security credentials */
+
+#define ESP_BLE_MESH_TAG_SEND_SEGMENTED BIT(0) /* Tagged with send-segmented */
+#define ESP_BLE_MESH_TAG_IMMUTABLE_CRED BIT(1) /* Tagged with immutable-credentials */
+#define ESP_BLE_MESH_TAG_USE_DIRECTED BIT(2) /* Tagged with use-directed */
+#define ESP_BLE_MESH_TAG_RELAY BIT(3) /* Tagged as relay */
+#define ESP_BLE_MESH_TAG_FRIENDSHIP BIT(4) /* Tagged as a friendship PDU */
+
+#define ESP_BLE_MESH_SEG_SZMIC_SHORT 0 /* Using 4-octets TransMIC for a segmented message */
+#define ESP_BLE_MESH_SEG_SZMIC_LONG 1 /* Using 8-octets TransMIC for a segmented message */
+
+/** BLE Mesh deinit parameters */
+typedef struct {
+ bool erase_flash; /*!< Indicate if erasing flash when deinit mesh stack */
+} esp_ble_mesh_deinit_param_t;
+
+/** Format of Unicast Address Range */
+typedef struct {
+ uint16_t len_present:1, /*!< Indicate the presence or absence of the RangeLength field */
+ range_start:15; /*!< 15 least significant bits of the starting unicast address */
+ uint8_t range_length; /*!< Number of addresses in the range (0x02 - 0xFF) */
+} esp_ble_mesh_uar_t;
+
+typedef struct esp_ble_mesh_model esp_ble_mesh_model_t;
+
+/** Abstraction that describes a BLE Mesh Element.
+ * This structure is associated with struct bt_mesh_elem in mesh_access.h
+ */
+typedef struct {
+ /** Element Address, assigned during provisioning. */
+ uint16_t element_addr;
+
+ /** Location Descriptor (GATT Bluetooth Namespace Descriptors) */
+ const uint16_t location;
+
+ const uint8_t sig_model_count; /*!< SIG Model count */
+ const uint8_t vnd_model_count; /*!< Vendor Model count */
+
+ esp_ble_mesh_model_t *sig_models; /*!< SIG Models */
+ esp_ble_mesh_model_t *vnd_models; /*!< Vendor Models */
+} esp_ble_mesh_elem_t;
+
+/** Abstraction that describes a model publication context.
+ * This structure is associated with struct bt_mesh_model_pub in mesh_access.h
+ */
+typedef struct {
+ /** Pointer to the model to which the context belongs. Initialized by the stack. */
+ esp_ble_mesh_model_t *model;
+
+ uint16_t publish_addr; /*!< Publish Address. */
+ uint16_t app_idx:12, /*!< Publish AppKey Index. */
+ cred:1, /*!< Friendship Credentials Flag. */
+ send_rel:1, /*!< Force reliable sending (segment acks) */
+ send_szmic:1; /*!< Size of TransMIC when publishing a Segmented Access message */
+
+ uint8_t ttl; /*!< Publish Time to Live. */
+ uint8_t retransmit; /*!< Retransmit Count & Interval Steps. */
+
+ uint8_t period; /*!< Publish Period. */
+ uint8_t period_div:4, /*!< Divisor for the Period. */
+ fast_period:1, /*!< Use FastPeriodDivisor */
+ count:3; /*!< Retransmissions left. */
+
+ uint32_t period_start; /*!< Start of the current period. */
+
+#if CONFIG_BLE_MESH_DF_SRV
+ uint8_t directed_pub_policy; /*!< Directed publish policy */
+#endif
+
+ /** @brief Publication buffer, containing the publication message.
+ *
+ * This will get correctly created when the publication context
+ * has been defined using the ESP_BLE_MESH_MODEL_PUB_DEFINE macro.
+ *
+ * ESP_BLE_MESH_MODEL_PUB_DEFINE(name, size);
+ */
+ struct net_buf_simple *msg;
+
+ /** Callback used to update publish message. Initialized by the stack. */
+ esp_ble_mesh_cb_t update;
+
+ /** Publish Period Timer. Initialized by the stack. */
+ struct k_delayed_work timer;
+
+ /** Role of the device that is going to publish messages */
+ uint8_t dev_role __attribute__((deprecated));
+} esp_ble_mesh_model_pub_t;
+
+/** @def ESP_BLE_MESH_MODEL_PUB_DEFINE
+ *
+ * Define a model publication context.
+ *
+ * @param _name Variable name given to the context.
+ * @param _msg_len Length of the publication message.
+ * @param _role Role of the device which contains the model.
+ */
+#define ESP_BLE_MESH_MODEL_PUB_DEFINE(_name, _msg_len, _role) \
+ NET_BUF_SIMPLE_DEFINE_STATIC(bt_mesh_pub_msg_##_name, _msg_len); \
+ static esp_ble_mesh_model_pub_t _name = { \
+ .msg = &bt_mesh_pub_msg_##_name, \
+ .update = (uint32_t)NULL, \
+ .dev_role = _role, \
+ }
+
+/** @def ESP_BLE_MESH_MODEL_OP
+ *
+ * Define a model operation context.
+ *
+ * @param _opcode Message opcode.
+ * @param _min_len Message minimum length.
+ */
+#define ESP_BLE_MESH_MODEL_OP(_opcode, _min_len) \
+{ \
+ .opcode = _opcode, \
+ .min_len = _min_len, \
+ .param_cb = (uint32_t)NULL, \
+}
+
+/** Abstraction that describes a model operation context.
+ * This structure is associated with struct bt_mesh_model_op in mesh_access.h
+ */
+typedef struct {
+ const uint32_t opcode; /*!< Message opcode */
+ const size_t min_len; /*!< Message minimum length */
+ esp_ble_mesh_cb_t param_cb; /*!< Callback used to handle message. Initialized by the stack. */
+} esp_ble_mesh_model_op_t;
+
+/** Define the terminator for the model operation table.
+ * Each model operation struct array must use this terminator as
+ * the end tag of the operation unit.
+ */
+#define ESP_BLE_MESH_MODEL_OP_END {0, 0, 0}
+
+/** Abstraction that describes a model callback structure.
+ * This structure is associated with struct bt_mesh_model_cb in mesh_access.h.
+ */
+typedef struct {
+ /** Callback used during model initialization. Initialized by the stack. */
+ esp_ble_mesh_cb_t init_cb;
+
+#if CONFIG_BLE_MESH_DEINIT
+ /** Callback used during model deinitialization. Initialized by the stack. */
+ esp_ble_mesh_cb_t deinit_cb;
+#endif /* CONFIG_BLE_MESH_DEINIT */
+} esp_ble_mesh_model_cbs_t;
+
+/** Abstraction that describes a Mesh Model instance.
+ * This structure is associated with struct bt_mesh_model in mesh_access.h
+ */
+struct esp_ble_mesh_model {
+ /** Model ID */
+ union {
+ const uint16_t model_id; /*!< 16-bit model identifier */
+ struct {
+ uint16_t company_id; /*!< 16-bit company identifier */
+ uint16_t model_id; /*!< 16-bit model identifier */
+ } vnd; /*!< Structure encapsulating a model ID with a company ID */
+ };
+
+ /** Internal information, mainly for persistent storage */
+ uint8_t element_idx; /*!< Belongs to Nth element */
+ uint8_t model_idx; /*!< Is the Nth model in the element */
+ uint16_t flags; /*!< Information about what has changed */
+
+ /** The Element to which this Model belongs */
+ esp_ble_mesh_elem_t *element;
+
+ /** Model Publication */
+ esp_ble_mesh_model_pub_t *const pub;
+
+ /** AppKey List */
+ uint16_t keys[CONFIG_BLE_MESH_MODEL_KEY_COUNT];
+
+ /** Subscription List (group or virtual addresses) */
+ uint16_t groups[CONFIG_BLE_MESH_MODEL_GROUP_COUNT];
+
+ /** Model operation context */
+ esp_ble_mesh_model_op_t *op;
+
+ /** Model callback structure */
+ esp_ble_mesh_model_cbs_t *cb;
+
+ /** Model-specific user data */
+ void *user_data;
+};
+
+/** Helper to define an empty model array.
+ * This structure is associated with BLE_MESH_MODEL_NONE in mesh_access.h
+ */
+#define ESP_BLE_MESH_MODEL_NONE ((esp_ble_mesh_model_t []){})
+
+/** Message sending context.
+ * This structure is associated with struct bt_mesh_msg_ctx in mesh_access.h
+ */
+typedef struct {
+ /** NetKey Index of the subnet through which to send the message. */
+ uint16_t net_idx;
+
+ /** AppKey Index for message encryption. */
+ uint16_t app_idx;
+
+ /** Remote address. */
+ uint16_t addr;
+
+ /** Destination address of a received message. Not used for sending. */
+ uint16_t recv_dst;
+
+ /** RSSI of a received message. Not used for sending. */
+ int8_t recv_rssi;
+
+ /** Opcode of a received message. Not used for sending. */
+ uint32_t recv_op;
+
+ /** Received TTL value. Not used for sending. */
+ uint8_t recv_ttl;
+
+ /** Security credentials of a received message. Not used for sending. */
+ uint8_t recv_cred;
+
+ /** Tag of a received message. Not used for sending. */
+ uint8_t recv_tag;
+
+ /** Force sending reliably by using segment acknowledgement. */
+ uint8_t send_rel:1 __attribute__((deprecated));
+
+ /** Size of TransMIC when sending a Segmented Access message. */
+ uint8_t send_szmic:1;
+
+ /** TTL, or ESP_BLE_MESH_TTL_DEFAULT for default TTL. */
+ uint8_t send_ttl;
+
+ /** Security credentials used for sending the message */
+ uint8_t send_cred;
+
+ /** Tag used for sending the message. */
+ uint8_t send_tag;
+
+ /** Model corresponding to the message, no need to be initialized before sending message */
+ esp_ble_mesh_model_t *model __attribute__((deprecated));
+
+ /** Indicate if the message is sent by a node server model, no need to be initialized before sending message */
+ bool srv_send __attribute__((deprecated));
+} esp_ble_mesh_msg_ctx_t;
+
+/** Provisioning properties & capabilities.
+ * This structure is associated with struct bt_mesh_prov in mesh_access.h
+ */
+typedef struct {
+#if CONFIG_BLE_MESH_NODE
+ /** The UUID that is used when advertising as an unprovisioned device */
+ const uint8_t *uuid;
+
+ /** Optional URI. This will be advertised separately from the
+ * unprovisioned beacon, however the unprovisioned beacon will
+ * contain a hash of it so the two can be associated by the
+ * provisioner.
+ */
+ const char *uri;
+
+ /** Out of Band information field. */
+ esp_ble_mesh_prov_oob_info_t oob_info;
+
+ /* NOTE: In order to avoid suffering brute-forcing attack (CVE-2020-26559).
+ * The Bluetooth SIG recommends that potentially vulnerable mesh provisioners
+ * support an out-of-band mechanism to exchange the public keys.
+ * So as an unprovisioned device, it should enable this flag to support
+ * using an out-of-band mechanism to exchange Public Key.
+ */
+ /** Flag indicates whether unprovisioned devices support OOB public key */
+ bool oob_pub_key;
+
+ /** Callback used to notify to set OOB Public Key. Initialized by the stack. */
+ esp_ble_mesh_cb_t oob_pub_key_cb;
+
+ /** OOB type */
+ uint8_t oob_type;
+
+ /** Static OOB value */
+ const uint8_t *static_val;
+ /** Static OOB value length */
+ uint8_t static_val_len;
+
+ /** Maximum size of Output OOB supported */
+ uint8_t output_size;
+ /** Supported Output OOB Actions */
+ uint16_t output_actions;
+
+ /** Maximum size of Input OOB supported */
+ uint8_t input_size;
+ /** Supported Input OOB Actions */
+ uint16_t input_actions;
+
+ /** Callback used to output the number. Initialized by the stack. */
+ esp_ble_mesh_cb_t output_num_cb;
+ /** Callback used to output the string. Initialized by the stack. */
+ esp_ble_mesh_cb_t output_str_cb;
+ /** Callback used to notify to input number/string. Initialized by the stack. */
+ esp_ble_mesh_cb_t input_cb;
+ /** Callback used to indicate that link is opened. Initialized by the stack. */
+ esp_ble_mesh_cb_t link_open_cb;
+ /** Callback used to indicate that link is closed. Initialized by the stack. */
+ esp_ble_mesh_cb_t link_close_cb;
+ /** Callback used to indicate that provisioning is completed. Initialized by the stack. */
+ esp_ble_mesh_cb_t complete_cb;
+ /** Callback used to indicate that node has been reset. Initialized by the stack. */
+ esp_ble_mesh_cb_t reset_cb;
+#endif /* CONFIG_BLE_MESH_NODE */
+
+#ifdef CONFIG_BLE_MESH_PROVISIONER
+ /** Provisioner device UUID */
+ const uint8_t *prov_uuid;
+
+ /** Primary element address of the provisioner */
+ const uint16_t prov_unicast_addr;
+
+ /** Pre-incremental unicast address value to be assigned to the first device */
+ uint16_t prov_start_address;
+
+ /** Attention timer contained in Provisioning Invite PDU */
+ uint8_t prov_attention;
+
+ /** Provisioning Algorithm for the Provisioner */
+ uint8_t prov_algorithm;
+
+ /* NOTE: In order to avoid suffering brute-forcing attack (CVE-2020-26559).
+ * The Bluetooth SIG recommends that potentially vulnerable mesh provisioners
+ * use an out-of-band mechanism to exchange the public keys.
+ */
+ /** Provisioner public key oob */
+ uint8_t prov_pub_key_oob;
+
+ /** Callback used to notify to set device OOB Public Key. Initialized by the stack. */
+ esp_ble_mesh_cb_t provisioner_prov_read_oob_pub_key;
+
+ /* NOTE: The Bluetooth SIG recommends that mesh implementations enforce a randomly
+ * selected AuthValue using all of the available bits, where permitted by the
+ * implementation. A large entropy helps ensure that a brute-force of the AuthValue,
+ * even a static AuthValue, cannot normally be completed in a reasonable time (CVE-2020-26557).
+ *
+ * AuthValues selected using a cryptographically secure random or pseudorandom number
+ * generator and having the maximum permitted entropy (128-bits) will be most difficult
+ * to brute-force. AuthValues with reduced entropy or generated in a predictable manner
+ * will not grant the same level of protection against this vulnerability. Selecting a
+ * new AuthValue with each provisioning attempt can also make it more difficult to launch
+ * a brute-force attack by requiring the attacker to restart the search with each
+ * provisioning attempt (CVE-2020-26556).
+ */
+ /** Provisioner static oob value */
+ uint8_t *prov_static_oob_val;
+ /** Provisioner static oob value length */
+ uint8_t prov_static_oob_len;
+
+ /** Callback used to notify to input number/string. Initialized by the stack. */
+ esp_ble_mesh_cb_t provisioner_prov_input;
+ /** Callback used to output number/string. Initialized by the stack. */
+ esp_ble_mesh_cb_t provisioner_prov_output;
+
+ /** Key refresh and IV update flag */
+ uint8_t flags;
+
+ /** IV index */
+ uint32_t iv_index;
+
+ /** Callback used to indicate that link is opened. Initialized by the stack. */
+ esp_ble_mesh_cb_t provisioner_link_open;
+ /** Callback used to indicate that link is closed. Initialized by the stack. */
+ esp_ble_mesh_cb_t provisioner_link_close;
+ /** Callback used to indicate that a device is provisioned. Initialized by the stack. */
+ esp_ble_mesh_cb_t provisioner_prov_comp;
+ /** Callback used to indicate that certificate based provisioning needs to start. Initialized by the stack. */
+ esp_ble_mesh_cb_t cert_based_prov_start;
+ /** Callback used to indicate that provisioner has received provisioning records list successfully. Initialized by the stack. */
+ esp_ble_mesh_cb_t records_list_get;
+ /** Callback used to indicate that provisioner has received a complete provisioning record successfully. Initialized by the stack. */
+ esp_ble_mesh_cb_t prov_record_recv_comp;
+#endif /* CONFIG_BLE_MESH_PROVISIONER */
+} esp_ble_mesh_prov_t;
+
+/** Node Composition data context.
+ * This structure is associated with struct bt_mesh_comp in mesh_access.h
+ */
+typedef struct {
+ uint16_t cid; /*!< 16-bit SIG-assigned company identifier */
+ uint16_t pid; /*!< 16-bit vendor-assigned product identifier */
+ uint16_t vid; /*!< 16-bit vendor-assigned product version identifier */
+
+ size_t element_count; /*!< Element count */
+ esp_ble_mesh_elem_t *elements; /*!< A sequence of elements */
+} esp_ble_mesh_comp_t;
+
+/*!< This enum value is the role of the device */
+typedef enum {
+ ROLE_NODE = 0,
+ ROLE_PROVISIONER,
+ ROLE_FAST_PROV,
+} esp_ble_mesh_dev_role_t;
+
+/*!< Flag which will be set when device is going to be added. */
+typedef uint8_t esp_ble_mesh_dev_add_flag_t;
+#define ADD_DEV_RM_AFTER_PROV_FLAG BIT(0) /*!< Device will be removed from queue after provisioned successfully */
+#define ADD_DEV_START_PROV_NOW_FLAG BIT(1) /*!< Start provisioning device immediately */
+#define ADD_DEV_FLUSHABLE_DEV_FLAG BIT(2) /*!< Device can be remove when queue is full and new device is going to added */
+
+/** Information of the device which is going to be added for provisioning. */
+typedef struct {
+ esp_ble_mesh_bd_addr_t addr; /*!< Device address */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
+ uint8_t uuid[16]; /*!< Device UUID */
+ uint16_t oob_info; /*!< Device OOB Info */
+ /*!< ADD_DEV_START_PROV_NOW_FLAG shall not be set if the bearer has both PB-ADV and PB-GATT enabled */
+ esp_ble_mesh_prov_bearer_t bearer; /*!< Provisioning Bearer */
+} esp_ble_mesh_unprov_dev_add_t;
+
+#define DEL_DEV_ADDR_FLAG BIT(0)
+#define DEL_DEV_UUID_FLAG BIT(1)
+/** Information of the device which is going to be deleted. */
+typedef struct {
+ /** Union of Device information */
+ union {
+ /** Device address */
+ struct {
+ esp_ble_mesh_bd_addr_t addr; /*!< Device address */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
+ };
+ uint8_t uuid[16]; /*!< Device UUID */
+ };
+ uint8_t flag; /*!< BIT0: device address; BIT1: device UUID */
+} esp_ble_mesh_device_delete_t;
+
+#define PROV_DATA_NET_IDX_FLAG BIT(0)
+#define PROV_DATA_FLAGS_FLAG BIT(1)
+#define PROV_DATA_IV_INDEX_FLAG BIT(2)
+/** Information of the provisioner which is going to be updated. */
+typedef struct {
+ /** Provisioning data */
+ union {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint8_t flags; /*!< Flags */
+ uint32_t iv_index; /*!< IV Index */
+ };
+ uint8_t flag; /*!< BIT0: net_idx; BIT1: flags; BIT2: iv_index */
+} esp_ble_mesh_prov_data_info_t;
+
+/** Information of the provisioned node */
+typedef struct {
+ /* Device information */
+ esp_ble_mesh_bd_addr_t addr; /*!< Node device address */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Node device address type */
+ uint8_t dev_uuid[16]; /*!< Device UUID */
+ uint16_t oob_info; /*!< Node OOB information */
+
+ /* Provisioning information */
+ uint16_t unicast_addr; /*!< Node unicast address */
+ uint8_t element_num; /*!< Node element number */
+ uint16_t net_idx; /*!< Node NetKey Index */
+ uint8_t flags; /*!< Node key refresh flag and iv update flag */
+ uint32_t iv_index; /*!< Node IV Index */
+ uint8_t dev_key[16]; /*!< Node device key */
+
+ /* Additional information */
+ char name[ESP_BLE_MESH_NODE_NAME_MAX_LEN + 1]; /*!< Node name */
+ uint16_t comp_length; /*!< Length of Composition Data */
+ uint8_t *comp_data; /*!< Value of Composition Data */
+} __attribute__((packed)) esp_ble_mesh_node_t;
+
+/** Context of fast provisioning which need to be set. */
+typedef struct {
+ uint16_t unicast_min; /*!< Minimum unicast address used for fast provisioning */
+ uint16_t unicast_max; /*!< Maximum unicast address used for fast provisioning */
+ uint16_t net_idx; /*!< Netkey index used for fast provisioning */
+ uint8_t flags; /*!< Flags used for fast provisioning */
+ uint32_t iv_index; /*!< IV Index used for fast provisioning */
+ uint8_t offset; /*!< Offset of the UUID to be compared */
+ uint8_t match_len; /*!< Length of the UUID to be compared */
+ uint8_t match_val[16]; /*!< Value of UUID to be compared */
+} esp_ble_mesh_fast_prov_info_t;
+
+/*!< This enum value is the action of fast provisioning */
+typedef enum {
+ FAST_PROV_ACT_NONE,
+ FAST_PROV_ACT_ENTER,
+ FAST_PROV_ACT_SUSPEND,
+ FAST_PROV_ACT_EXIT,
+ FAST_PROV_ACT_MAX,
+} esp_ble_mesh_fast_prov_action_t;
+
+/*!< This enum value is the type of proxy filter */
+typedef enum {
+ PROXY_FILTER_WHITELIST,
+ PROXY_FILTER_BLACKLIST,
+} esp_ble_mesh_proxy_filter_type_t;
+
+/*!< Provisioner heartbeat filter type */
+#define ESP_BLE_MESH_HEARTBEAT_FILTER_ACCEPTLIST 0x00
+#define ESP_BLE_MESH_HEARTBEAT_FILTER_REJECTLIST 0x01
+
+/*!< Provisioner heartbeat filter operation */
+#define ESP_BLE_MESH_HEARTBEAT_FILTER_ADD 0x00
+#define ESP_BLE_MESH_HEARTBEAT_FILTER_REMOVE 0x01
+
+/** Context of Provisioner heartbeat filter information to be set */
+typedef struct {
+ uint16_t hb_src; /*!< Heartbeat source address (unicast address) */
+ uint16_t hb_dst; /*!< Heartbeat destination address (unicast address or group address) */
+} esp_ble_mesh_heartbeat_filter_info_t;
+
+/*!< This enum value is the event of node/provisioner/fast provisioning */
+typedef enum {
+ ESP_BLE_MESH_PROV_REGISTER_COMP_EVT, /*!< Initialize BLE Mesh provisioning capabilities and internal data information completion event */
+ ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT, /*!< Set the unprovisioned device name completion event */
+ ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT, /*!< Enable node provisioning functionality completion event */
+ ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT, /*!< Disable node provisioning functionality completion event */
+ ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT, /*!< Establish a BLE Mesh link event */
+ ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT, /*!< Close a BLE Mesh link event */
+ ESP_BLE_MESH_NODE_PROV_OOB_PUB_KEY_EVT, /*!< Generate Node input OOB public key event */
+ ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT, /*!< Generate Node Output Number event */
+ ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT, /*!< Generate Node Output String event */
+ ESP_BLE_MESH_NODE_PROV_INPUT_EVT, /*!< Event requiring the user to input a number or string */
+ ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT, /*!< Provisioning done event */
+ ESP_BLE_MESH_NODE_PROV_RESET_EVT, /*!< Provisioning reset event */
+ ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT, /*!< Node set oob public key completion event */
+ ESP_BLE_MESH_NODE_PROV_INPUT_NUMBER_COMP_EVT, /*!< Node input number completion event */
+ ESP_BLE_MESH_NODE_PROV_INPUT_STRING_COMP_EVT, /*!< Node input string completion event */
+ ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT, /*!< Enable BLE Mesh Proxy Identity advertising completion event */
+ ESP_BLE_MESH_NODE_PRIVATE_PROXY_IDENTITY_ENABLE_COMP_EVT, /*!< Enable BLE Mesh Private Proxy Identity advertising completion event */
+ ESP_BLE_MESH_NODE_PRIVATE_PROXY_IDENTITY_DISABLE_COMP_EVT, /*!< Disable BLE Mesh Private Proxy Identity advertising completion event */
+ ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT, /*!< Enable BLE Mesh GATT Proxy Service completion event */
+ ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT, /*!< Disable BLE Mesh GATT Proxy Service completion event */
+ ESP_BLE_MESH_NODE_ADD_LOCAL_NET_KEY_COMP_EVT, /*!< Node add NetKey locally completion event */
+ ESP_BLE_MESH_NODE_ADD_LOCAL_APP_KEY_COMP_EVT, /*!< Node add AppKey locally completion event */
+ ESP_BLE_MESH_NODE_BIND_APP_KEY_TO_MODEL_COMP_EVT, /*!< Node bind AppKey to model locally completion event */
+ ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT, /*!< Provisioner enable provisioning functionality completion event */
+ ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT, /*!< Provisioner disable provisioning functionality completion event */
+ ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT, /*!< Provisioner receives unprovisioned device beacon event */
+ ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT, /*!< Provisioner read unprovisioned device OOB public key event */
+ ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT, /*!< Provisioner input value for provisioning procedure event */
+ ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT, /*!< Provisioner output value for provisioning procedure event */
+ ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT, /*!< Provisioner establish a BLE Mesh link event */
+ ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT, /*!< Provisioner close a BLE Mesh link event */
+ ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT, /*!< Provisioner provisioning done event */
+ ESP_BLE_MESH_PROVISIONER_CERT_BASED_PROV_START_EVT, /*!< Provisioner initiate a certificate based provisioning */
+ ESP_BLE_MESH_PROVISIONER_RECV_PROV_RECORDS_LIST_EVT, /*!< Provisioner receive provisioning records list event */
+ ESP_BLE_MESH_PROVISIONER_PROV_RECORD_RECV_COMP_EVT, /*!< Provisioner receive provisioning record complete event */
+ ESP_BLE_MESH_PROVISIONER_SEND_PROV_RECORDS_GET_EVT, /*!< Provisioner send provisioning records get to device event */
+ ESP_BLE_MESH_PROVISIONER_SEND_PROV_RECORD_REQUEST_EVT, /*!< Provisioner send provisioning record request to device event */
+ ESP_BLE_MESH_PROVISIONER_SEND_PROV_INVITE_EVT, /*!< Provisioner send provisioning invite to device event */
+ ESP_BLE_MESH_PROVISIONER_SEND_LINK_CLOSE_EVT, /*!< Provisioner send link close to device event */
+ 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 */
+ ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT, /*!< Provisioner start to provision an unprovisioned device completion event */
+ ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT, /*!< Provisioner delete a device from the list, close provisioning link with the device completion event */
+ 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 */
+ ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT, /*!< Provisioner set net_idx/flags/iv_index used for provisioning completion event */
+ ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT, /*!< Provisioner set static oob value used for provisioning completion event */
+ ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT, /*!< Provisioner set unicast address of primary element completion event */
+ ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT, /*!< Provisioner read unprovisioned device OOB public key completion event */
+ ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT, /*!< Provisioner input number completion event */
+ ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT, /*!< Provisioner input string completion event */
+ ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT, /*!< Provisioner set node name completion event */
+ ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT, /*!< Provisioner add local app key completion event */
+ ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT, /*!< Provisioner update local app key completion event */
+ ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT, /*!< Provisioner bind local model with local app key completion event */
+ ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT, /*!< Provisioner add local network key completion event */
+ ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT, /*!< Provisioner update local network key completion event */
+ ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT, /*!< Provisioner store node composition data completion event */
+ ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT, /*!< Provisioner delete node with uuid completion event */
+ ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT, /*!< Provisioner delete node with unicast address completion event */
+ ESP_BLE_MESH_PROVISIONER_ENABLE_HEARTBEAT_RECV_COMP_EVT, /*!< Provisioner start to receive heartbeat message completion event */
+ ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE_COMP_EVT, /*!< Provisioner set the heartbeat filter type completion event */
+ ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_INFO_COMP_EVT, /*!< Provisioner set the heartbeat filter information completion event */
+ ESP_BLE_MESH_PROVISIONER_RECV_HEARTBEAT_MESSAGE_EVT, /*!< Provisioner receive heartbeat message event */
+ ESP_BLE_MESH_PROVISIONER_DIRECT_ERASE_SETTINGS_COMP_EVT, /*!< Provisioner directly erase settings completion event */
+ ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_INDEX_COMP_EVT, /*!< Provisioner open settings with index completion event */
+ ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_UID_COMP_EVT, /*!< Provisioner open settings with user id completion event */
+ ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_INDEX_COMP_EVT, /*!< Provisioner close settings with index completion event */
+ ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_UID_COMP_EVT, /*!< Provisioner close settings with user id completion event */
+ ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_INDEX_COMP_EVT, /*!< Provisioner delete settings with index completion event */
+ ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_UID_COMP_EVT, /*!< Provisioner delete settings with user id completion event */
+ ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT, /*!< Set fast provisioning information (e.g. unicast address range, net_idx, etc.) completion event */
+ ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT, /*!< Set fast provisioning action completion event */
+ ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT, /*!< Receive Heartbeat message event */
+ ESP_BLE_MESH_LPN_ENABLE_COMP_EVT, /*!< Enable Low Power Node completion event */
+ ESP_BLE_MESH_LPN_DISABLE_COMP_EVT, /*!< Disable Low Power Node completion event */
+ ESP_BLE_MESH_LPN_POLL_COMP_EVT, /*!< Low Power Node send Friend Poll completion event */
+ ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT, /*!< Low Power Node establishes friendship event */
+ ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT, /*!< Low Power Node terminates friendship event */
+ ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT, /*!< Friend Node establishes friendship event */
+ ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT, /*!< Friend Node terminates friendship event */
+ ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT, /*!< Proxy Client receives Network ID advertising packet event */
+ ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT, /*!< Proxy Client establishes connection successfully event */
+ ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT, /*!< Proxy Client terminates connection successfully event */
+ ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT, /*!< Proxy Client receives Proxy Filter Status event */
+ ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT, /*!< Proxy Client connect completion event */
+ ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT, /*!< Proxy Client disconnect completion event */
+ ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT, /*!< Proxy Client set filter type completion event */
+ ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT, /*!< Proxy Client add filter address completion event */
+ ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT, /*!< Proxy Client remove filter address completion event */
+ ESP_BLE_MESH_PROXY_CLIENT_DIRECTED_PROXY_SET_COMP_EVT, /*!< Proxy Client directed proxy set completion event */
+ ESP_BLE_MESH_PROXY_SERVER_CONNECTED_EVT, /*!< Proxy Server establishes connection successfully event */
+ ESP_BLE_MESH_PROXY_SERVER_DISCONNECTED_EVT, /*!< Proxy Server terminates connection successfully event */
+ ESP_BLE_MESH_PROXY_CLIENT_SEND_SOLIC_PDU_COMP_EVT, /*!< Proxy Client send Solicitation PDU completion event */
+ ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model subscribes group address completion event */
+ ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT, /*!< Local model unsubscribes group address completion event */
+ ESP_BLE_MESH_DEINIT_MESH_COMP_EVT, /*!< De-initialize BLE Mesh stack completion event */
+ ESP_BLE_MESH_PROV_EVT_MAX,
+} esp_ble_mesh_prov_cb_event_t;
+
+/**
+ * @brief BLE Mesh Node/Provisioner callback parameters union
+ */
+typedef union {
+ /**
+ * @brief ESP_BLE_MESH_PROV_REGISTER_COMP_EVT
+ */
+ struct ble_mesh_prov_register_comp_param {
+ int err_code; /*!< Indicate the result of BLE Mesh initialization */
+ } prov_register_comp; /*!< Event parameter of ESP_BLE_MESH_PROV_REGISTER_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT
+ */
+ struct ble_mesh_set_unprov_dev_name_comp_param {
+ int err_code; /*!< Indicate the result of setting BLE Mesh device name */
+ } node_set_unprov_dev_name_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_SET_UNPROV_DEV_NAME_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT
+ */
+ struct ble_mesh_prov_enable_comp_param {
+ int err_code; /*!< Indicate the result of enabling BLE Mesh device */
+ } node_prov_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_ENABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT
+ */
+ struct ble_mesh_prov_disable_comp_param {
+ int err_code; /*!< Indicate the result of disabling BLE Mesh device */
+ } node_prov_disable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_DISABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT
+ */
+ struct ble_mesh_link_open_evt_param {
+ esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when device link is open */
+ } node_prov_link_open; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_LINK_OPEN_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT
+ */
+ struct ble_mesh_link_close_evt_param {
+ esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when device link is closed */
+ uint8_t reason; /*!< Reason of the closed provisioning link */
+ } node_prov_link_close; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_LINK_CLOSE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT
+ */
+ struct ble_mesh_output_num_evt_param {
+ esp_ble_mesh_output_action_t action; /*!< Action of Output OOB Authentication */
+ uint32_t number; /*!< Number of Output OOB Authentication */
+ } node_prov_output_num; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_OUTPUT_NUMBER_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT
+ */
+ struct ble_mesh_output_str_evt_param {
+ char string[8]; /*!< String of Output OOB Authentication */
+ } node_prov_output_str; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_OUTPUT_STRING_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_INPUT_EVT
+ */
+ struct ble_mesh_input_evt_param {
+ esp_ble_mesh_input_action_t action; /*!< Action of Input OOB Authentication */
+ uint8_t size; /*!< Size of Input OOB Authentication */
+ } node_prov_input; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT
+ */
+ struct ble_mesh_provision_complete_evt_param {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint8_t net_key[16]; /*!< NetKey */
+ uint16_t addr; /*!< Primary address */
+ uint8_t flags; /*!< Flags */
+ uint32_t iv_index; /*!< IV Index */
+ } node_prov_complete; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_COMPLETE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_RESET_EVT
+ */
+ struct ble_mesh_provision_reset_param {
+
+ } node_prov_reset; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_RESET_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT
+ */
+ struct ble_mesh_set_oob_pub_key_comp_param {
+ int err_code; /*!< Indicate the result of setting OOB Public Key */
+ } node_prov_set_oob_pub_key_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_SET_OOB_PUB_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_INPUT_NUM_COMP_EVT
+ */
+ struct ble_mesh_input_number_comp_param {
+ int err_code; /*!< Indicate the result of inputting number */
+ } node_prov_input_num_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_NUM_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROV_INPUT_STR_COMP_EVT
+ */
+ struct ble_mesh_input_string_comp_param {
+ int err_code; /*!< Indicate the result of inputting string */
+ } node_prov_input_str_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROV_INPUT_STR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT
+ */
+ struct ble_mesh_proxy_identity_enable_comp_param {
+ int err_code; /*!< Indicate the result of enabling Mesh Proxy advertising */
+ } node_proxy_identity_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_IDENTITY_ENABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT
+ */
+ struct ble_mesh_proxy_gatt_enable_comp_param {
+ int err_code; /*!< Indicate the result of enabling Mesh Proxy Service */
+ } node_proxy_gatt_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT
+ */
+ struct ble_mesh_proxy_gatt_disable_comp_param {
+ int err_code; /*!< Indicate the result of disabling Mesh Proxy Service */
+ } node_proxy_gatt_disable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PRIVATE_PROXY_IDENTITY_ENABLE_COMP_EVT
+ */
+ struct ble_mesh_proxy_private_identity_enable_comp_param {
+ int err_code; /*!< Indicate the result of enabling Mesh Proxy private advertising */
+ } node_private_proxy_identity_enable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PRIVATE_PROXY_IDENTITY_ENABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_PRIVATE_PROXY_IDENTITY_DISABLE_COMP_EVT
+ */
+ struct ble_mesh_proxy_private_identity_disable_comp_param {
+ int err_code; /*!< Indicate the result of disabling Mesh Proxy private advertising */
+ } node_private_proxy_identity_disable_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_PRIVATE_PROXY_IDENTITY_DISABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_ADD_LOCAL_NET_KEY_COMP_EVT
+ */
+ struct ble_mesh_node_add_local_net_key_comp_param {
+ int err_code; /*!< Indicate the result of adding local NetKey by the node */
+ uint16_t net_idx; /*!< NetKey Index */
+ } node_add_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_ADD_LOCAL_NET_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_ADD_LOCAL_APP_KEY_COMP_EVT
+ */
+ struct ble_mesh_node_add_local_app_key_comp_param {
+ int err_code; /*!< Indicate the result of adding local AppKey by the node */
+ uint16_t net_idx; /*!< NetKey Index */
+ uint16_t app_idx; /*!< AppKey Index */
+ } node_add_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_ADD_LOCAL_APP_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_NODE_BIND_APP_KEY_TO_MODEL_COMP_EVT
+ */
+ struct ble_mesh_node_bind_local_mod_app_comp_param {
+ int err_code; /*!< Indicate the result of binding AppKey with model by the node */
+ uint16_t element_addr; /*!< Element address */
+ uint16_t app_idx; /*!< AppKey Index */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+ } node_bind_app_key_to_model_comp; /*!< Event parameter of ESP_BLE_MESH_NODE_BIND_APP_KEY_TO_MODEL_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT
+ */
+ struct ble_mesh_provisioner_recv_unprov_adv_pkt_param {
+ uint8_t dev_uuid[16]; /*!< Device UUID of the unprovisioned device */
+ esp_ble_mesh_bd_addr_t addr; /*!< Device address of the unprovisioned device */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
+ uint16_t oob_info; /*!< OOB Info of the unprovisioned device */
+ uint8_t adv_type; /*!< Advertising type of the unprovisioned device */
+ esp_ble_mesh_prov_bearer_t bearer; /*!< Bearer of the unprovisioned device */
+ int8_t rssi; /*!< RSSI of the received advertising packet */
+ } provisioner_recv_unprov_adv_pkt; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_RECV_UNPROV_ADV_PKT_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT
+ */
+ struct ble_mesh_provisioner_prov_enable_comp_param {
+ int err_code; /*!< Indicate the result of enabling BLE Mesh Provisioner */
+ } provisioner_prov_enable_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_ENABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT
+ */
+ struct ble_mesh_provisioner_prov_disable_comp_param {
+ int err_code; /*!< Indicate the result of disabling BLE Mesh Provisioner */
+ } provisioner_prov_disable_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DISABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT
+ */
+ struct ble_mesh_provisioner_link_open_evt_param {
+ esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when Provisioner link is opened */
+ } provisioner_prov_link_open; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_LINK_OPEN_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT
+ */
+ struct ble_mesh_provisioner_prov_read_oob_pub_key_evt_param {
+ uint8_t link_idx; /*!< Index of the provisioning link */
+ } provisioner_prov_read_oob_pub_key; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT
+ */
+ struct ble_mesh_provisioner_prov_input_evt_param {
+ esp_ble_mesh_oob_method_t method; /*!< Method of device Output OOB Authentication */
+ esp_ble_mesh_output_action_t action; /*!< Action of device Output OOB Authentication */
+ uint8_t size; /*!< Size of device Output OOB Authentication */
+ uint8_t link_idx; /*!< Index of the provisioning link */
+ } provisioner_prov_input; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT
+ */
+ struct ble_mesh_provisioner_prov_output_evt_param {
+ esp_ble_mesh_oob_method_t method; /*!< Method of device Input OOB Authentication */
+ esp_ble_mesh_input_action_t action; /*!< Action of device Input OOB Authentication */
+ uint8_t size; /*!< Size of device Input OOB Authentication */
+ uint8_t link_idx; /*!< Index of the provisioning link */
+ /** Union of output OOB */
+ union {
+ char string[8]; /*!< String output by the Provisioner */
+ uint32_t number; /*!< Number output by the Provisioner */
+ };
+ } provisioner_prov_output; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_OUTPUT_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT
+ */
+ struct ble_mesh_provisioner_link_close_evt_param {
+ esp_ble_mesh_prov_bearer_t bearer; /*!< Type of the bearer used when Provisioner link is closed */
+ uint8_t reason; /*!< Reason of the closed provisioning link */
+ } provisioner_prov_link_close; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_LINK_CLOSE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT
+ */
+ struct ble_mesh_provisioner_prov_comp_param {
+ uint16_t node_idx; /*!< Index of the provisioned device */
+ esp_ble_mesh_octet16_t device_uuid; /*!< Device UUID of the provisioned device */
+ uint16_t unicast_addr; /*!< Primary address of the provisioned device */
+ uint8_t element_num; /*!< Element count of the provisioned device */
+ uint16_t netkey_idx; /*!< NetKey Index of the provisioned device */
+ } provisioner_prov_complete; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_CERT_BASED_PROV_START_EVT
+ */
+ struct ble_mesh_provisioner_cert_based_prov_start_evt_param {
+ uint16_t link_idx; /*!< Index of the provisioning link */
+ } provisioner_cert_based_prov_start; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_CERT_BASED_PROV_START_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_RECV_PROV_RECORDS_LIST_EVT
+ */
+ struct ble_mesh_provisioner_recv_prov_records_list_evt_param {
+ uint16_t link_idx; /*!< Index of the provisioning link */
+ uint16_t len; /*!< Length of message */
+ uint8_t *msg; /*!< Lists the Record IDs of the provisioning records stored on the Provisionee */
+ } recv_provisioner_records_list; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_RECV_PROV_RECORDS_LIST_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_RECORD_RECV_COMP_EVT
+ */
+ struct ble_mesh_provisioner_prov_record_recv_comp_evt_param {
+ uint8_t status; /*!< Indicates whether or not the request was handled successfully */
+ uint16_t link_idx; /*!< Index of the provisioning link */
+ uint16_t record_id; /*!< Identifies the provisioning record for which the request is made */
+ uint16_t frag_offset; /*!< The starting offset of the requested fragment in the provisioning record data */
+ uint16_t total_len; /*!< Total length of the provisioning record data stored on the Provisionee */
+ uint8_t *record; /*!< Provisioning record data fragment */
+ } provisioner_prov_record_recv_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_RECORD_RECV_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SEND_PROV_RECORDS_GET_EVT
+ */
+ struct ble_mesh_provisioner_send_prov_records_get_evt_param {
+ int err_code; /*!< Indicate the result of send Provisioning Records List Get message */
+ uint16_t link_idx; /*!< Index of the provisioning link */
+ } provisioner_send_records_get; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SEND_PROV_RECORDS_GET_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SEND_PROV_RECORD_REQUEST_EVT
+ */
+ struct ble_mesh_provisioner_send_prov_record_req_evt_param {
+ int err_code; /*!< Indicate the result of send Provisioning Record Request message */
+ uint16_t link_idx; /*!< Index of the provisioning link */
+ uint16_t record_id; /*!< Identifies the provisioning record for which the request is made */
+ uint16_t frag_offset; /*!< The starting offset of the requested fragment in the provisioning record data */
+ uint16_t max_size; /*!< The maximum size of the provisioning record fragment that the Provisioner can receive */
+ } provisioner_send_record_req; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SEND_PROV_RECORD_REQUEST_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SEND_PROV_INVITE_EVT
+ */
+ struct ble_mesh_provisioner_send_prov_invite_evt_param {
+ uint16_t link_idx; /*!< Index of the provisioning link */
+ int err_code; /*!< Indicate the result of send Provisioning Invite message */
+ } provisioner_send_prov_invite; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SEND_PROV_INVITE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SEND_LINK_CLOSE_EVT
+ */
+ struct ble_mesh_provisioner_send_link_close_evt_param {
+ uint16_t link_idx; /*!< Index of the provisioning link */
+ int err_code; /*!< Indicate the result of send Link Close message */
+ } provisioner_send_link_close; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SEND_LINK_CLOSE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT
+ */
+ struct ble_mesh_provisioner_add_unprov_dev_comp_param {
+ int err_code; /*!< Indicate the result of adding device into queue by the Provisioner */
+ } provisioner_add_unprov_dev_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT
+ */
+ struct ble_mesh_provisioner_prov_dev_with_addr_comp_param {
+ int err_code; /*!< Indicate the result of Provisioner starting to provision a device */
+ } provisioner_prov_dev_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT
+ */
+ struct ble_mesh_provisioner_delete_dev_comp_param {
+ int err_code; /*!< Indicate the result of deleting device by the Provisioner */
+ } provisioner_delete_dev_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT
+ */
+ struct ble_mesh_provisioner_set_dev_uuid_match_comp_param {
+ int err_code; /*!< Indicate the result of setting Device UUID match value by the Provisioner */
+ } provisioner_set_dev_uuid_match_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT
+ */
+ struct ble_mesh_provisioner_set_prov_data_info_comp_param {
+ int err_code; /*!< Indicate the result of setting provisioning info by the Provisioner */
+ } provisioner_set_prov_data_info_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT
+ */
+ struct ble_mesh_provisioner_set_static_oob_val_comp_param {
+ int err_code; /*!< Indicate the result of setting static oob value by the Provisioner */
+ } provisioner_set_static_oob_val_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT
+ */
+ struct ble_mesh_provisioner_set_primary_elem_addr_comp_param {
+ int err_code; /*!< Indicate the result of setting unicast address of primary element by the Provisioner */
+ } provisioner_set_primary_elem_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_PRIMARY_ELEM_ADDR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT
+ */
+ struct ble_mesh_provisioner_prov_read_oob_pub_key_comp_param {
+ int err_code; /*!< Indicate the result of setting OOB Public Key by the Provisioner */
+ } provisioner_prov_read_oob_pub_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_READ_OOB_PUB_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT
+ */
+ struct ble_mesh_provisioner_prov_input_num_comp_param {
+ int err_code; /*!< Indicate the result of inputting number by the Provisioner */
+ } provisioner_prov_input_num_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_NUMBER_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT
+ */
+ struct ble_mesh_provisioner_prov_input_str_comp_param {
+ int err_code; /*!< Indicate the result of inputting string by the Provisioner */
+ } provisioner_prov_input_str_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_PROV_INPUT_STRING_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT
+ */
+ struct ble_mesh_provisioner_set_node_name_comp_param {
+ int err_code; /*!< Indicate the result of setting provisioned device name by the Provisioner */
+ uint16_t node_index; /*!< Index of the provisioned device */
+ } provisioner_set_node_name_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_SET_NODE_NAME_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT
+ */
+ struct ble_mesh_provisioner_add_local_app_key_comp_param {
+ int err_code; /*!< Indicate the result of adding local AppKey by the Provisioner */
+ uint16_t net_idx; /*!< NetKey Index */
+ uint16_t app_idx; /*!< AppKey Index */
+ } provisioner_add_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT
+ */
+ struct ble_mesh_provisioner_update_local_app_key_comp_param {
+ int err_code; /*!< Indicate the result of updating local AppKey by the Provisioner */
+ uint16_t net_idx; /*!< NetKey Index */
+ uint16_t app_idx; /*!< AppKey Index */
+ } provisioner_update_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_APP_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT
+ */
+ struct ble_mesh_provisioner_bind_local_mod_app_comp_param {
+ int err_code; /*!< Indicate the result of binding AppKey with model by the Provisioner */
+ uint16_t element_addr; /*!< Element address */
+ uint16_t app_idx; /*!< AppKey Index */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+ } provisioner_bind_app_key_to_model_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_BIND_APP_KEY_TO_MODEL_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT
+ */
+ struct ble_mesh_provisioner_add_local_net_key_comp_param {
+ int err_code; /*!< Indicate the result of adding local NetKey by the Provisioner */
+ uint16_t net_idx; /*!< NetKey Index */
+ } provisioner_add_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_NET_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT
+ */
+ struct ble_mesh_provisioner_update_local_net_key_comp_param {
+ int err_code; /*!< Indicate the result of updating local NetKey by the Provisioner */
+ uint16_t net_idx; /*!< NetKey Index */
+ } provisioner_update_net_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_UPDATE_LOCAL_NET_KEY_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT
+ */
+ struct ble_mesh_provisioner_store_node_comp_data_comp_param {
+ int err_code; /*!< Indicate the result of storing node composition data by the Provisioner */
+ uint16_t addr; /*!< Node element address */
+ } provisioner_store_node_comp_data_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_STORE_NODE_COMP_DATA_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT
+ */
+ struct ble_mesh_provisioner_delete_node_with_uuid_comp_param {
+ int err_code; /*!< Indicate the result of deleting node with uuid by the Provisioner */
+ uint8_t uuid[16]; /*!< Node device uuid */
+ } provisioner_delete_node_with_uuid_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT
+ */
+ struct ble_mesh_provisioner_delete_node_with_addr_comp_param {
+ int err_code; /*!< Indicate the result of deleting node with unicast address by the Provisioner */
+ uint16_t unicast_addr; /*!< Node unicast address */
+ } provisioner_delete_node_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_ENABLE_HEARTBEAT_RECV_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of enabling/disabling to receive heartbeat messages by the Provisioner */
+ bool enable; /*!< Indicate enabling or disabling receiving heartbeat messages */
+ } provisioner_enable_heartbeat_recv_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_ENABLE_HEARTBEAT_RECV_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of setting the heartbeat filter type by the Provisioner */
+ uint8_t type; /*!< Type of the filter used for receiving heartbeat messages */
+ } provisioner_set_heartbeat_filter_type_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_TYPE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_INFO_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of setting the heartbeat filter address by the Provisioner */
+ uint8_t op; /*!< Operation (add, remove, clean) */
+ uint16_t hb_src; /*!< Heartbeat source address */
+ uint16_t hb_dst; /*!< Heartbeat destination address */
+ } provisioner_set_heartbeat_filter_info_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_SET_HEARTBEAT_FILTER_INFO_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_RECV_HEARTBEAT_MESSAGE_EVT
+ */
+ struct {
+ uint16_t hb_src; /*!< Heartbeat source address */
+ uint16_t hb_dst; /*!< Heartbeat destination address */
+ uint8_t init_ttl; /*!< Heartbeat InitTTL */
+ uint8_t rx_ttl; /*!< Heartbeat RxTTL */
+ uint8_t hops; /*!< Heartbeat hops (InitTTL - RxTTL + 1) */
+ uint16_t feature; /*!< Bit field of currently active features of the node */
+ int8_t rssi; /*!< RSSI of the heartbeat message */
+ } provisioner_recv_heartbeat; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_RECV_HEARTBEAT_MESSAGE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_DIRECT_ERASE_SETTINGS_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of directly erasing settings by the Provisioner */
+ } provisioner_direct_erase_settings_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_DIRECT_ERASE_SETTINGS_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_INDEX_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of opening settings with index by the Provisioner */
+ uint8_t index; /*!< Index of Provisioner settings */
+ } provisioner_open_settings_with_index_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_INDEX_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_UID_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of opening settings with user id by the Provisioner */
+ uint8_t index; /*!< Index of Provisioner settings */
+ char uid[ESP_BLE_MESH_SETTINGS_UID_SIZE + 1]; /*!< Provisioner settings user id */
+ } provisioner_open_settings_with_uid_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_OPEN_SETTINGS_WITH_UID_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_INDEX_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of closing settings with index by the Provisioner */
+ uint8_t index; /*!< Index of Provisioner settings */
+ } provisioner_close_settings_with_index_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_INDEX_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_UID_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of closing settings with user id by the Provisioner */
+ uint8_t index; /*!< Index of Provisioner settings */
+ char uid[ESP_BLE_MESH_SETTINGS_UID_SIZE + 1]; /*!< Provisioner settings user id */
+ } provisioner_close_settings_with_uid_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_CLOSE_SETTINGS_WITH_UID_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_INDEX_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of deleting settings with index by the Provisioner */
+ uint8_t index; /*!< Index of Provisioner settings */
+ } provisioner_delete_settings_with_index_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_INDEX_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_UID_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of deleting settings with user id by the Provisioner */
+ uint8_t index; /*!< Index of Provisioner settings */
+ char uid[ESP_BLE_MESH_SETTINGS_UID_SIZE + 1]; /*!< Provisioner settings user id */
+ } provisioner_delete_settings_with_uid_comp; /*!< Event parameters of ESP_BLE_MESH_PROVISIONER_DELETE_SETTINGS_WITH_UID_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT
+ */
+ struct ble_mesh_set_fast_prov_info_comp_param {
+ uint8_t status_unicast; /*!< Indicate the result of setting unicast address range of fast provisioning */
+ uint8_t status_net_idx; /*!< Indicate the result of setting NetKey Index of fast provisioning */
+ uint8_t status_match; /*!< Indicate the result of setting matching Device UUID of fast provisioning */
+ } set_fast_prov_info_comp; /*!< Event parameter of ESP_BLE_MESH_SET_FAST_PROV_INFO_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT
+ */
+ struct ble_mesh_set_fast_prov_action_comp_param {
+ uint8_t status_action; /*!< Indicate the result of setting action of fast provisioning */
+ } set_fast_prov_action_comp; /*!< Event parameter of ESP_BLE_MESH_SET_FAST_PROV_ACTION_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT
+ */
+ struct ble_mesh_heartbeat_msg_recv_param {
+ uint8_t hops; /*!< Heartbeat hops (InitTTL - RxTTL + 1) */
+ uint16_t feature; /*!< Bit field of currently active features of the node */
+ } heartbeat_msg_recv; /*!< Event parameter of ESP_BLE_MESH_HEARTBEAT_MESSAGE_RECV_EVT */
+ /**
+ * @brief ESP_BLE_MESH_LPN_ENABLE_COMP_EVT
+ */
+ struct ble_mesh_lpn_enable_comp_param {
+ int err_code; /*!< Indicate the result of enabling LPN functionality */
+ } lpn_enable_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_ENABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_LPN_DISABLE_COMP_EVT
+ */
+ struct ble_mesh_lpn_disable_comp_param {
+ int err_code; /*!< Indicate the result of disabling LPN functionality */
+ } lpn_disable_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_DISABLE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_LPN_POLL_COMP_EVT
+ */
+ struct ble_mesh_lpn_poll_comp_param {
+ int err_code; /*!< Indicate the result of sending Friend Poll */
+ } lpn_poll_comp; /*!< Event parameter of ESP_BLE_MESH_LPN_POLL_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT
+ */
+ struct ble_mesh_lpn_friendship_establish_param {
+ uint16_t friend_addr; /*!< Friend Node unicast address */
+ } lpn_friendship_establish; /*!< Event parameter of ESP_BLE_MESH_LPN_FRIENDSHIP_ESTABLISH_EVT */
+ /**
+ * @brief ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT
+ */
+ struct ble_mesh_lpn_friendship_terminate_param {
+ uint16_t friend_addr; /*!< Friend Node unicast address */
+ } lpn_friendship_terminate; /*!< Event parameter of ESP_BLE_MESH_LPN_FRIENDSHIP_TERMINATE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT
+ */
+ struct ble_mesh_friend_friendship_establish_param {
+ uint16_t lpn_addr; /*!< Low Power Node unicast address */
+ } frnd_friendship_establish; /*!< Event parameter of ESP_BLE_MESH_FRIEND_FRIENDSHIP_ESTABLISH_EVT */
+ /**
+ * @brief ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT
+ */
+ struct ble_mesh_friend_friendship_terminate_param {
+ uint16_t lpn_addr; /*!< Low Power Node unicast address */
+ /** This enum value is the reason of friendship termination on the friend node side */
+ enum {
+ 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 */
+ ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_POLL_TIMEOUT, /*!< Friendship is established, PollTimeout timer expires and no Friend Poll/Sub Add/Sub Remove is received */
+ ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_REQ, /*!< Receive Friend Request from existing Low Power Node */
+ ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_RECV_FRND_CLEAR, /*!< Receive Friend Clear from other friend node */
+ ESP_BLE_MESH_FRND_FRIENDSHIP_TERMINATE_DISABLE, /*!< Friend feature disabled or corresponding NetKey is deleted */
+ } reason; /*!< Friendship terminated reason */
+ } frnd_friendship_terminate; /*!< Event parameter of ESP_BLE_MESH_FRIEND_FRIENDSHIP_TERMINATE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT
+ */
+ struct ble_mesh_proxy_client_recv_adv_pkt_param {
+ esp_ble_mesh_bd_addr_t addr; /*!< Device address */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
+ uint16_t net_idx; /*!< Network ID related NetKey Index */
+ uint8_t net_id[8]; /*!< Network ID contained in the advertising packet */
+ int8_t rssi; /*!< RSSI of the received advertising packet */
+ } proxy_client_recv_adv_pkt; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_RECV_ADV_PKT_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT
+ */
+ struct ble_mesh_proxy_client_connected_param {
+ esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ } proxy_client_connected; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_CONNECTED_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT
+ */
+ struct ble_mesh_proxy_client_disconnected_param {
+ esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ uint8_t reason; /*!< Proxy disconnect reason */
+ } proxy_client_disconnected; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_DISCONNECTED_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT
+ */
+ struct ble_mesh_proxy_client_recv_filter_status_param {
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint16_t server_addr; /*!< Proxy Server primary element address */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ uint8_t filter_type; /*!< Proxy Server filter type(whitelist or blacklist) */
+ uint16_t list_size; /*!< Number of addresses in the Proxy Server filter list */
+ } proxy_client_recv_filter_status; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_RECV_FILTER_STATUS_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT
+ */
+ struct ble_mesh_proxy_client_connect_comp_param {
+ int err_code; /*!< Indicate the result of Proxy Client connect */
+ esp_ble_mesh_bd_addr_t addr; /*!< Device address of the Proxy Server */
+ esp_ble_mesh_addr_type_t addr_type; /*!< Device address type */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ } proxy_client_connect_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_CONNECT_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT
+ */
+ struct ble_mesh_proxy_client_disconnect_comp_param {
+ int err_code; /*!< Indicate the result of Proxy Client disconnect */
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ } proxy_client_disconnect_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_DISCONNECT_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT
+ */
+ struct ble_mesh_proxy_client_set_filter_type_comp_param {
+ int err_code; /*!< Indicate the result of Proxy Client set filter type */
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ } proxy_client_set_filter_type_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_SET_FILTER_TYPE_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT
+ */
+ struct ble_mesh_proxy_client_add_filter_addr_comp_param {
+ int err_code; /*!< Indicate the result of Proxy Client add filter address */
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ } proxy_client_add_filter_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_ADD_FILTER_ADDR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT
+ */
+ struct ble_mesh_proxy_client_remove_filter_addr_comp_param {
+ int err_code; /*!< Indicate the result of Proxy Client remove filter address */
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ } proxy_client_remove_filter_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_REMOVE_FILTER_ADDR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_DIRECTED_PROXY_CONTROL_COMP_EVT
+ */
+ struct ble_mesh_proxy_client_directed_proxy_set_param {
+ int err_code; /*!< Indicate the result of Proxy Client directed proxy control address */
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ } proxy_client_directed_proxy_set_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_DIRECTED_PROXY_SET_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_SERVER_CONNECTED_EVT
+ */
+ struct ble_mesh_proxy_server_connected_param {
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ } proxy_server_connected; /*!< Event parameter of ESP_BLE_MESH_PROXY_SERVER_CONNECTED_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_SERVER_DISCONNECTED_EVT
+ */
+ struct ble_mesh_proxy_server_disconnected_param {
+ uint8_t conn_handle; /*!< Proxy connection handle */
+ uint8_t reason; /*!< Proxy disconnect reason */
+ } proxy_server_disconnected; /*!< Event parameter of ESP_BLE_MESH_PROXY_SERVER_DISCONNECTED_EVT */
+ /**
+ * @brief ESP_BLE_MESH_PROXY_CLIENT_SEND_SOLIC_PDU_COMP_EVT
+ */
+ struct {
+ int err_code; /*!< Indicate the result of Proxy Client send Solicitation PDU */
+ uint16_t net_idx; /*!< Corresponding NetKey Index */
+ uint16_t ssrc; /*!< Solicitation SRC */
+ uint16_t dst; /*!< Solicitation DST */
+ } proxy_client_send_solic_pdu_comp; /*!< Event parameter of ESP_BLE_MESH_PROXY_CLIENT_SEND_SOLIC_PDU_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT
+ */
+ struct ble_mesh_model_sub_group_addr_comp_param {
+ int err_code; /*!< Indicate the result of local model subscribing group address */
+ uint16_t element_addr; /*!< Element address */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+ uint16_t group_addr; /*!< Group Address */
+ } model_sub_group_addr_comp; /*!< Event parameters of ESP_BLE_MESH_MODEL_SUBSCRIBE_GROUP_ADDR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT
+ */
+ struct ble_mesh_model_unsub_group_addr_comp_param {
+ int err_code; /*!< Indicate the result of local model unsubscribing group address */
+ uint16_t element_addr; /*!< Element address */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+ uint16_t group_addr; /*!< Group Address */
+ } model_unsub_group_addr_comp; /*!< Event parameters of ESP_BLE_MESH_MODEL_UNSUBSCRIBE_GROUP_ADDR_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_DEINIT_MESH_COMP_EVT
+ */
+ struct ble_mesh_deinit_mesh_comp_param {
+ int err_code; /*!< Indicate the result of BLE Mesh deinitialization */
+ } deinit_mesh_comp; /*!< Event parameter of ESP_BLE_MESH_DEINIT_MESH_COMP_EVT */
+} esp_ble_mesh_prov_cb_param_t; /*!< Event parameters of ESP_BLE_MESH_DEINIT_MESH_COMP_EVT */
+
+/**
+ * @brief BLE Mesh models related Model ID and Opcode definitions
+ */
+
+/*!< Foundation Models */
+#define ESP_BLE_MESH_MODEL_ID_CONFIG_SRV 0x0000
+#define ESP_BLE_MESH_MODEL_ID_CONFIG_CLI 0x0001
+#define ESP_BLE_MESH_MODEL_ID_HEALTH_SRV 0x0002
+#define ESP_BLE_MESH_MODEL_ID_HEALTH_CLI 0x0003
+#define ESP_BLE_MESH_MODEL_ID_RPR_SRV 0x0004
+#define ESP_BLE_MESH_MODEL_ID_RPR_CLI 0x0005
+#define ESP_BLE_MESH_MODEL_ID_DF_SRV 0x0006
+#define ESP_BLE_MESH_MODEL_ID_DF_CLI 0x0007
+#define ESP_BLE_MESH_MODEL_ID_BRC_SRV 0x0008
+#define ESP_BLE_MESH_MODEL_ID_BRC_CLI 0x0009
+#define ESP_BLE_MESH_MODEL_ID_PRB_SRV 0x000A
+#define ESP_BLE_MESH_MODEL_ID_PRB_CLI 0x000B
+#define ESP_BLE_MESH_MODEL_ID_ODP_SRV 0x000C
+#define ESP_BLE_MESH_MODEL_ID_ODP_CLI 0x000D
+#define ESP_BLE_MESH_MODEL_ID_SAR_SRV 0x000E
+#define ESP_BLE_MESH_MODEL_ID_SAR_CLI 0x000F
+#define ESP_BLE_MESH_MODEL_ID_AGG_SRV 0x0010
+#define ESP_BLE_MESH_MODEL_ID_AGG_CLI 0x0011
+#define ESP_BLE_MESH_MODEL_ID_LCD_SRV 0x0012
+#define ESP_BLE_MESH_MODEL_ID_LCD_CLI 0x0013
+#define ESP_BLE_MESH_MODEL_ID_SRPL_SRV 0x0014
+#define ESP_BLE_MESH_MODEL_ID_SRPL_CLI 0x0015
+
+/*!< Models from the Mesh Model Specification */
+#define ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV 0x1000
+#define ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI 0x1001
+#define ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_SRV 0x1002
+#define ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_CLI 0x1003
+#define ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV 0x1004
+#define ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI 0x1005
+#define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV 0x1006
+#define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV 0x1007
+#define ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI 0x1008
+#define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV 0x1009
+#define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV 0x100a
+#define ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI 0x100b
+#define ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_SRV 0x100c
+#define ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_CLI 0x100d
+#define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SRV 0x100e
+#define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SETUP_SRV 0x100f
+#define ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_CLI 0x1010
+#define ESP_BLE_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV 0x1011
+#define ESP_BLE_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV 0x1012
+#define ESP_BLE_MESH_MODEL_ID_GEN_USER_PROP_SRV 0x1013
+#define ESP_BLE_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV 0x1014
+#define ESP_BLE_MESH_MODEL_ID_GEN_PROP_CLI 0x1015
+#define ESP_BLE_MESH_MODEL_ID_SENSOR_SRV 0x1100
+#define ESP_BLE_MESH_MODEL_ID_SENSOR_SETUP_SRV 0x1101
+#define ESP_BLE_MESH_MODEL_ID_SENSOR_CLI 0x1102
+#define ESP_BLE_MESH_MODEL_ID_TIME_SRV 0x1200
+#define ESP_BLE_MESH_MODEL_ID_TIME_SETUP_SRV 0x1201
+#define ESP_BLE_MESH_MODEL_ID_TIME_CLI 0x1202
+#define ESP_BLE_MESH_MODEL_ID_SCENE_SRV 0x1203
+#define ESP_BLE_MESH_MODEL_ID_SCENE_SETUP_SRV 0x1204
+#define ESP_BLE_MESH_MODEL_ID_SCENE_CLI 0x1205
+#define ESP_BLE_MESH_MODEL_ID_SCHEDULER_SRV 0x1206
+#define ESP_BLE_MESH_MODEL_ID_SCHEDULER_SETUP_SRV 0x1207
+#define ESP_BLE_MESH_MODEL_ID_SCHEDULER_CLI 0x1208
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV 0x1300
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV 0x1301
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI 0x1302
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SRV 0x1303
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV 0x1304
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_CLI 0x1305
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV 0x1306
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SRV 0x1307
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV 0x1308
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_CLI 0x1309
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV 0x130a
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV 0x130b
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SRV 0x130c
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV 0x130d
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_CLI 0x130e
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SRV 0x130f
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SETUP_SRV 0x1310
+#define ESP_BLE_MESH_MODEL_ID_LIGHT_LC_CLI 0x1311
+#define ESP_BLE_MESH_MODEL_ID_MBT_SRV 0x1400
+#define ESP_BLE_MESH_MODEL_ID_MBT_CLI 0x1401
+
+/**
+ * esp_ble_mesh_opcode_config_client_get_t belongs to esp_ble_mesh_opcode_t, this typedef is only
+ * used to locate the opcodes used by esp_ble_mesh_config_client_get_state.
+ * The following opcodes will only be used in the esp_ble_mesh_config_client_get_state function.
+ */
+typedef uint32_t esp_ble_mesh_opcode_config_client_get_t;
+
+#define ESP_BLE_MESH_MODEL_OP_BEACON_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x09) /*!< Config Beacon Get */
+#define ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x08) /*!< Config Composition Data Get */
+#define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0C) /*!< Config Default TTL Get */
+#define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x12) /*!< Config GATT Proxy Get */
+#define ESP_BLE_MESH_MODEL_OP_RELAY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x26) /*!< Config Relay Get */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x18) /*!< Config Model Publication Get */
+#define ESP_BLE_MESH_MODEL_OP_FRIEND_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0F) /*!< Config Friend Get */
+#define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x38) /*!< Config Heartbeat Publication Get */
+#define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3a) /*!< Config Heartbeat Subscription Get */
+#define ESP_BLE_MESH_MODEL_OP_NET_KEY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x42) /*!< Config NetKey Get */
+#define ESP_BLE_MESH_MODEL_OP_APP_KEY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x01) /*!< Config AppKey Get */
+#define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x46) /*!< Config Node Identity Get */
+#define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x29) /*!< Config SIG Model Subscription Get */
+#define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2B) /*!< Config Vendor Model Subscription Get */
+#define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4B) /*!< Config SIG Model App Get */
+#define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4D) /*!< Config Vendor Model App Get */
+#define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x15) /*!< Config Key Refresh Phase Get */
+#define ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2D) /*!< Config Low Power Node PollTimeout Get */
+#define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x23) /*!< Config Network Transmit Get */
+
+/**
+ * esp_ble_mesh_opcode_config_client_set_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by esp_ble_mesh_config_client_set_state.
+ * The following opcodes will only be used in the esp_ble_mesh_config_client_set_state function.
+ */
+typedef uint32_t esp_ble_mesh_opcode_config_client_set_t;
+
+#define ESP_BLE_MESH_MODEL_OP_BEACON_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0A) /*!< Config Beacon Set */
+#define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0D) /*!< Config Default TTL Set */
+#define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x13) /*!< Config GATT Proxy Set */
+#define ESP_BLE_MESH_MODEL_OP_RELAY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x27) /*!< Config Relay Set */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET ESP_BLE_MESH_MODEL_OP_1(0x03) /*!< Config Model Publication Set */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1B) /*!< Config Model Subscription Add */
+#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 */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1C) /*!< Config Model Subscription Delete */
+#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 */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1E) /*!< Config Model Subscription Overwrite */
+#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 */
+#define ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD ESP_BLE_MESH_MODEL_OP_2(0x80, 0x40) /*!< Config NetKey Add */
+#define ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD ESP_BLE_MESH_MODEL_OP_1(0x00) /*!< Config AppKey Add */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3D) /*!< Config Model App Bind */
+#define ESP_BLE_MESH_MODEL_OP_NODE_RESET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x49) /*!< Config Node Reset */
+#define ESP_BLE_MESH_MODEL_OP_FRIEND_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x10) /*!< Config Friend Set */
+#define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x39) /*!< Config Heartbeat Publication Set */
+#define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3B) /*!< Config Heartbeat Subscription Set */
+#define ESP_BLE_MESH_MODEL_OP_NET_KEY_UPDATE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x45) /*!< Config NetKey Update */
+#define ESP_BLE_MESH_MODEL_OP_NET_KEY_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x41) /*!< Config NetKey Delete */
+#define ESP_BLE_MESH_MODEL_OP_APP_KEY_UPDATE ESP_BLE_MESH_MODEL_OP_1(0x01) /*!< Config AppKey Update */
+#define ESP_BLE_MESH_MODEL_OP_APP_KEY_DELETE ESP_BLE_MESH_MODEL_OP_2(0x80, 0x00) /*!< Config AppKey Delete */
+#define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x47) /*!< Config Node Identity Set */
+#define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x16) /*!< Config Key Refresh Phase Set */
+#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 */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE_ALL ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1D) /*!< Config Model Subscription Delete All */
+#define ESP_BLE_MESH_MODEL_OP_MODEL_APP_UNBIND ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3F) /*!< Config Model App Unbind */
+#define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x24) /*!< Config Network Transmit Set */
+
+/**
+ * esp_ble_mesh_opcode_config_status_t belongs to esp_ble_mesh_opcode_t, this typedef is only
+ * used to locate the opcodes used by the Config Model messages
+ * The following opcodes are used by the BLE Mesh Config Server Model internally to respond
+ * to the Config Client Model's request messages.
+ */
+typedef uint32_t esp_ble_mesh_opcode_config_status_t;
+
+#define ESP_BLE_MESH_MODEL_OP_BEACON_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0B)
+#define ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_STATUS ESP_BLE_MESH_MODEL_OP_1(0x02)
+#define ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x0E)
+#define ESP_BLE_MESH_MODEL_OP_GATT_PROXY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x14)
+#define ESP_BLE_MESH_MODEL_OP_RELAY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x28)
+#define ESP_BLE_MESH_MODEL_OP_MODEL_PUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x19)
+#define ESP_BLE_MESH_MODEL_OP_MODEL_SUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x1F)
+#define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2A)
+#define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2C)
+#define ESP_BLE_MESH_MODEL_OP_NET_KEY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x44)
+#define ESP_BLE_MESH_MODEL_OP_NET_KEY_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x43)
+#define ESP_BLE_MESH_MODEL_OP_APP_KEY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x03)
+#define ESP_BLE_MESH_MODEL_OP_APP_KEY_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x02)
+#define ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x48)
+#define ESP_BLE_MESH_MODEL_OP_MODEL_APP_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3E)
+#define ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4C)
+#define ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_LIST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4E)
+#define ESP_BLE_MESH_MODEL_OP_NODE_RESET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x4A)
+#define ESP_BLE_MESH_MODEL_OP_FRIEND_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x11)
+#define ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x17)
+#define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_STATUS ESP_BLE_MESH_MODEL_OP_1(0x06)
+#define ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x3C)
+#define ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2E)
+#define ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x25)
+
+/**
+ * This typedef is only used to indicate the status code contained in some of
+ * the Configuration Server Model status message.
+ */
+typedef uint8_t esp_ble_mesh_cfg_status_t;
+
+#define ESP_BLE_MESH_CFG_STATUS_SUCCESS 0x00
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_ADDRESS 0x01
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_MODEL 0x02
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_APPKEY 0x03
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_NETKEY 0x04
+#define ESP_BLE_MESH_CFG_STATUS_INSUFFICIENT_RESOURCES 0x05
+#define ESP_BLE_MESH_CFG_STATUS_KEY_INDEX_ALREADY_STORED 0x06
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_PUBLISH_PARAMETERS 0x07
+#define ESP_BLE_MESH_CFG_STATUS_NOT_A_SUBSCRIBE_MODEL 0x08
+#define ESP_BLE_MESH_CFG_STATUS_STORAGE_FAILURE 0x09
+#define ESP_BLE_MESH_CFG_STATUS_FEATURE_NOT_SUPPORTED 0x0A
+#define ESP_BLE_MESH_CFG_STATUS_CANNOT_UPDATE 0x0B
+#define ESP_BLE_MESH_CFG_STATUS_CANNOT_REMOVE 0x0C
+#define ESP_BLE_MESH_CFG_STATUS_CANNOT_BIND 0x0D
+#define ESP_BLE_MESH_CFG_STATUS_TEMP_UNABLE_TO_CHANGE_STATE 0x0E
+#define ESP_BLE_MESH_CFG_STATUS_CANNOT_SET 0x0F
+#define ESP_BLE_MESH_CFG_STATUS_UNSPECIFIED_ERROR 0x10
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_BINDING 0x11
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_PATH_ENTRY 0x12
+#define ESP_BLE_MESH_CFG_STATUS_CANNOT_GET 0x13
+#define ESP_BLE_MESH_CFG_STATUS_OBSOLETE_INFO 0x14
+#define ESP_BLE_MESH_CFG_STATUS_INVALID_BEARER 0x15
+
+/**
+ * esp_ble_mesh_opcode_health_client_get_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by esp_ble_mesh_health_client_get_state.
+ * The following opcodes will only be used in the esp_ble_mesh_health_client_get_state function.
+ */
+typedef uint32_t esp_ble_mesh_opcode_health_client_get_t;
+
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x31) /*!< Health Fault Get */
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x34) /*!< Health Period Get */
+#define ESP_BLE_MESH_MODEL_OP_ATTENTION_GET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x04) /*!< Health Attention Get */
+
+/**
+ * esp_ble_mesh_opcode_health_client_set_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by esp_ble_mesh_health_client_set_state.
+ * The following opcodes will only be used in the esp_ble_mesh_health_client_set_state function.
+ */
+typedef uint32_t esp_ble_mesh_opcode_health_client_set_t;
+
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR ESP_BLE_MESH_MODEL_OP_2(0x80, 0x2F) /*!< Health Fault Clear */
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x30) /*!< Health Fault Clear Unacknowledged */
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST ESP_BLE_MESH_MODEL_OP_2(0x80, 0x32) /*!< Health Fault Test */
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x33) /*!< Health Fault Test Unacknowledged */
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x35) /*!< Health Period Set */
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x36) /*!< Health Period Set Unacknowledged */
+#define ESP_BLE_MESH_MODEL_OP_ATTENTION_SET ESP_BLE_MESH_MODEL_OP_2(0x80, 0x05) /*!< Health Attention Set */
+#define ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x80, 0x06) /*!< Health Attention Set Unacknowledged */
+
+/**
+ * esp_ble_mesh_health_model_status_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by the Health Model messages.
+ * The following opcodes are used by the BLE Mesh Health Server Model internally to
+ * respond to the Health Client Model's request messages.
+ */
+typedef uint32_t esp_ble_mesh_health_model_status_t;
+
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_CURRENT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x04)
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x05)
+#define ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x37)
+#define ESP_BLE_MESH_MODEL_OP_ATTENTION_STATUS ESP_BLE_MESH_MODEL_OP_2(0x80, 0x07)
+
+/**
+ * esp_ble_mesh_generic_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by functions esp_ble_mesh_generic_client_get_state
+ * & esp_ble_mesh_generic_client_set_state.
+ */
+typedef uint32_t esp_ble_mesh_generic_message_opcode_t;
+
+/*!< Generic OnOff Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x01)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x02)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x03)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x04)
+
+/*!< Generic Level Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x05)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x06)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x07)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x08)
+#define ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x09)
+#define ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0A)
+#define ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0B)
+#define ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0C)
+
+/*!< Generic Default Transition Time Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0D)
+#define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0E)
+#define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x0F)
+#define ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x10)
+
+/*!< Generic Power OnOff Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x11)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x12)
+
+/*!< Generic Power OnOff Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x13)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x14)
+
+/*!< Generic Power Level Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x15)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x16)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x17)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x18)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x19)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1A)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1B)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1C)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1D)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1E)
+
+/*!< Generic Power Level Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x1F)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x20)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x21)
+#define ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x22)
+
+/*!< Generic Battery Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x23)
+#define ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x24)
+
+/*!< Generic Location Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x25)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_STATUS ESP_BLE_MESH_MODEL_OP_1(0x40)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x26)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x27)
+
+/*!< Generic Location Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET ESP_BLE_MESH_MODEL_OP_1(0x41)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x42)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x28)
+#define ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x29)
+
+/*!< Generic Manufacturer Property Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2A)
+#define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x43)
+#define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2B)
+#define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x44)
+#define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x45)
+#define ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x46)
+
+/*!< Generic Admin Property Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2C)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x47)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2D)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x48)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x49)
+#define ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4A)
+
+/*!< Generic User Property Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2E)
+#define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4B)
+#define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x2F)
+#define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x4C)
+#define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x4D)
+#define ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x4E)
+
+/*!< Generic Client Property Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_GET ESP_BLE_MESH_MODEL_OP_1(0x4F)
+#define ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x50)
+
+/**
+ * esp_ble_mesh_sensor_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by functions esp_ble_mesh_sensor_client_get_state
+ * & esp_ble_mesh_sensor_client_set_state.
+ */
+typedef uint32_t esp_ble_mesh_sensor_message_opcode_t;
+
+/*!< Sensor Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x30)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_STATUS ESP_BLE_MESH_MODEL_OP_1(0x51)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x31)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_STATUS ESP_BLE_MESH_MODEL_OP_1(0x52)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x32)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_STATUS ESP_BLE_MESH_MODEL_OP_1(0x53)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x33)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_STATUS ESP_BLE_MESH_MODEL_OP_1(0x54)
+
+/*!< Sensor Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x34)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET ESP_BLE_MESH_MODEL_OP_1(0x55)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x56)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_STATUS ESP_BLE_MESH_MODEL_OP_1(0x57)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x35)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_STATUS ESP_BLE_MESH_MODEL_OP_1(0x58)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x36)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET ESP_BLE_MESH_MODEL_OP_1(0x59)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x5A)
+#define ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5B)
+
+/**
+ * esp_ble_mesh_time_scene_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by functions esp_ble_mesh_time_scene_client_get_state
+ * & esp_ble_mesh_time_scene_client_set_state.
+ */
+typedef uint32_t esp_ble_mesh_time_scene_message_opcode_t;
+
+/*!< Time Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_TIME_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x37)
+#define ESP_BLE_MESH_MODEL_OP_TIME_SET ESP_BLE_MESH_MODEL_OP_1(0x5C)
+#define ESP_BLE_MESH_MODEL_OP_TIME_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5D)
+#define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x38)
+#define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x39)
+#define ESP_BLE_MESH_MODEL_OP_TIME_ROLE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3A)
+#define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3B)
+#define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3C)
+#define ESP_BLE_MESH_MODEL_OP_TIME_ZONE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3D)
+#define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3E)
+#define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x3F)
+#define ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x40)
+
+/*!< Scene Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_SCENE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x41)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_RECALL ESP_BLE_MESH_MODEL_OP_2(0x82, 0x42)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_RECALL_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x43)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5E)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x44)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x45)
+
+/*!< Scene Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_SCENE_STORE ESP_BLE_MESH_MODEL_OP_2(0x82, 0x46)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_STORE_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x47)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_DELETE ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9E)
+#define ESP_BLE_MESH_MODEL_OP_SCENE_DELETE_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9F)
+
+/*!< Scheduler Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x48)
+#define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_STATUS ESP_BLE_MESH_MODEL_OP_1(0x5F)
+#define ESP_BLE_MESH_MODEL_OP_SCHEDULER_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x49)
+#define ESP_BLE_MESH_MODEL_OP_SCHEDULER_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4A)
+
+/*!< Scheduler Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET ESP_BLE_MESH_MODEL_OP_1(0x60)
+#define ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x61)
+
+/**
+ * esp_ble_mesh_light_message_opcode_t belongs to esp_ble_mesh_opcode_t, this typedef is
+ * only used to locate the opcodes used by functions esp_ble_mesh_light_client_get_state
+ * & esp_ble_mesh_light_client_set_state.
+ */
+typedef uint32_t esp_ble_mesh_light_message_opcode_t;
+
+/*!< Light Lightness Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4B)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4C)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4D)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4E)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x4F)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x50)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x51)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x52)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x53)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x54)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x55)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x56)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x57)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x58)
+
+/*!< Light Lightness Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x59)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5A)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5B)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5C)
+
+/*!< Light CTL Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5D)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5E)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x5F)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x60)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x61)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x62)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x63)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x64)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x65)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x66)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x67)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x68)
+
+/*!< Light CTL Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x69)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6A)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6B)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6C)
+
+/*!< Light HSL Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6D)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6E)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x6F)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x70)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x71)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x72)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x73)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x74)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x75)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x76)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x77)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x78)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x79)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7A)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7B)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7C)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7D)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7E)
+
+/*!< Light HSL Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x7F)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x80)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x81)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x82)
+
+/*!< Light xyL Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x83)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x84)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x85)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x86)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x87)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x88)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x89)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8A)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8B)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8C)
+
+/*!< Light xyL Setup Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8D)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8E)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x8F)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x90)
+
+/*!< Light Control Message Opcode */
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x91)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x92)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x93)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x94)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x95)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x96)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x97)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x98)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x99)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9A)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET_UNACK ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9B)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9C)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_GET ESP_BLE_MESH_MODEL_OP_2(0x82, 0x9D)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET ESP_BLE_MESH_MODEL_OP_1(0x62)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET_UNACK ESP_BLE_MESH_MODEL_OP_1(0x63)
+#define ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_STATUS ESP_BLE_MESH_MODEL_OP_1(0x64)
+
+typedef uint32_t esp_ble_mesh_opcode_t;
+/*!< End of defines of esp_ble_mesh_opcode_t */
+
+/**
+ * This typedef is only used to indicate the status code contained in some of the
+ * server models (e.g. Generic Server Model) status message.
+ */
+typedef uint8_t esp_ble_mesh_model_status_t;
+
+#define ESP_BLE_MESH_MODEL_STATUS_SUCCESS 0x00
+#define ESP_BLE_MESH_MODEL_STATUS_CANNOT_SET_RANGE_MIN 0x01
+#define ESP_BLE_MESH_MODEL_STATUS_CANNOT_SET_RANGE_MAX 0x02
+
+/**
+ * @brief BLE Mesh client models related definitions
+ */
+
+/** Client model Get/Set message opcode and corresponding Status message opcode */
+typedef struct {
+ uint32_t cli_op; /*!< The client message opcode */
+ uint32_t status_op; /*!< The server status opcode corresponding to the client message opcode */
+} esp_ble_mesh_client_op_pair_t;
+
+/** Client Model user data context. */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the client model. Initialized by the stack. */
+ uint32_t op_pair_size; /*!< Size of the op_pair */
+ const esp_ble_mesh_client_op_pair_t *op_pair; /*!< Table containing get/set message opcode and corresponding status message opcode */
+ uint32_t publish_status; /*!< Callback used to handle the received unsolicited message. Initialized by the stack. */
+ void *internal_data; /*!< Pointer to the internal data of client model */
+ void *vendor_data; /*!< Pointer to the vendor data of client model */
+ uint8_t msg_role __attribute__((deprecated)); /*!< Role of the device (Node/Provisioner) that is going to send messages */
+} esp_ble_mesh_client_t;
+
+/** Common parameters of the messages sent by Client Model. */
+typedef struct {
+ esp_ble_mesh_opcode_t opcode; /*!< Message opcode */
+ esp_ble_mesh_model_t *model; /*!< Pointer to the client model structure */
+ esp_ble_mesh_msg_ctx_t ctx; /*!< The context used to send message */
+ int32_t msg_timeout; /*!< Timeout value (ms) to get response to the sent message */
+ /*!< Note: if using default timeout value in menuconfig, make sure to set this value to 0 */
+ uint8_t msg_role __attribute__((deprecated)); /*!< Role of the device - Node/Provisioner */
+} esp_ble_mesh_client_common_param_t;
+
+/**
+ * @brief BLE Mesh server models related definitions
+ */
+
+/** This enum value is the flag of transition timer operation */
+enum {
+ ESP_BLE_MESH_SERVER_TRANS_TIMER_START, /* Proper transition timer has been started */
+ ESP_BLE_MESH_SERVER_FLAG_MAX,
+};
+
+/** Parameters of the server model state transition */
+typedef struct {
+ bool just_started; /*!< Indicate if the state transition has just started */
+
+ uint8_t trans_time; /*!< State transition time */
+ uint8_t remain_time; /*!< Remaining time of state transition */
+ uint8_t delay; /*!< Delay before starting state transition */
+ uint32_t quo_tt; /*!< Duration of each divided transition step */
+ uint32_t counter; /*!< Number of steps which the transition duration is divided */
+ uint32_t total_duration; /*!< State transition total duration */
+ int64_t start_timestamp; /*!< Time when the state transition is started */
+
+ /**
+ * Flag used to indicate if the transition timer has been started internally.
+ *
+ * If the model which contains esp_ble_mesh_state_transition_t sets "set_auto_rsp"
+ * to ESP_BLE_MESH_SERVER_RSP_BY_APP, the handler of the timer shall be initialized
+ * by the users.
+ *
+ * And users can use this flag to indicate whether the timer is started or not.
+ */
+ BLE_MESH_ATOMIC_DEFINE(flag, ESP_BLE_MESH_SERVER_FLAG_MAX);
+ struct k_delayed_work timer; /*!< Timer used for state transition */
+} esp_ble_mesh_state_transition_t;
+
+/** Parameters of the server model received last same set message. */
+typedef struct {
+ uint8_t tid; /*!< Transaction number of the last message */
+ uint16_t src; /*!< Source address of the last message */
+ uint16_t dst; /*!< Destination address of the last message */
+ int64_t timestamp; /*!< Time when the last message is received */
+} esp_ble_mesh_last_msg_info_t;
+
+#define ESP_BLE_MESH_SERVER_RSP_BY_APP 0 /*!< Response need to be sent in the application */
+#define ESP_BLE_MESH_SERVER_AUTO_RSP 1 /*!< Response will be sent internally */
+
+/** Parameters of the Server Model response control */
+typedef struct {
+ /**
+ * @brief BLE Mesh Server Response Option
+ * 1. If get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the
+ * response of Client Get messages need to be replied by the application;
+ * 2. If get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the
+ * response of Client Get messages will be replied by the server models;
+ * 3. If set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the
+ * response of Client Set messages need to be replied by the application;
+ * 4. If set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the
+ * response of Client Set messages will be replied by the server models;
+ * 5. If status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, then the
+ * response of Server Status messages need to be replied by the application;
+ * 6. If status_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, then the
+ * response of Server Status messages will be replied by the server models;
+ */
+ uint8_t get_auto_rsp : 1, /*!< Response control for Client Get messages */
+ set_auto_rsp : 1, /*!< Response control for Client Set messages */
+ status_auto_rsp : 1; /*!< Response control for Server Status messages */
+} esp_ble_mesh_server_rsp_ctrl_t;
+
+/**
+ * @brief Server model state value union
+ */
+typedef union {
+ struct {
+ uint8_t onoff; /*!< The value of the Generic OnOff state */
+ } gen_onoff; /*!< The Generic OnOff state */
+ struct {
+ int16_t level; /*!< The value of the Generic Level state */
+ } gen_level; /*!< The Generic Level state */
+ struct {
+ uint8_t onpowerup; /*!< The value of the Generic OnPowerUp state */
+ } gen_onpowerup; /*!< The Generic OnPowerUp state */
+ struct {
+ uint16_t power; /*!< The value of the Generic Power Actual state */
+ } gen_power_actual; /*!< The Generic Power Actual state */
+ struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Actual state */
+ } light_lightness_actual; /*!< The Light Lightness Actual state */
+ struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Linear state */
+ } light_lightness_linear; /*!< The Light Lightness Linear state */
+ struct {
+ uint16_t lightness; /*!< The value of the Light CTL Lightness state */
+ } light_ctl_lightness; /*!< The Light CTL Lightness state */
+ struct {
+ uint16_t temperature; /*!< The value of the Light CTL Temperature state */
+ int16_t delta_uv; /*!< The value of the Light CTL Delta UV state */
+ } light_ctl_temp_delta_uv; /*!< The Light CTL Temperature & Delta UV states */
+ struct {
+ uint16_t lightness; /*!< The value of the Light HSL Lightness state */
+ uint16_t hue; /*!< The value of the Light HSL Hue state */
+ uint16_t saturation; /*!< The value of the Light HSL Saturation state */
+ } light_hsl; /*!< The Light HSL composite state */
+ struct {
+ uint16_t lightness; /*!< The value of the Light HSL Lightness state */
+ } light_hsl_lightness; /*!< The Light HSL Lightness state */
+ struct {
+ uint16_t hue; /*!< The value of the Light HSL Hue state */
+ } light_hsl_hue; /*!< The Light HSL Hue state */
+ struct {
+ uint16_t saturation; /*!< The value of the Light HSL Saturation state */
+ } light_hsl_saturation; /*!< The Light HSL Saturation state */
+ struct {
+ uint16_t lightness; /*!< The value of the Light xyL Lightness state */
+ } light_xyl_lightness; /*!< The Light xyL Lightness state */
+ struct {
+ uint8_t onoff; /*!< The value of the Light LC Light OnOff state */
+ } light_lc_light_onoff; /*!< The Light LC Light OnOff state */
+} esp_ble_mesh_server_state_value_t;
+
+/** This enum value is the type of server model states */
+typedef enum {
+ ESP_BLE_MESH_GENERIC_ONOFF_STATE,
+ ESP_BLE_MESH_GENERIC_LEVEL_STATE,
+ ESP_BLE_MESH_GENERIC_ONPOWERUP_STATE,
+ ESP_BLE_MESH_GENERIC_POWER_ACTUAL_STATE,
+ ESP_BLE_MESH_LIGHT_LIGHTNESS_ACTUAL_STATE,
+ ESP_BLE_MESH_LIGHT_LIGHTNESS_LINEAR_STATE,
+ ESP_BLE_MESH_LIGHT_CTL_LIGHTNESS_STATE,
+ ESP_BLE_MESH_LIGHT_CTL_TEMP_DELTA_UV_STATE,
+ ESP_BLE_MESH_LIGHT_HSL_STATE,
+ ESP_BLE_MESH_LIGHT_HSL_LIGHTNESS_STATE,
+ ESP_BLE_MESH_LIGHT_HSL_HUE_STATE,
+ ESP_BLE_MESH_LIGHT_HSL_SATURATION_STATE,
+ ESP_BLE_MESH_LIGHT_XYL_LIGHTNESS_STATE,
+ ESP_BLE_MESH_LIGHT_LC_LIGHT_ONOFF_STATE,
+ ESP_BLE_MESH_SERVER_MODEL_STATE_MAX,
+} esp_ble_mesh_server_state_type_t;
+
+/*!< This enum value is the event of undefined SIG models and vendor models */
+typedef enum {
+ ESP_BLE_MESH_MODEL_OPERATION_EVT, /*!< User-defined models receive messages from peer devices (e.g. get, set, status, etc) event */
+ ESP_BLE_MESH_MODEL_SEND_COMP_EVT, /*!< User-defined models send messages completion event */
+ ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT, /*!< User-defined models publish messages completion event */
+ ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT, /*!< User-defined client models receive publish messages event */
+ 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 */
+ ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT, /*!< When a model is configured to publish messages periodically, this event will occur during every publish period */
+ ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT, /*!< Server models update state value completion event */
+ ESP_BLE_MESH_MODEL_EVT_MAX,
+} esp_ble_mesh_model_cb_event_t;
+
+/**
+ * @brief BLE Mesh model callback parameters union
+ */
+typedef union {
+ /**
+ * @brief ESP_BLE_MESH_MODEL_OPERATION_EVT
+ */
+ struct ble_mesh_model_operation_evt_param {
+ uint32_t opcode; /*!< Opcode of the received message */
+ esp_ble_mesh_model_t *model; /*!< Pointer to the model which receives the message */
+ esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the received message */
+ uint16_t length; /*!< Length of the received message */
+ uint8_t *msg; /*!< Value of the received message */
+ } model_operation; /*!< Event parameter of ESP_BLE_MESH_MODEL_OPERATION_EVT */
+ /**
+ * @brief ESP_BLE_MESH_MODEL_SEND_COMP_EVT
+ */
+ struct ble_mesh_model_send_comp_param {
+ int err_code; /*!< Indicate the result of sending a message */
+ uint32_t opcode; /*!< Opcode of the message */
+ esp_ble_mesh_model_t *model; /*!< Pointer to the model which sends the message */
+ esp_ble_mesh_msg_ctx_t *ctx; /*!< Context of the message */
+ } model_send_comp; /*!< Event parameter of ESP_BLE_MESH_MODEL_SEND_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT
+ */
+ struct ble_mesh_model_publish_comp_param {
+ int err_code; /*!< Indicate the result of publishing a message */
+ esp_ble_mesh_model_t *model; /*!< Pointer to the model which publishes the message */
+ } model_publish_comp; /*!< Event parameter of ESP_BLE_MESH_MODEL_PUBLISH_COMP_EVT */
+ /**
+ * @brief ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT
+ */
+ struct ble_mesh_mod_recv_publish_msg_param {
+ uint32_t opcode; /*!< Opcode of the unsolicited received message */
+ esp_ble_mesh_model_t *model; /*!< Pointer to the model which receives the message */
+ esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the message */
+ uint16_t length; /*!< Length of the received message */
+ uint8_t *msg; /*!< Value of the received message */
+ } client_recv_publish_msg; /*!< Event parameter of ESP_BLE_MESH_CLIENT_MODEL_RECV_PUBLISH_MSG_EVT */
+ /**
+ * @brief ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT
+ */
+ struct ble_mesh_client_model_send_timeout_param {
+ uint32_t opcode; /*!< Opcode of the previously sent message */
+ esp_ble_mesh_model_t *model; /*!< Pointer to the model which sends the previous message */
+ esp_ble_mesh_msg_ctx_t *ctx; /*!< Pointer to the context of the previous message */
+ } client_send_timeout; /*!< Event parameter of ESP_BLE_MESH_CLIENT_MODEL_SEND_TIMEOUT_EVT */
+ /**
+ * @brief ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT
+ */
+ struct ble_mesh_model_publish_update_evt_param {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the model which is going to update its publish message */
+ } model_publish_update; /*!< Event parameter of ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT */
+ /**
+ * @brief ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT
+ */
+ struct ble_mesh_server_model_update_state_comp_param {
+ int err_code; /*!< Indicate the result of updating server model state */
+ esp_ble_mesh_model_t *model; /*!< Pointer to the server model which state value is updated */
+ esp_ble_mesh_server_state_type_t type; /*!< Type of the updated server state */
+ } server_model_update_state; /*!< Event parameter of ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT */
+} esp_ble_mesh_model_cb_param_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_DEFS_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c
new file mode 100644
index 00000000..98155caf
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c
@@ -0,0 +1,97 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "btc/btc_manage.h"
+
+#include "btc_ble_mesh_config_model.h"
+#include "esp_ble_mesh_config_model_api.h"
+
+#if CONFIG_BLE_MESH_CFG_CLI
+esp_err_t esp_ble_mesh_register_config_client_callback(esp_ble_mesh_cfg_client_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_CONFIG_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+static bool config_client_get_need_param(esp_ble_mesh_opcode_t opcode)
+{
+ switch (opcode) {
+ case ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET:
+ case ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET:
+ case ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_GET:
+ case ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_GET:
+ case ESP_BLE_MESH_MODEL_OP_APP_KEY_GET:
+ case ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_GET:
+ case ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_GET:
+ case ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_GET:
+ case ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET:
+ case ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET:
+ return true;
+ default:
+ return false;
+ }
+}
+
+esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_cfg_client_get_state_t *get_state)
+{
+ btc_ble_mesh_config_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ !ESP_BLE_MESH_ADDR_IS_UNICAST(params->ctx.addr) ||
+ (config_client_get_need_param(params->opcode) && get_state == NULL)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_CONFIG_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_CONFIG_CLIENT_GET_STATE;
+ arg.cfg_client_get_state.params = params;
+ arg.cfg_client_get_state.get_state = get_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_config_client_args_t), btc_ble_mesh_config_client_arg_deep_copy,
+ btc_ble_mesh_config_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_cfg_client_set_state_t *set_state)
+{
+ btc_ble_mesh_config_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ !ESP_BLE_MESH_ADDR_IS_UNICAST(params->ctx.addr) ||
+ (params->opcode != ESP_BLE_MESH_MODEL_OP_NODE_RESET && set_state == NULL)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_CONFIG_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_CONFIG_CLIENT_SET_STATE;
+ arg.cfg_client_set_state.params = params;
+ arg.cfg_client_set_state.set_state = set_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_config_client_args_t), btc_ble_mesh_config_client_arg_deep_copy,
+ btc_ble_mesh_config_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_CFG_CLI */
+
+esp_err_t esp_ble_mesh_register_config_server_callback(esp_ble_mesh_cfg_server_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_CONFIG_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
diff --git a/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c
new file mode 100644
index 00000000..e404c6a5
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c
@@ -0,0 +1,94 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "btc/btc_manage.h"
+
+#include "btc_ble_mesh_generic_model.h"
+#include "esp_ble_mesh_generic_model_api.h"
+
+#if CONFIG_BLE_MESH_GENERIC_CLIENT
+esp_err_t esp_ble_mesh_register_generic_client_callback(esp_ble_mesh_generic_client_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_GENERIC_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+static bool generic_client_get_need_param(esp_ble_mesh_opcode_t opcode)
+{
+ switch (opcode) {
+ case ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET:
+ case ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET:
+ case ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_GET:
+ case ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_GET:
+ return true;
+ default:
+ return false;
+ }
+}
+
+esp_err_t esp_ble_mesh_generic_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_generic_client_get_state_t *get_state)
+{
+ btc_ble_mesh_generic_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED ||
+ (generic_client_get_need_param(params->opcode) && get_state == NULL)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_GENERIC_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_GENERIC_CLIENT_GET_STATE;
+ arg.generic_client_get_state.params = params;
+ arg.generic_client_get_state.get_state = get_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy,
+ btc_ble_mesh_generic_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_generic_client_set_state_t *set_state)
+{
+ btc_ble_mesh_generic_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL || set_state == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_GENERIC_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_GENERIC_CLIENT_SET_STATE;
+ arg.generic_client_set_state.params = params;
+ arg.generic_client_set_state.set_state = set_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy,
+ btc_ble_mesh_generic_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */
+
+#if CONFIG_BLE_MESH_GENERIC_SERVER
+esp_err_t esp_ble_mesh_register_generic_server_callback(esp_ble_mesh_generic_server_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_GENERIC_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */
diff --git a/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c
new file mode 100644
index 00000000..2bdb35a3
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c
@@ -0,0 +1,101 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "btc/btc_manage.h"
+
+#include "btc_ble_mesh_health_model.h"
+#include "esp_ble_mesh_health_model_api.h"
+
+#if CONFIG_BLE_MESH_HEALTH_CLI
+esp_err_t esp_ble_mesh_register_health_client_callback(esp_ble_mesh_health_client_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_HEALTH_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_health_client_get_state_t *get_state)
+{
+ btc_ble_mesh_health_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED ||
+ (params->opcode == ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET && get_state == NULL)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_HEALTH_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_HEALTH_CLIENT_GET_STATE;
+ arg.health_client_get_state.params = params;
+ arg.health_client_get_state.get_state = get_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_client_args_t), btc_ble_mesh_health_client_arg_deep_copy,
+ btc_ble_mesh_health_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_health_client_set_state_t *set_state)
+{
+ btc_ble_mesh_health_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL || set_state == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_HEALTH_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_HEALTH_CLIENT_SET_STATE;
+ arg.health_client_set_state.params = params;
+ arg.health_client_set_state.set_state = set_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_client_args_t), btc_ble_mesh_health_client_arg_deep_copy,
+ btc_ble_mesh_health_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_HEALTH_CLI */
+
+#if CONFIG_BLE_MESH_HEALTH_SRV
+esp_err_t esp_ble_mesh_register_health_server_callback(esp_ble_mesh_health_server_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_HEALTH_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_health_server_fault_update(esp_ble_mesh_elem_t *element)
+{
+ btc_ble_mesh_health_server_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (element == NULL) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_HEALTH_SERVER;
+ msg.act = BTC_BLE_MESH_ACT_HEALTH_SERVER_FAULT_UPDATE;
+ arg.health_fault_update.element = element;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_server_args_t), NULL, NULL)
+ == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_HEALTH_SRV */
diff --git a/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c
new file mode 100644
index 00000000..80bc62f8
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c
@@ -0,0 +1,81 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "btc/btc_manage.h"
+
+#include "btc_ble_mesh_lighting_model.h"
+#include "esp_ble_mesh_lighting_model_api.h"
+
+#if CONFIG_BLE_MESH_LIGHTING_CLIENT
+esp_err_t esp_ble_mesh_register_light_client_callback(esp_ble_mesh_light_client_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_LIGHTING_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_light_client_get_state_t *get_state)
+{
+ btc_ble_mesh_lighting_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED ||
+ (params->opcode == ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_GET && get_state == NULL)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_LIGHTING_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_LIGHTING_CLIENT_GET_STATE;
+ arg.light_client_get_state.params = params;
+ arg.light_client_get_state.get_state = get_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy,
+ btc_ble_mesh_lighting_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_light_client_set_state_t *set_state)
+{
+ btc_ble_mesh_lighting_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL || set_state == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_LIGHTING_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_LIGHTING_CLIENT_SET_STATE;
+ arg.light_client_set_state.params = params;
+ arg.light_client_set_state.set_state = set_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy,
+ btc_ble_mesh_lighting_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */
+
+#if CONFIG_BLE_MESH_LIGHTING_SERVER
+esp_err_t esp_ble_mesh_register_lighting_server_callback(esp_ble_mesh_lighting_server_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_LIGHTING_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */
diff --git a/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c
new file mode 100644
index 00000000..c3c047f1
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c
@@ -0,0 +1,80 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "btc/btc_manage.h"
+
+#include "btc_ble_mesh_sensor_model.h"
+#include "esp_ble_mesh_sensor_model_api.h"
+
+#if CONFIG_BLE_MESH_SENSOR_CLI
+esp_err_t esp_ble_mesh_register_sensor_client_callback(esp_ble_mesh_sensor_client_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_SENSOR_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_sensor_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_sensor_client_get_state_t *get_state)
+{
+ btc_ble_mesh_sensor_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL || get_state == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_SENSOR_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_SENSOR_CLIENT_GET_STATE;
+ arg.sensor_client_get_state.params = params;
+ arg.sensor_client_get_state.get_state = get_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_sensor_client_args_t), btc_ble_mesh_sensor_client_arg_deep_copy,
+ btc_ble_mesh_sensor_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_sensor_client_set_state_t *set_state)
+{
+ btc_ble_mesh_sensor_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL || set_state == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_SENSOR_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_SENSOR_CLIENT_SET_STATE;
+ arg.sensor_client_set_state.params = params;
+ arg.sensor_client_set_state.set_state = set_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_sensor_client_args_t), btc_ble_mesh_sensor_client_arg_deep_copy,
+ btc_ble_mesh_sensor_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_SENSOR_CLI */
+
+#if CONFIG_BLE_MESH_SENSOR_SERVER
+esp_err_t esp_ble_mesh_register_sensor_server_callback(esp_ble_mesh_sensor_server_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_SENSOR_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_SENSOR_SERVER */
diff --git a/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c
new file mode 100644
index 00000000..686e3d22
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c
@@ -0,0 +1,81 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdint.h>
+
+#include "btc/btc_manage.h"
+
+#include "btc_ble_mesh_time_scene_model.h"
+#include "esp_ble_mesh_time_scene_model_api.h"
+
+#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT
+esp_err_t esp_ble_mesh_register_time_scene_client_callback(esp_ble_mesh_time_scene_client_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_TIME_SCENE_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_time_scene_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_time_scene_client_get_state_t *get_state)
+{
+ btc_ble_mesh_time_scene_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED ||
+ (params->opcode == ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_GET && get_state == NULL)) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_TIME_SCENE_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_TIME_SCENE_CLIENT_GET_STATE;
+ arg.time_scene_client_get_state.params = params;
+ arg.time_scene_client_get_state.get_state = get_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy,
+ btc_ble_mesh_time_scene_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+
+esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_time_scene_client_set_state_t *set_state)
+{
+ btc_ble_mesh_time_scene_client_args_t arg = {0};
+ btc_msg_t msg = {0};
+
+ if (params == NULL || params->model == NULL || set_state == NULL ||
+ params->ctx.net_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.app_idx == ESP_BLE_MESH_KEY_UNUSED ||
+ params->ctx.addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
+ return ESP_ERR_INVALID_ARG;
+ }
+
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ msg.sig = BTC_SIG_API_CALL;
+ msg.pid = BTC_PID_TIME_SCENE_CLIENT;
+ msg.act = BTC_BLE_MESH_ACT_TIME_SCENE_CLIENT_SET_STATE;
+ arg.time_scene_client_set_state.params = params;
+ arg.time_scene_client_set_state.set_state = set_state;
+
+ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy,
+ btc_ble_mesh_time_scene_client_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */
+
+#if CONFIG_BLE_MESH_TIME_SCENE_SERVER
+esp_err_t esp_ble_mesh_register_time_scene_server_callback(esp_ble_mesh_time_scene_server_cb_t callback)
+{
+ ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
+
+ return (btc_profile_cb_set(BTC_PID_TIME_SCENE_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
+}
+#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */
diff --git a/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_config_model_api.h b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_config_model_api.h
new file mode 100644
index 00000000..b444465e
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_config_model_api.h
@@ -0,0 +1,832 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_CONFIG_MODEL_API_H_
+#define _ESP_BLE_MESH_CONFIG_MODEL_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @def ESP_BLE_MESH_MODEL_CFG_SRV
+ *
+ * @brief Define a new Config Server Model.
+ *
+ * @note The Config Server Model can only be included by a Primary Element.
+ *
+ * @param srv_data Pointer to a unique Config Server Model user_data.
+ *
+ * @return New Config Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_CFG_SRV(srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_CONFIG_SRV, \
+ NULL, NULL, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_CFG_CLI
+ *
+ * @brief Define a new Config Client Model.
+ *
+ * @note The Config Client Model can only be included by a Primary Element.
+ *
+ * @param cli_data Pointer to a unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Config Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_CFG_CLI(cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_CONFIG_CLI, \
+ NULL, NULL, cli_data)
+
+/** Configuration Server Model context */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to Configuration Server Model */
+
+ uint8_t net_transmit; /*!< Network Transmit state */
+ uint8_t relay; /*!< Relay Mode state */
+ uint8_t relay_retransmit; /*!< Relay Retransmit state */
+ uint8_t beacon; /*!< Secure Network Beacon state */
+ uint8_t gatt_proxy; /*!< GATT Proxy state */
+ uint8_t friend_state; /*!< Friend state */
+ uint8_t default_ttl; /*!< Default TTL */
+
+ /** Heartbeat Publication */
+ struct {
+ struct k_delayed_work timer; /*!< Heartbeat Publication timer */
+
+ uint16_t dst; /*!< Destination address for Heartbeat messages */
+ uint16_t count; /*!< Number of Heartbeat messages to be sent */
+ uint8_t period; /*!< Period for sending Heartbeat messages */
+ uint8_t ttl; /*!< TTL to be used when sending Heartbeat messages */
+ uint16_t feature; /*!< Bit field indicating features that trigger Heartbeat messages when changed */
+ uint16_t net_idx; /*!< NetKey Index used by Heartbeat Publication */
+ } heartbeat_pub;
+
+ /** Heartbeat Subscription */
+ struct {
+ int64_t expiry; /*!< Timestamp when Heartbeat subscription period is expired */
+
+ uint16_t src; /*!< Source address for Heartbeat messages */
+ uint16_t dst; /*!< Destination address for Heartbeat messages */
+ uint16_t count; /*!< Number of Heartbeat messages received */
+ uint8_t min_hops; /*!< Minimum hops when receiving Heartbeat messages */
+ uint8_t max_hops; /*!< Maximum hops when receiving Heartbeat messages */
+
+ /** Optional heartbeat subscription tracking function */
+ esp_ble_mesh_cb_t heartbeat_recv_cb;
+ } heartbeat_sub;
+} esp_ble_mesh_cfg_srv_t;
+
+/** Parameters of Config Composition Data Get. */
+typedef struct {
+ uint8_t page; /*!< Page number of the Composition Data. */
+} esp_ble_mesh_cfg_composition_data_get_t;
+
+/** Parameters of Config Model Publication Get. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_pub_get_t;
+
+/** Parameters of Config SIG Model Subscription Get. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_id; /*!< The model id */
+} esp_ble_mesh_cfg_sig_model_sub_get_t;
+
+/** Parameters of Config Vendor Model Subscription Get. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_vnd_model_sub_get_t;
+
+/** Parameters of Config AppKey Get. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+} esp_ble_mesh_cfg_app_key_get_t;
+
+/** Parameters of Config Node Identity Get. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+} esp_ble_mesh_cfg_node_identity_get_t;
+
+/** Parameters of Config SIG Model App Get. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_id; /*!< The model id */
+} esp_ble_mesh_cfg_sig_model_app_get_t;
+
+/** Parameters of Config Vendor Model App Get. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_vnd_model_app_get_t;
+
+/** Parameters of Config Key Refresh Phase Get. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+} esp_ble_mesh_cfg_kr_phase_get_t;
+
+/** Parameters of Config Low Power Node PollTimeout Get. */
+typedef struct {
+ uint16_t lpn_addr; /*!< The unicast address of the Low Power node */
+} esp_ble_mesh_cfg_lpn_polltimeout_get_t;
+
+/** Parameters of Config Beacon Set. */
+typedef struct {
+ uint8_t beacon; /*!< New Secure Network Beacon state */
+} esp_ble_mesh_cfg_beacon_set_t;
+
+/** Parameters of Config Default TTL Set. */
+typedef struct {
+ uint8_t ttl; /*!< The default TTL state value */
+} esp_ble_mesh_cfg_default_ttl_set_t;
+
+/** Parameters of Config Friend Set. */
+typedef struct {
+ uint8_t friend_state; /*!< The friend state value */
+} esp_ble_mesh_cfg_friend_set_t;
+
+/** Parameters of Config GATT Proxy Set. */
+typedef struct {
+ uint8_t gatt_proxy; /*!< The GATT Proxy state value */
+} esp_ble_mesh_cfg_gatt_proxy_set_t;
+
+/** Parameters of Config Relay Set. */
+typedef struct {
+ uint8_t relay; /*!< The relay value */
+ uint8_t relay_retransmit; /*!< The relay retransmit value */
+} esp_ble_mesh_cfg_relay_set_t;
+
+/** Parameters of Config NetKey Add. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+ uint8_t net_key[16]; /*!< The network key value */
+} esp_ble_mesh_cfg_net_key_add_t;
+
+/** Parameters of Config AppKey Add. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+ uint16_t app_idx; /*!< The app key index */
+ uint8_t app_key[16]; /*!< The app key value */
+} esp_ble_mesh_cfg_app_key_add_t;
+
+/** Parameters of Config Model App Bind. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_app_idx; /*!< Index of the app key to bind with the model */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_app_bind_t;
+
+/** Parameters of Config Model Publication Set. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t publish_addr; /*!< Value of the publish address */
+ uint16_t publish_app_idx; /*!< Index of the application key */
+ bool cred_flag; /*!< Value of the Friendship Credential Flag */
+ uint8_t publish_ttl; /*!< Default TTL value for the publishing messages */
+ uint8_t publish_period; /*!< Period for periodic status publishing */
+ uint8_t publish_retransmit; /*!< Number of retransmissions and number of 50-millisecond steps between retransmissions */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_pub_set_t;
+
+/** Parameters of Config Model Subscription Add. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t sub_addr; /*!< The address to be added to the Subscription List */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_sub_add_t;
+
+/** Parameters of Config Model Subscription Delete. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t sub_addr; /*!< The address to be removed from the Subscription List */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_sub_delete_t;
+
+/** Parameters of Config Model Subscription Overwrite. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t sub_addr; /*!< The address to be added to the Subscription List */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_sub_overwrite_t;
+
+/** Parameters of Config Model Subscription Virtual Address Add. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint8_t label_uuid[16]; /*!< The Label UUID of the virtual address to be added to the Subscription List */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_sub_va_add_t;
+
+/** Parameters of Config Model Subscription Virtual Address Delete. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint8_t label_uuid[16]; /*!< The Label UUID of the virtual address to be removed from the Subscription List */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_sub_va_delete_t;
+
+/** Parameters of Config Model Subscription Virtual Address Overwrite. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint8_t label_uuid[16]; /*!< The Label UUID of the virtual address to be added to the Subscription List */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_sub_va_overwrite_t;
+
+/** Parameters of Config Model Publication Virtual Address Set. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint8_t label_uuid[16]; /*!< Value of the Label UUID publish address */
+ uint16_t publish_app_idx; /*!< Index of the application key */
+ bool cred_flag; /*!< Value of the Friendship Credential Flag */
+ uint8_t publish_ttl; /*!< Default TTL value for the publishing messages */
+ uint8_t publish_period; /*!< Period for periodic status publishing */
+ uint8_t publish_retransmit; /*!< Number of retransmissions and number of 50-millisecond steps between retransmissions */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_pub_va_set_t;
+
+/** Parameters of Config Model Subscription Delete All. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_sub_delete_all_t;
+
+/** Parameters of Config NetKey Update. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+ uint8_t net_key[16]; /*!< The network key value */
+} esp_ble_mesh_cfg_net_key_update_t;
+
+/** Parameters of Config NetKey Delete. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+} esp_ble_mesh_cfg_net_key_delete_t;
+
+/** Parameters of Config AppKey Update. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+ uint16_t app_idx; /*!< The app key index */
+ uint8_t app_key[16]; /*!< The app key value */
+} esp_ble_mesh_cfg_app_key_update_t;
+
+/** Parameters of Config AppKey Delete. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+ uint16_t app_idx; /*!< The app key index */
+} esp_ble_mesh_cfg_app_key_delete_t;
+
+/** Parameters of Config Node Identity Set. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+ uint8_t identity; /*!< New Node Identity state */
+} esp_ble_mesh_cfg_node_identity_set_t;
+
+/** Parameters of Config Model App Unbind. */
+typedef struct {
+ uint16_t element_addr; /*!< The element address */
+ uint16_t model_app_idx; /*!< Index of the app key to bind with the model */
+ uint16_t model_id; /*!< The model id */
+ uint16_t company_id; /*!< The company id, if not a vendor model, shall set to 0xFFFF */
+} esp_ble_mesh_cfg_model_app_unbind_t;
+
+/** Parameters of Config Key Refresh Phase Set. */
+typedef struct {
+ uint16_t net_idx; /*!< The network key index */
+ uint8_t transition; /*!< New Key Refresh Phase Transition */
+} esp_ble_mesh_cfg_kr_phase_set_t;
+
+/** Parameters of Config Network Transmit Set. */
+typedef struct {
+ uint8_t net_transmit; /*!< Network Transmit State */
+} esp_ble_mesh_cfg_net_transmit_set_t;
+
+/** Parameters of Config Model Heartbeat Publication Set. */
+typedef struct {
+ uint16_t dst; /*!< Destination address for Heartbeat messages */
+ uint8_t count; /*!< Number of Heartbeat messages to be sent */
+ uint8_t period; /*!< Period for sending Heartbeat messages */
+ uint8_t ttl; /*!< TTL to be used when sending Heartbeat messages */
+ uint16_t feature; /*!< Bit field indicating features that trigger Heartbeat messages when changed */
+ uint16_t net_idx; /*!< NetKey Index */
+} esp_ble_mesh_cfg_heartbeat_pub_set_t;
+
+/** Parameters of Config Model Heartbeat Subscription Set. */
+typedef struct {
+ uint16_t src; /*!< Source address for Heartbeat messages */
+ uint16_t dst; /*!< Destination address for Heartbeat messages */
+ uint8_t period; /*!< Period for receiving Heartbeat messages */
+} esp_ble_mesh_cfg_heartbeat_sub_set_t;
+
+/**
+ * @brief For ESP_BLE_MESH_MODEL_OP_BEACON_GET
+ * ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET
+ * ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_GET
+ * ESP_BLE_MESH_MODEL_OP_GATT_PROXY_GET
+ * ESP_BLE_MESH_MODEL_OP_RELAY_GET
+ * ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET
+ * ESP_BLE_MESH_MODEL_OP_FRIEND_GET
+ * ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_GET
+ * ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_GET
+ * the get_state parameter in the esp_ble_mesh_config_client_get_state function should not be set to NULL.
+ */
+typedef union {
+ esp_ble_mesh_cfg_model_pub_get_t model_pub_get; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET. */
+ esp_ble_mesh_cfg_composition_data_get_t comp_data_get; /*!< For ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET. */
+ esp_ble_mesh_cfg_sig_model_sub_get_t sig_model_sub_get; /*!< For ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_GET */
+ esp_ble_mesh_cfg_vnd_model_sub_get_t vnd_model_sub_get; /*!< For ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_GET */
+ esp_ble_mesh_cfg_app_key_get_t app_key_get; /*!< For ESP_BLE_MESH_MODEL_OP_APP_KEY_GET. */
+ esp_ble_mesh_cfg_node_identity_get_t node_identity_get; /*!< For ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_GET. */
+ esp_ble_mesh_cfg_sig_model_app_get_t sig_model_app_get; /*!< For ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_GET */
+ esp_ble_mesh_cfg_vnd_model_app_get_t vnd_model_app_get; /*!< For ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_GET */
+ esp_ble_mesh_cfg_kr_phase_get_t kr_phase_get; /*!< For ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET */
+ esp_ble_mesh_cfg_lpn_polltimeout_get_t lpn_pollto_get; /*!< For ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET */
+} esp_ble_mesh_cfg_client_get_state_t;
+
+/**
+ * @brief For ESP_BLE_MESH_MODEL_OP_BEACON_SET
+ * ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET
+ * ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET
+ * ESP_BLE_MESH_MODEL_OP_RELAY_SET
+ * ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET
+ * ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD
+ * ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADD
+ * ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE
+ * ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_DELETE
+ * ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE
+ * ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_OVERWRITE
+ * ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD
+ * ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD
+ * ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND
+ * ESP_BLE_MESH_MODEL_OP_NODE_RESET
+ * ESP_BLE_MESH_MODEL_OP_FRIEND_SET
+ * ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET
+ * ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET
+ * the set_state parameter in the esp_ble_mesh_config_client_set_state function should not be set to NULL.
+ */
+typedef union {
+ esp_ble_mesh_cfg_beacon_set_t beacon_set; /*!< For ESP_BLE_MESH_MODEL_OP_BEACON_SET */
+ esp_ble_mesh_cfg_default_ttl_set_t default_ttl_set; /*!< For ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET */
+ esp_ble_mesh_cfg_friend_set_t friend_set; /*!< For ESP_BLE_MESH_MODEL_OP_FRIEND_SET */
+ esp_ble_mesh_cfg_gatt_proxy_set_t gatt_proxy_set; /*!< For ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET */
+ esp_ble_mesh_cfg_relay_set_t relay_set; /*!< For ESP_BLE_MESH_MODEL_OP_RELAY_SET */
+ esp_ble_mesh_cfg_net_key_add_t net_key_add; /*!< For ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD */
+ esp_ble_mesh_cfg_app_key_add_t app_key_add; /*!< For ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD */
+ esp_ble_mesh_cfg_model_app_bind_t model_app_bind; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND */
+ esp_ble_mesh_cfg_model_pub_set_t model_pub_set; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET */
+ esp_ble_mesh_cfg_model_sub_add_t model_sub_add; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD */
+ esp_ble_mesh_cfg_model_sub_delete_t model_sub_delete; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE */
+ esp_ble_mesh_cfg_model_sub_overwrite_t model_sub_overwrite; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE */
+ esp_ble_mesh_cfg_model_sub_va_add_t model_sub_va_add; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADD */
+ esp_ble_mesh_cfg_model_sub_va_delete_t model_sub_va_delete; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_DELETE */
+ esp_ble_mesh_cfg_model_sub_va_overwrite_t model_sub_va_overwrite; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_OVERWRITE */
+ esp_ble_mesh_cfg_heartbeat_pub_set_t heartbeat_pub_set; /*!< For ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET */
+ esp_ble_mesh_cfg_heartbeat_sub_set_t heartbeat_sub_set; /*!< For ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET */
+ esp_ble_mesh_cfg_model_pub_va_set_t model_pub_va_set; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_PUB_VIRTUAL_ADDR_SET */
+ esp_ble_mesh_cfg_model_sub_delete_all_t model_sub_delete_all; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE_ALL */
+ esp_ble_mesh_cfg_net_key_update_t net_key_update; /*!< For ESP_BLE_MESH_MODEL_OP_NET_KEY_UPDATE */
+ esp_ble_mesh_cfg_net_key_delete_t net_key_delete; /*!< For ESP_BLE_MESH_MODEL_OP_NET_KEY_DELETE */
+ esp_ble_mesh_cfg_app_key_update_t app_key_update; /*!< For ESP_BLE_MESH_MODEL_OP_APP_KEY_UPDATE */
+ esp_ble_mesh_cfg_app_key_delete_t app_key_delete; /*!< For ESP_BLE_MESH_MODEL_OP_APP_KEY_DELETE */
+ esp_ble_mesh_cfg_node_identity_set_t node_identity_set; /*!< For ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_SET */
+ esp_ble_mesh_cfg_model_app_unbind_t model_app_unbind; /*!< For ESP_BLE_MESH_MODEL_OP_MODEL_APP_UNBIND */
+ esp_ble_mesh_cfg_kr_phase_set_t kr_phase_set; /*!< For ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_SET */
+ esp_ble_mesh_cfg_net_transmit_set_t net_transmit_set; /*!< For ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_SET */
+} esp_ble_mesh_cfg_client_set_state_t;
+
+/** Parameter of Config Beacon Status */
+typedef struct {
+ uint8_t beacon; /*!< Secure Network Beacon state value */
+} esp_ble_mesh_cfg_beacon_status_cb_t;
+
+/** Parameters of Config Composition Data Status */
+typedef struct {
+ uint8_t page; /*!< Page number of the Composition Data */
+ struct net_buf_simple *composition_data; /*!< Pointer to Composition Data for the identified page */
+} esp_ble_mesh_cfg_comp_data_status_cb_t;
+
+/** Parameter of Config Default TTL Status */
+typedef struct {
+ uint8_t default_ttl; /*!< Default TTL state value */
+} esp_ble_mesh_cfg_default_ttl_status_cb_t;
+
+/** Parameter of Config GATT Proxy Status */
+typedef struct {
+ uint8_t gatt_proxy; /*!< GATT Proxy state value */
+} esp_ble_mesh_cfg_gatt_proxy_status_cb_t;
+
+/** Parameters of Config Relay Status */
+typedef struct {
+ uint8_t relay; /*!< Relay state value */
+ uint8_t retransmit; /*!< Relay retransmit value(number of retransmissions and number of 10-millisecond steps between retransmissions) */
+} esp_ble_mesh_cfg_relay_status_cb_t;
+
+/** Parameters of Config Model Publication Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t element_addr; /*!< Address of the element */
+ uint16_t publish_addr; /*!< Value of the publish address */
+ uint16_t app_idx; /*!< Index of the application key */
+ bool cred_flag; /*!< Value of the Friendship Credential Flag */
+ uint8_t ttl; /*!< Default TTL value for the outgoing messages */
+ uint8_t period; /*!< Period for periodic status publishing */
+ uint8_t transmit; /*!< Number of retransmissions and number of 50-millisecond steps between retransmissions */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_cfg_model_pub_status_cb_t;
+
+/** Parameters of Config Model Subscription Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t element_addr; /*!< Address of the element */
+ uint16_t sub_addr; /*!< Value of the address */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_cfg_model_sub_status_cb_t;
+
+/** Parameters of Config NetKey Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t net_idx; /*!< Index of the NetKey */
+} esp_ble_mesh_cfg_net_key_status_cb_t;
+
+/** Parameters of Config AppKey Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t net_idx; /*!< Index of the NetKey */
+ uint16_t app_idx; /*!< Index of the application key */
+} esp_ble_mesh_cfg_app_key_status_cb_t;
+
+/** Parameters of Config Model App Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t element_addr; /*!< Address of the element */
+ uint16_t app_idx; /*!< Index of the application key */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_cfg_mod_app_status_cb_t;
+
+/** Parameter of Config Friend Status */
+typedef struct {
+ uint8_t friend_state; /*!< Friend state value */
+} esp_ble_mesh_cfg_friend_status_cb_t;
+
+/** Parameters of Config Heartbeat Publication Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t dst; /*!< Destination address for Heartbeat messages */
+ uint8_t count; /*!< Number of Heartbeat messages remaining to be sent */
+ uint8_t period; /*!< Period for sending Heartbeat messages */
+ uint8_t ttl; /*!< TTL to be used when sending Heartbeat messages */
+ uint16_t features; /*!< Features that trigger Heartbeat messages when changed */
+ uint16_t net_idx; /*!< Index of the NetKey */
+} esp_ble_mesh_cfg_hb_pub_status_cb_t;
+
+/** Parameters of Config Heartbeat Subscription Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t src; /*!< Source address for Heartbeat messages */
+ uint16_t dst; /*!< Destination address for Heartbeat messages */
+ uint8_t period; /*!< Remaining Period for processing Heartbeat messages */
+ uint8_t count; /*!< Number of Heartbeat messages received */
+ uint8_t min_hops; /*!< Minimum hops when receiving Heartbeat messages */
+ uint8_t max_hops; /*!< Maximum hops when receiving Heartbeat messages */
+} esp_ble_mesh_cfg_hb_sub_status_cb_t;
+
+/** Parameters of Config Network Transmit Status */
+typedef struct {
+ uint8_t net_trans_count: 3; /*!< Number of transmissions for each Network PDU originating from the node */
+ uint8_t net_trans_step : 5; /*!< Maximum hops when receiving Heartbeat messages */
+} esp_ble_mesh_cfg_net_trans_status_cb_t;
+
+/** Parameters of Config SIG/Vendor Subscription List */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t element_addr; /*!< Address of the element */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+ struct net_buf_simple *sub_addr; /*!< A block of all addresses from the Subscription List */
+} esp_ble_mesh_cfg_model_sub_list_cb_t;
+
+/** Parameter of Config NetKey List */
+typedef struct {
+ struct net_buf_simple *net_idx; /*!< A list of NetKey Indexes known to the node */
+} esp_ble_mesh_cfg_net_key_list_cb_t;
+
+/** Parameters of Config AppKey List */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t net_idx; /*!< NetKey Index of the NetKey that the AppKeys are bound to */
+ struct net_buf_simple *app_idx; /*!< A list of AppKey indexes that are bound to the NetKey identified by NetKeyIndex */
+} esp_ble_mesh_cfg_app_key_list_cb_t;
+
+/** Parameters of Config Node Identity Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t net_idx; /*!< Index of the NetKey */
+ uint8_t identity; /*!< Node Identity state */
+} esp_ble_mesh_cfg_node_id_status_cb_t;
+
+/** Parameters of Config SIG/Vendor Model App List */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t element_addr; /*!< Address of the element */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+ struct net_buf_simple *app_idx; /*!< All AppKey indexes bound to the Model */
+} esp_ble_mesh_cfg_model_app_list_cb_t;
+
+/** Parameters of Config Key Refresh Phase Status */
+typedef struct {
+ uint8_t status; /*!< Status Code for the request message */
+ uint16_t net_idx; /*!< Index of the NetKey */
+ uint8_t phase; /*!< Key Refresh Phase state */
+} esp_ble_mesh_cfg_kr_phase_status_cb_t;
+
+/** Parameters of Config Low Power Node PollTimeout Status */
+typedef struct {
+ uint16_t lpn_addr; /*!< The unicast address of the Low Power node */
+ int32_t poll_timeout; /*!< The current value of the PollTimeout timer of the Low Power node */
+} esp_ble_mesh_cfg_lpn_pollto_status_cb_t;
+
+/**
+ * @brief Configuration Client Model received message union
+ */
+typedef union {
+ esp_ble_mesh_cfg_beacon_status_cb_t beacon_status; /*!< The beacon status value */
+ esp_ble_mesh_cfg_comp_data_status_cb_t comp_data_status; /*!< The composition data status value */
+ esp_ble_mesh_cfg_default_ttl_status_cb_t default_ttl_status; /*!< The default_ttl status value */
+ esp_ble_mesh_cfg_gatt_proxy_status_cb_t gatt_proxy_status; /*!< The gatt_proxy status value */
+ esp_ble_mesh_cfg_relay_status_cb_t relay_status; /*!< The relay status value */
+ esp_ble_mesh_cfg_model_pub_status_cb_t model_pub_status; /*!< The model publication status value */
+ esp_ble_mesh_cfg_model_sub_status_cb_t model_sub_status; /*!< The model subscription status value */
+ esp_ble_mesh_cfg_net_key_status_cb_t netkey_status; /*!< The netkey status value */
+ esp_ble_mesh_cfg_app_key_status_cb_t appkey_status; /*!< The appkey status value */
+ esp_ble_mesh_cfg_mod_app_status_cb_t model_app_status; /*!< The model app status value */
+ esp_ble_mesh_cfg_friend_status_cb_t friend_status; /*!< The friend status value */
+ esp_ble_mesh_cfg_hb_pub_status_cb_t heartbeat_pub_status; /*!< The heartbeat publication status value */
+ esp_ble_mesh_cfg_hb_sub_status_cb_t heartbeat_sub_status; /*!< The heartbeat subscription status value */
+ esp_ble_mesh_cfg_net_trans_status_cb_t net_transmit_status; /*!< The network transmit status value */
+ esp_ble_mesh_cfg_model_sub_list_cb_t model_sub_list; /*!< The model subscription list value */
+ esp_ble_mesh_cfg_net_key_list_cb_t netkey_list; /*!< The network key index list value */
+ esp_ble_mesh_cfg_app_key_list_cb_t appkey_list; /*!< The application key index list value */
+ esp_ble_mesh_cfg_node_id_status_cb_t node_identity_status; /*!< The node identity status value */
+ esp_ble_mesh_cfg_model_app_list_cb_t model_app_list; /*!< The model application key index list value */
+ esp_ble_mesh_cfg_kr_phase_status_cb_t kr_phase_status; /*!< The key refresh phase status value */
+ esp_ble_mesh_cfg_lpn_pollto_status_cb_t lpn_timeout_status; /*!< The low power node poll timeout status value */
+} esp_ble_mesh_cfg_client_common_cb_param_t;
+
+/** Configuration Client Model callback parameters */
+typedef struct {
+ int error_code; /*!< Appropriate error code */
+ esp_ble_mesh_client_common_param_t *params; /*!< The client common parameters */
+ esp_ble_mesh_cfg_client_common_cb_param_t status_cb; /*!< The config status message callback values */
+} esp_ble_mesh_cfg_client_cb_param_t;
+
+/** This enum value is the event of Configuration Client Model */
+typedef enum {
+ ESP_BLE_MESH_CFG_CLIENT_GET_STATE_EVT,
+ ESP_BLE_MESH_CFG_CLIENT_SET_STATE_EVT,
+ ESP_BLE_MESH_CFG_CLIENT_PUBLISH_EVT,
+ ESP_BLE_MESH_CFG_CLIENT_TIMEOUT_EVT,
+ ESP_BLE_MESH_CFG_CLIENT_EVT_MAX,
+} esp_ble_mesh_cfg_client_cb_event_t;
+
+/**
+ * @brief Configuration Server model related context.
+ */
+
+/** Parameters of Config Model Publication Set */
+typedef struct {
+ uint16_t element_addr; /*!< Element Address */
+ uint16_t pub_addr; /*!< Publish Address */
+ uint16_t app_idx; /*!< AppKey Index */
+ bool cred_flag; /*!< Friendship Credential Flag */
+ uint8_t pub_ttl; /*!< Publish TTL */
+ uint8_t pub_period; /*!< Publish Period */
+ uint8_t pub_retransmit; /*!< Publish Retransmit */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_state_change_cfg_mod_pub_set_t;
+
+/** Parameters of Config Model Publication Virtual Address Set */
+typedef struct {
+ uint16_t element_addr; /*!< Element Address */
+ uint8_t label_uuid[16]; /*!< Label UUID */
+ uint16_t app_idx; /*!< AppKey Index */
+ bool cred_flag; /*!< Friendship Credential Flag */
+ uint8_t pub_ttl; /*!< Publish TTL */
+ uint8_t pub_period; /*!< Publish Period */
+ uint8_t pub_retransmit; /*!< Publish Retransmit */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_state_change_cfg_mod_pub_va_set_t;
+
+/** Parameters of Config Model Subscription Add */
+typedef struct {
+ uint16_t element_addr; /*!< Element Address */
+ uint16_t sub_addr; /*!< Subscription Address */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_state_change_cfg_model_sub_add_t;
+
+/** Parameters of Config Model Subscription Delete */
+typedef struct {
+ uint16_t element_addr; /*!< Element Address */
+ uint16_t sub_addr; /*!< Subscription Address */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_state_change_cfg_model_sub_delete_t;
+
+/** Parameters of Config NetKey Add */
+typedef struct {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint8_t net_key[16]; /*!< NetKey */
+} esp_ble_mesh_state_change_cfg_netkey_add_t;
+
+/** Parameters of Config NetKey Update */
+typedef struct {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint8_t net_key[16]; /*!< NetKey */
+} esp_ble_mesh_state_change_cfg_netkey_update_t;
+
+/** Parameter of Config NetKey Delete */
+typedef struct {
+ uint16_t net_idx; /*!< NetKey Index */
+} esp_ble_mesh_state_change_cfg_netkey_delete_t;
+
+/** Parameters of Config AppKey Add */
+typedef struct {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint16_t app_idx; /*!< AppKey Index */
+ uint8_t app_key[16]; /*!< AppKey */
+} esp_ble_mesh_state_change_cfg_appkey_add_t;
+
+/** Parameters of Config AppKey Update */
+typedef struct {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint16_t app_idx; /*!< AppKey Index */
+ uint8_t app_key[16]; /*!< AppKey */
+} esp_ble_mesh_state_change_cfg_appkey_update_t;
+
+/** Parameters of Config AppKey Delete */
+typedef struct {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint16_t app_idx; /*!< AppKey Index */
+} esp_ble_mesh_state_change_cfg_appkey_delete_t;
+
+/** Parameters of Config Model App Bind */
+typedef struct {
+ uint16_t element_addr; /*!< Element Address */
+ uint16_t app_idx; /*!< AppKey Index */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_state_change_cfg_model_app_bind_t;
+
+/** Parameters of Config Model App Unbind */
+typedef struct {
+ uint16_t element_addr; /*!< Element Address */
+ uint16_t app_idx; /*!< AppKey Index */
+ uint16_t company_id; /*!< Company ID */
+ uint16_t model_id; /*!< Model ID */
+} esp_ble_mesh_state_change_cfg_model_app_unbind_t;
+
+/** Parameters of Config Key Refresh Phase Set */
+typedef struct {
+ uint16_t net_idx; /*!< NetKey Index */
+ uint8_t kr_phase; /*!< New Key Refresh Phase Transition */
+} esp_ble_mesh_state_change_cfg_kr_phase_set_t;
+
+/**
+ * @brief Configuration Server model state change value union
+ */
+typedef union {
+ /**
+ * The recv_op in ctx can be used to decide which state is changed.
+ */
+ esp_ble_mesh_state_change_cfg_mod_pub_set_t mod_pub_set; /*!< Config Model Publication Set */
+ esp_ble_mesh_state_change_cfg_mod_pub_va_set_t mod_pub_va_set; /*!< Config Model Publication Virtual Address Set */
+ esp_ble_mesh_state_change_cfg_model_sub_add_t mod_sub_add; /*!< Config Model Subscription Add */
+ esp_ble_mesh_state_change_cfg_model_sub_delete_t mod_sub_delete; /*!< Config Model Subscription Delete */
+ esp_ble_mesh_state_change_cfg_netkey_add_t netkey_add; /*!< Config NetKey Add */
+ esp_ble_mesh_state_change_cfg_netkey_update_t netkey_update; /*!< Config NetKey Update */
+ esp_ble_mesh_state_change_cfg_netkey_delete_t netkey_delete; /*!< Config NetKey Delete */
+ esp_ble_mesh_state_change_cfg_appkey_add_t appkey_add; /*!< Config AppKey Add */
+ esp_ble_mesh_state_change_cfg_appkey_update_t appkey_update; /*!< Config AppKey Update */
+ esp_ble_mesh_state_change_cfg_appkey_delete_t appkey_delete; /*!< Config AppKey Delete */
+ esp_ble_mesh_state_change_cfg_model_app_bind_t mod_app_bind; /*!< Config Model App Bind */
+ esp_ble_mesh_state_change_cfg_model_app_unbind_t mod_app_unbind; /*!< Config Model App Unbind */
+ esp_ble_mesh_state_change_cfg_kr_phase_set_t kr_phase_set; /*!< Config Key Refresh Phase Set */
+} esp_ble_mesh_cfg_server_state_change_t;
+
+/**
+ * @brief Configuration Server model callback value union
+ */
+typedef union {
+ esp_ble_mesh_cfg_server_state_change_t state_change; /*!< ESP_BLE_MESH_CFG_SERVER_STATE_CHANGE_EVT */
+} esp_ble_mesh_cfg_server_cb_value_t;
+
+/** Configuration Server model callback parameters */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the server model structure */
+ esp_ble_mesh_msg_ctx_t ctx; /*!< Context of the received message */
+ esp_ble_mesh_cfg_server_cb_value_t value; /*!< Value of the received configuration messages */
+} esp_ble_mesh_cfg_server_cb_param_t;
+
+/** This enum value is the event of Configuration Server model */
+typedef enum {
+ ESP_BLE_MESH_CFG_SERVER_STATE_CHANGE_EVT,
+ ESP_BLE_MESH_CFG_SERVER_EVT_MAX,
+} esp_ble_mesh_cfg_server_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Config Client and Server Model functions.
+ */
+
+/**
+ * @brief Configuration Client Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_cfg_client_cb_t)(esp_ble_mesh_cfg_client_cb_event_t event,
+ esp_ble_mesh_cfg_client_cb_param_t *param);
+
+/**
+ * @brief Configuration Server Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_cfg_server_cb_t)(esp_ble_mesh_cfg_server_cb_event_t event,
+ esp_ble_mesh_cfg_server_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Config Client Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_config_client_callback(esp_ble_mesh_cfg_client_cb_t callback);
+
+/**
+ * @brief Register BLE Mesh Config Server Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_config_server_callback(esp_ble_mesh_cfg_server_cb_t callback);
+
+/**
+ * @brief Get the value of Config Server Model states using the Config Client Model get messages.
+ *
+ * @note If you want to find the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_opcode_config_client_get_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] get_state: Pointer to a union, each kind of opcode corresponds to one structure inside.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_cfg_client_get_state_t *get_state);
+
+/**
+ * @brief Set the value of the Configuration Server Model states using the Config Client Model set messages.
+ *
+ * @note If you want to find the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_opcode_config_client_set_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] set_state: Pointer to a union, each kind of opcode corresponds to one structure inside.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_cfg_client_set_state_t *set_state);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_CONFIG_MODEL_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_generic_model_api.h b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_generic_model_api.h
new file mode 100644
index 00000000..fc4808af
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_generic_model_api.h
@@ -0,0 +1,1296 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/** @file
+ * @brief Bluetooth Mesh Generic Client Model APIs.
+ */
+
+#ifndef _ESP_BLE_MESH_GENERIC_MODEL_API_H_
+#define _ESP_BLE_MESH_GENERIC_MODEL_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @def ESP_BLE_MESH_MODEL_GEN_ONOFF_CLI
+ *
+ * @brief Define a new Generic OnOff Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic OnOff Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic OnOff Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_ONOFF_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_LEVEL_CLI
+ *
+ * @brief Define a new Generic Level Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic Level Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic Level Client Model instance.
+ */
+
+#define ESP_BLE_MESH_MODEL_GEN_LEVEL_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_DEF_TRANS_TIME_CLI
+ *
+ * @brief Define a new Generic Default Transition Time Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic Default Transition
+ * Time Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic Default Transition Time Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_DEF_TRANS_TIME_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_POWER_ONOFF_CLI
+ *
+ * @brief Define a new Generic Power OnOff Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic Power OnOff Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic Power OnOff Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_POWER_ONOFF_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_CLI
+ *
+ * @brief Define a new Generic Power Level Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic Power Level Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic Power Level Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_BATTERY_CLI
+ *
+ * @brief Define a new Generic Battery Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic Battery Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic Battery Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_BATTERY_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_LOCATION_CLI
+ *
+ * @brief Define a new Generic Location Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic Location Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic Location Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_LOCATION_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_PROPERTY_CLI
+ *
+ * @brief Define a new Generic Property Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Generic Property Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Generic Location Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_PROPERTY_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_PROP_CLI, \
+ NULL, cli_pub, cli_data)
+
+/**
+ * @brief Bluetooth Mesh Generic Client Model Get and Set parameters structure.
+ */
+
+/** Parameters of Generic OnOff Set. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint8_t onoff; /*!< Target value of Generic OnOff state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_gen_onoff_set_t;
+
+/** Parameters of Generic Level Set. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ int16_t level; /*!< Target value of Generic Level state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_gen_level_set_t;
+
+/** Parameters of Generic Delta Set. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ int32_t level; /*!< Delta change of Generic Level state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_gen_delta_set_t;
+
+/** Parameters of Generic Move Set. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ int16_t delta_level; /*!< Delta Level step to calculate Move speed for Generic Level state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_gen_move_set_t;
+
+/** Parameter of Generic Default Transition Time Set. */
+typedef struct {
+ uint8_t trans_time; /*!< The value of the Generic Default Transition Time state */
+} esp_ble_mesh_gen_def_trans_time_set_t;
+
+/** Parameter of Generic OnPowerUp Set. */
+typedef struct {
+ uint8_t onpowerup; /*!< The value of the Generic OnPowerUp state */
+} esp_ble_mesh_gen_onpowerup_set_t;
+
+/** Parameters of Generic Power Level Set. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t power; /*!< Target value of Generic Power Actual state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_gen_power_level_set_t;
+
+/** Parameter of Generic Power Default Set. */
+typedef struct {
+ uint16_t power; /*!< The value of the Generic Power Default state */
+} esp_ble_mesh_gen_power_default_set_t;
+
+/** Parameters of Generic Power Range Set. */
+typedef struct {
+ uint16_t range_min; /*!< Value of Range Min field of Generic Power Range state */
+ uint16_t range_max; /*!< Value of Range Max field of Generic Power Range state */
+} esp_ble_mesh_gen_power_range_set_t;
+
+/** Parameters of Generic Location Global Set. */
+typedef struct {
+ int32_t global_latitude; /*!< Global Coordinates (Latitude) */
+ int32_t global_longitude; /*!< Global Coordinates (Longitude) */
+ int16_t global_altitude; /*!< Global Altitude */
+} esp_ble_mesh_gen_loc_global_set_t;
+
+/** Parameters of Generic Location Local Set. */
+typedef struct {
+ int16_t local_north; /*!< Local Coordinates (North) */
+ int16_t local_east; /*!< Local Coordinates (East) */
+ int16_t local_altitude; /*!< Local Altitude */
+ uint8_t floor_number; /*!< Floor Number */
+ uint16_t uncertainty; /*!< Uncertainty */
+} esp_ble_mesh_gen_loc_local_set_t;
+
+/** Parameter of Generic User Property Get. */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic User Property */
+} esp_ble_mesh_gen_user_property_get_t;
+
+/** Parameters of Generic User Property Set. */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic User Property */
+ struct net_buf_simple *property_value; /*!< Raw value for the User Property */
+} esp_ble_mesh_gen_user_property_set_t;
+
+/** Parameter of Generic Admin Property Get. */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Admin Property */
+} esp_ble_mesh_gen_admin_property_get_t;
+
+/** Parameters of Generic Admin Property Set. */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Admin Property */
+ uint8_t user_access; /*!< Enumeration indicating user access */
+ struct net_buf_simple *property_value; /*!< Raw value for the Admin Property */
+} esp_ble_mesh_gen_admin_property_set_t;
+
+/** Parameter of Generic Manufacturer Property Get. */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Manufacturer Property */
+} esp_ble_mesh_gen_manufacturer_property_get_t;
+
+/** Parameters of Generic Manufacturer Property Set. */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Manufacturer Property */
+ uint8_t user_access; /*!< Enumeration indicating user access */
+} esp_ble_mesh_gen_manufacturer_property_set_t;
+
+/** Parameter of Generic Client Properties Get. */
+typedef struct {
+ uint16_t property_id; /*!< A starting Client Property ID present within an element */
+} esp_ble_mesh_gen_client_properties_get_t;
+
+/**
+ * @brief Generic Client Model get message union
+ */
+typedef union {
+ esp_ble_mesh_gen_user_property_get_t user_property_get; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_GET */
+ esp_ble_mesh_gen_admin_property_get_t admin_property_get; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_GET*/
+ esp_ble_mesh_gen_manufacturer_property_get_t manufacturer_property_get; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET */
+ esp_ble_mesh_gen_client_properties_get_t client_properties_get; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_GET */
+} esp_ble_mesh_generic_client_get_state_t;
+
+/**
+ * @brief Generic Client Model set message union
+ */
+typedef union {
+ esp_ble_mesh_gen_onoff_set_t onoff_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET & ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_SET_UNACK */
+ esp_ble_mesh_gen_level_set_t level_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET & ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_SET_UNACK */
+ esp_ble_mesh_gen_delta_set_t delta_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET & ESP_BLE_MESH_MODEL_OP_GEN_DELTA_SET_UNACK */
+ esp_ble_mesh_gen_move_set_t move_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET & ESP_BLE_MESH_MODEL_OP_GEN_MOVE_SET_UNACK */
+ esp_ble_mesh_gen_def_trans_time_set_t def_trans_time_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET & ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_SET_UNACK */
+ esp_ble_mesh_gen_onpowerup_set_t power_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET & ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_SET_UNACK */
+ esp_ble_mesh_gen_power_level_set_t power_level_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET & ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_SET_UNACK */
+ esp_ble_mesh_gen_power_default_set_t power_default_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_SET_UNACK */
+ esp_ble_mesh_gen_power_range_set_t power_range_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET & ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_SET_UNACK */
+ esp_ble_mesh_gen_loc_global_set_t loc_global_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET & ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_SET_UNACK */
+ esp_ble_mesh_gen_loc_local_set_t loc_local_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET & ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_SET_UNACK */
+ esp_ble_mesh_gen_user_property_set_t user_property_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_SET_UNACK */
+ esp_ble_mesh_gen_admin_property_set_t admin_property_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_SET_UNACK */
+ esp_ble_mesh_gen_manufacturer_property_set_t manufacturer_property_set; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_SET_UNACK */
+} esp_ble_mesh_generic_client_set_state_t;
+
+/**
+ * @brief Bluetooth Mesh Generic Client Model Get and Set callback parameters structure.
+ */
+
+/** Parameters of Generic OnOff Status. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint8_t present_onoff; /*!< Current value of Generic OnOff state */
+ uint8_t target_onoff; /*!< Target value of Generic OnOff state (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_gen_onoff_status_cb_t;
+
+/** Parameters of Generic Level Status. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ int16_t present_level; /*!< Current value of Generic Level state */
+ int16_t target_level; /*!< Target value of the Generic Level state (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_gen_level_status_cb_t;
+
+/** Parameter of Generic Default Transition Time Status. */
+typedef struct {
+ uint8_t trans_time; /*!< The value of the Generic Default Transition Time state */
+} esp_ble_mesh_gen_def_trans_time_status_cb_t;
+
+/** Parameter of Generic OnPowerUp Status. */
+typedef struct {
+ uint8_t onpowerup; /*!< The value of the Generic OnPowerUp state */
+} esp_ble_mesh_gen_onpowerup_status_cb_t;
+
+/** Parameters of Generic Power Level Status. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t present_power; /*!< Current value of Generic Power Actual state */
+ uint16_t target_power; /*!< Target value of Generic Power Actual state (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_gen_power_level_status_cb_t;
+
+/** Parameter of Generic Power Last Status. */
+typedef struct {
+ uint16_t power; /*!< The value of the Generic Power Last state */
+} esp_ble_mesh_gen_power_last_status_cb_t;
+
+/** Parameter of Generic Power Default Status. */
+typedef struct {
+ uint16_t power; /*!< The value of the Generic Default Last state */
+} esp_ble_mesh_gen_power_default_status_cb_t;
+
+/** Parameters of Generic Power Range Status. */
+typedef struct {
+ uint8_t status_code; /*!< Status Code for the request message */
+ uint16_t range_min; /*!< Value of Range Min field of Generic Power Range state */
+ uint16_t range_max; /*!< Value of Range Max field of Generic Power Range state */
+} esp_ble_mesh_gen_power_range_status_cb_t;
+
+/** Parameters of Generic Battery Status. */
+typedef struct {
+ uint32_t battery_level : 8; /*!< Value of Generic Battery Level state */
+ uint32_t time_to_discharge : 24; /*!< Value of Generic Battery Time to Discharge state */
+ uint32_t time_to_charge : 24; /*!< Value of Generic Battery Time to Charge state */
+ uint32_t flags : 8; /*!< Value of Generic Battery Flags state */
+} esp_ble_mesh_gen_battery_status_cb_t;
+
+/** Parameters of Generic Location Global Status. */
+typedef struct {
+ int32_t global_latitude; /*!< Global Coordinates (Latitude) */
+ int32_t global_longitude; /*!< Global Coordinates (Longitude) */
+ int16_t global_altitude; /*!< Global Altitude */
+} esp_ble_mesh_gen_loc_global_status_cb_t;
+
+/** Parameters of Generic Location Local Status. */
+typedef struct {
+ int16_t local_north; /*!< Local Coordinates (North) */
+ int16_t local_east; /*!< Local Coordinates (East) */
+ int16_t local_altitude; /*!< Local Altitude */
+ uint8_t floor_number; /*!< Floor Number */
+ uint16_t uncertainty; /*!< Uncertainty */
+} esp_ble_mesh_gen_loc_local_status_cb_t;
+
+/** Parameter of Generic User Properties Status. */
+typedef struct {
+ struct net_buf_simple *property_ids; /*!< Buffer contains a sequence of N User Property IDs */
+} esp_ble_mesh_gen_user_properties_status_cb_t;
+
+/** Parameters of Generic User Property Status. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property ID identifying a Generic User Property */
+ uint8_t user_access; /*!< Enumeration indicating user access (optional) */
+ struct net_buf_simple *property_value; /*!< Raw value for the User Property (C.1) */
+} esp_ble_mesh_gen_user_property_status_cb_t;
+
+/** Parameter of Generic Admin Properties Status. */
+typedef struct {
+ struct net_buf_simple *property_ids; /*!< Buffer contains a sequence of N Admin Property IDs */
+} esp_ble_mesh_gen_admin_properties_status_cb_t;
+
+/** Parameters of Generic Admin Property Status. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property ID identifying a Generic Admin Property */
+ uint8_t user_access; /*!< Enumeration indicating user access (optional) */
+ struct net_buf_simple *property_value; /*!< Raw value for the Admin Property (C.1) */
+} esp_ble_mesh_gen_admin_property_status_cb_t;
+
+/** Parameter of Generic Manufacturer Properties Status. */
+typedef struct {
+ struct net_buf_simple *property_ids; /*!< Buffer contains a sequence of N Manufacturer Property IDs */
+} esp_ble_mesh_gen_manufacturer_properties_status_cb_t;
+
+/** Parameters of Generic Manufacturer Property Status. */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property ID identifying a Generic Manufacturer Property */
+ uint8_t user_access; /*!< Enumeration indicating user access (optional) */
+ struct net_buf_simple *property_value; /*!< Raw value for the Manufacturer Property (C.1) */
+} esp_ble_mesh_gen_manufacturer_property_status_cb_t;
+
+/** Parameter of Generic Client Properties Status. */
+typedef struct {
+ struct net_buf_simple *property_ids; /*!< Buffer contains a sequence of N Client Property IDs */
+} esp_ble_mesh_gen_client_properties_status_cb_t;
+
+/**
+ * @brief Generic Client Model received message union
+ */
+typedef union {
+ esp_ble_mesh_gen_onoff_status_cb_t onoff_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_ONOFF_STATUS */
+ esp_ble_mesh_gen_level_status_cb_t level_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_LEVEL_STATUS */
+ esp_ble_mesh_gen_def_trans_time_status_cb_t def_trans_time_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_DEF_TRANS_TIME_STATUS */
+ esp_ble_mesh_gen_onpowerup_status_cb_t onpowerup_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_ONPOWERUP_STATUS */
+ esp_ble_mesh_gen_power_level_status_cb_t power_level_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS */
+ esp_ble_mesh_gen_power_last_status_cb_t power_last_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_POWER_LAST_STATUS */
+ esp_ble_mesh_gen_power_default_status_cb_t power_default_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_POWER_DEFAULT_STATUS */
+ esp_ble_mesh_gen_power_range_status_cb_t power_range_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_POWER_RANGE_STATUS */
+ esp_ble_mesh_gen_battery_status_cb_t battery_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_BATTERY_STATUS */
+ esp_ble_mesh_gen_loc_global_status_cb_t location_global_status; /*!< For ESP_BLE_MESH_MODEL_OP_GEN_LOC_GLOBAL_STATUS */
+ esp_ble_mesh_gen_loc_local_status_cb_t location_local_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_LOC_LOCAL_STATUS */
+ esp_ble_mesh_gen_user_properties_status_cb_t user_properties_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTIES_STATUS */
+ esp_ble_mesh_gen_user_property_status_cb_t user_property_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_USER_PROPERTY_STATUS */
+ esp_ble_mesh_gen_admin_properties_status_cb_t admin_properties_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTIES_STATUS */
+ esp_ble_mesh_gen_admin_property_status_cb_t admin_property_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_ADMIN_PROPERTY_STATUS */
+ esp_ble_mesh_gen_manufacturer_properties_status_cb_t manufacturer_properties_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTIES_STATUS */
+ esp_ble_mesh_gen_manufacturer_property_status_cb_t manufacturer_property_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_MANUFACTURER_PROPERTY_STATUS */
+ esp_ble_mesh_gen_client_properties_status_cb_t client_properties_status; /*!< ESP_BLE_MESH_MODEL_OP_GEN_CLIENT_PROPERTIES_STATUS */
+} esp_ble_mesh_gen_client_status_cb_t;
+
+/** Generic Client Model callback parameters */
+typedef struct {
+ int error_code; /*!< Appropriate error code */
+ esp_ble_mesh_client_common_param_t *params; /*!< The client common parameters. */
+ esp_ble_mesh_gen_client_status_cb_t status_cb; /*!< The generic status message callback values */
+} esp_ble_mesh_generic_client_cb_param_t;
+
+/** This enum value is the event of Generic Client Model */
+typedef enum {
+ ESP_BLE_MESH_GENERIC_CLIENT_GET_STATE_EVT,
+ ESP_BLE_MESH_GENERIC_CLIENT_SET_STATE_EVT,
+ ESP_BLE_MESH_GENERIC_CLIENT_PUBLISH_EVT,
+ ESP_BLE_MESH_GENERIC_CLIENT_TIMEOUT_EVT,
+ ESP_BLE_MESH_GENERIC_CLIENT_EVT_MAX,
+} esp_ble_mesh_generic_client_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Generic Client Model function.
+ */
+
+/**
+ * @brief Generic Client Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_generic_client_cb_t)(esp_ble_mesh_generic_client_cb_event_t event,
+ esp_ble_mesh_generic_client_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Generic Client Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_generic_client_callback(esp_ble_mesh_generic_client_cb_t callback);
+
+/**
+ * @brief Get the value of Generic Server Model states using the Generic Client Model get messages.
+ *
+ * @note If you want to find the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_generic_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] get_state: Pointer to generic get message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_generic_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_generic_client_get_state_t *get_state);
+
+/**
+ * @brief Set the value of Generic Server Model states using the Generic Client Model set messages.
+ *
+ * @note If you want to find the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_generic_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] set_state: Pointer to generic set message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_generic_client_set_state_t *set_state);
+
+/**
+ * @brief Generic Server Models related context.
+ */
+
+/** @def ESP_BLE_MESH_MODEL_GEN_ONOFF_SRV
+ *
+ * @brief Define a new Generic OnOff Server Model.
+ *
+ * @note 1. The Generic OnOff Server Model is a root model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_onoff_srv_t.
+ *
+ * @return New Generic OnOff Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_ONOFF_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_ONOFF_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_LEVEL_SRV
+ *
+ * @brief Define a new Generic Level Server Model.
+ *
+ * @note 1. The Generic Level Server Model is a root model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_level_srv_t.
+ *
+ * @return New Generic Level Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_LEVEL_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_LEVEL_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_DEF_TRANS_TIME_SRV
+ *
+ * @brief Define a new Generic Default Transition Time Server Model.
+ *
+ * @note 1. The Generic Default Transition Time Server Model is a root model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_def_trans_time_srv_t.
+ *
+ * @return New Generic Default Transition Time Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_DEF_TRANS_TIME_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_POWER_ONOFF_SRV
+ *
+ * @brief Define a new Generic Power OnOff Server Model.
+ *
+ * @note 1. The Generic Power OnOff Server model extends the Generic OnOff Server
+ * model. When this model is present on an element, the corresponding
+ * Generic Power OnOff Setup Server model shall also be present.
+ * 2. This model may be used to represent a variety of devices that do not
+ * fit any of the model descriptions that have been defined but support
+ * the generic properties of On/Off.
+ * 3. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_power_onoff_srv_t.
+ *
+ * @return New Generic Power OnOff Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_POWER_ONOFF_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_POWER_ONOFF_SETUP_SRV
+ *
+ * @brief Define a new Generic Power OnOff Setup Server Model.
+ *
+ * @note 1. The Generic Power OnOff Setup Server model extends the Generic Power
+ * OnOff Server model and the Generic Default Transition Time Server model.
+ * 2. This model shall support model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_power_onoff_setup_srv_t.
+ *
+ * @return New Generic Power OnOff Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_POWER_ONOFF_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_SRV
+ *
+ * @brief Define a new Generic Power Level Server Model.
+ *
+ * @note 1. The Generic Power Level Server model extends the Generic Power OnOff
+ * Server model and the Generic Level Server model. When this model is
+ * present on an Element, the corresponding Generic Power Level Setup
+ * Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_power_level_srv_t.
+ *
+ * @return New Generic Power Level Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_SETUP_SRV
+ *
+ * @brief Define a new Generic Power Level Setup Server Model.
+ *
+ * @note 1. The Generic Power Level Setup Server model extends the Generic Power
+ * Level Server model and the Generic Power OnOff Setup Server model.
+ * 2. This model shall support model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_power_level_setup_srv_t.
+ *
+ * @return New Generic Power Level Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_POWER_LEVEL_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_BATTERY_SRV
+ *
+ * @brief Define a new Generic Battery Server Model.
+ *
+ * @note 1. The Generic Battery Server Model is a root model.
+ * 2. This model shall support model publication and model subscription.
+ * 3. The model may be used to represent an element that is powered by a battery.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_battery_srv_t.
+ *
+ * @return New Generic Battery Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_BATTERY_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_BATTERY_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_LOCATION_SRV
+ *
+ * @brief Define a new Generic Location Server Model.
+ *
+ * @note 1. The Generic Location Server model is a root model. When this model
+ * is present on an Element, the corresponding Generic Location Setup
+ * Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ * 3. The model may be used to represent an element that knows its
+ * location (global or local).
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_location_srv_t.
+ *
+ * @return New Generic Location Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_LOCATION_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_LOCATION_SETUP_SRV
+ *
+ * @brief Define a new Generic Location Setup Server Model.
+ *
+ * @note 1. The Generic Location Setup Server model extends the Generic Location
+ * Server model.
+ * 2. This model shall support model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_location_setup_srv_t.
+ *
+ * @return New Generic Location Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_LOCATION_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_LOCATION_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_USER_PROP_SRV
+ *
+ * @brief Define a new Generic User Property Server Model.
+ *
+ * @note 1. The Generic User Property Server model is a root model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_user_prop_srv_t.
+ *
+ * @return New Generic User Property Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_USER_PROP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_USER_PROP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_ADMIN_PROP_SRV
+ *
+ * @brief Define a new Generic Admin Property Server Model.
+ *
+ * @note 1. The Generic Admin Property Server model extends the Generic User
+ * Property Server model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_admin_prop_srv_t.
+ *
+ * @return New Generic Admin Property Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_ADMIN_PROP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_MANUFACTURER_PROP_SRV
+ *
+ * @brief Define a new Generic Manufacturer Property Server Model.
+ *
+ * @note 1. The Generic Manufacturer Property Server model extends the Generic
+ * User Property Server model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_manu_prop_srv_t.
+ *
+ * @return New Generic Manufacturer Property Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_MANUFACTURER_PROP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_GEN_CLIENT_PROP_SRV
+ *
+ * @brief Define a new Generic User Property Server Model.
+ *
+ * @note 1. The Generic Client Property Server model is a root model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_gen_client_prop_srv_t.
+ *
+ * @return New Generic Client Property Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_GEN_CLIENT_PROP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** Parameters of Generic OnOff state */
+typedef struct {
+ uint8_t onoff; /*!< The present value of the Generic OnOff state */
+ uint8_t target_onoff; /*!< The target value of the Generic OnOff state */
+} esp_ble_mesh_gen_onoff_state_t;
+
+/** User data of Generic OnOff Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic OnOff Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_onoff_state_t state; /*!< Parameters of the Generic OnOff state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+} esp_ble_mesh_gen_onoff_srv_t;
+
+/** Parameters of Generic Level state */
+typedef struct {
+ int16_t level; /*!< The present value of the Generic Level state */
+ int16_t target_level; /*!< The target value of the Generic Level state */
+
+ /**
+ * When a new transaction starts, level should be set to last_last, and use
+ * "level + incoming delta" to calculate the target level. In another word,
+ * "last_level" is used to record "level" of the last transaction, and
+ * "last_delta" is used to record the previously received delta_level value.
+ */
+ int16_t last_level; /*!< The last value of the Generic Level state */
+ int32_t last_delta; /*!< The last delta change of the Generic Level state */
+
+ bool move_start; /*!< Indicate if the transition of the Generic Level state has been started */
+ bool positive; /*!< Indicate if the transition is positive or negative */
+} esp_ble_mesh_gen_level_state_t;
+
+/** User data of Generic Level Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Level Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_level_state_t state; /*!< Parameters of the Generic Level state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_level; /*!< Delta change value of level state transition */
+} esp_ble_mesh_gen_level_srv_t;
+
+/** Parameter of Generic Default Transition Time state */
+typedef struct {
+ uint8_t trans_time; /*!< The value of the Generic Default Transition Time state */
+} esp_ble_mesh_gen_def_trans_time_state_t;
+
+/** User data of Generic Default Transition Time Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Default Transition Time Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_def_trans_time_state_t state; /*!< Parameters of the Generic Default Transition Time state */
+} esp_ble_mesh_gen_def_trans_time_srv_t;
+
+/** Parameter of Generic OnPowerUp state */
+typedef struct {
+ uint8_t onpowerup; /*!< The value of the Generic OnPowerUp state */
+} esp_ble_mesh_gen_onpowerup_state_t;
+
+/** User data of Generic Power OnOff Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Power OnOff Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_onpowerup_state_t *state; /*!< Parameters of the Generic OnPowerUp state */
+} esp_ble_mesh_gen_power_onoff_srv_t;
+
+/** User data of Generic Power OnOff Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Power OnOff Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_onpowerup_state_t *state; /*!< Parameters of the Generic OnPowerUp state */
+} esp_ble_mesh_gen_power_onoff_setup_srv_t;
+
+/** Parameters of Generic Power Level state */
+typedef struct {
+ uint16_t power_actual; /*!< The present value of the Generic Power Actual state */
+ uint16_t target_power_actual; /*!< The target value of the Generic Power Actual state */
+
+ uint16_t power_last; /*!< The value of the Generic Power Last state */
+ uint16_t power_default; /*!< The value of the Generic Power Default state */
+
+ uint8_t status_code; /*!< The status code of setting Generic Power Range state */
+ uint16_t power_range_min; /*!< The minimum value of the Generic Power Range state */
+ uint16_t power_range_max; /*!< The maximum value of the Generic Power Range state */
+} esp_ble_mesh_gen_power_level_state_t;
+
+/** User data of Generic Power Level Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Power Level Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_power_level_state_t *state; /*!< Parameters of the Generic Power Level state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_level; /*!< Delta change value of level state transition */
+} esp_ble_mesh_gen_power_level_srv_t;
+
+/** User data of Generic Power Level Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Power Level Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_power_level_state_t *state; /*!< Parameters of the Generic Power Level state */
+} esp_ble_mesh_gen_power_level_setup_srv_t;
+
+/** Parameters of Generic Battery state */
+typedef struct {
+ uint32_t battery_level : 8, /*!< The value of the Generic Battery Level state */
+ time_to_discharge : 24; /*!< The value of the Generic Battery Time to Discharge state */
+ uint32_t time_to_charge : 24, /*!< The value of the Generic Battery Time to Charge state */
+ battery_flags : 8; /*!< The value of the Generic Battery Flags state */
+} esp_ble_mesh_gen_battery_state_t;
+
+/** User data of Generic Battery Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Battery Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_battery_state_t state; /*!< Parameters of the Generic Battery state */
+} esp_ble_mesh_gen_battery_srv_t;
+
+/** Parameters of Generic Location state */
+typedef struct {
+ int32_t global_latitude; /*!< The value of the Global Latitude field */
+ int32_t global_longitude; /*!< The value of the Global Longitude field */
+ int16_t global_altitude; /*!< The value of the Global Altitude field */
+ int16_t local_north; /*!< The value of the Local North field */
+ int16_t local_east; /*!< The value of the Local East field */
+ int16_t local_altitude; /*!< The value of the Local Altitude field */
+ uint8_t floor_number; /*!< The value of the Floor Number field */
+ uint16_t uncertainty; /*!< The value of the Uncertainty field */
+} esp_ble_mesh_gen_location_state_t;
+
+/** User data of Generic Location Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Location Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_location_state_t *state; /*!< Parameters of the Generic Location state */
+} esp_ble_mesh_gen_location_srv_t;
+
+/** User data of Generic Location Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Location Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_gen_location_state_t *state; /*!< Parameters of the Generic Location state */
+} esp_ble_mesh_gen_location_setup_srv_t;
+
+/** This enum value is the access value of Generic User Property */
+typedef enum {
+ ESP_BLE_MESH_GEN_USER_ACCESS_PROHIBIT,
+ ESP_BLE_MESH_GEN_USER_ACCESS_READ,
+ ESP_BLE_MESH_GEN_USER_ACCESS_WRITE,
+ ESP_BLE_MESH_GEN_USER_ACCESS_READ_WRITE,
+} esp_ble_mesh_gen_user_prop_access_t;
+
+/** This enum value is the access value of Generic Admin Property */
+typedef enum {
+ ESP_BLE_MESH_GEN_ADMIN_NOT_USER_PROP,
+ ESP_BLE_MESH_GEN_ADMIN_ACCESS_READ,
+ ESP_BLE_MESH_GEN_ADMIN_ACCESS_WRITE,
+ ESP_BLE_MESH_GEN_ADMIN_ACCESS_READ_WRITE,
+} esp_ble_mesh_gen_admin_prop_access_t;
+
+/** This enum value is the access value of Generic Manufacturer Property */
+typedef enum {
+ ESP_BLE_MESH_GEN_MANU_NOT_USER_PROP,
+ ESP_BLE_MESH_GEN_MANU_ACCESS_READ,
+} esp_ble_mesh_gen_manu_prop_access_t;
+
+/** Parameters of Generic Property states */
+typedef struct {
+ uint16_t id; /*!< The value of User/Admin/Manufacturer Property ID */
+ uint8_t user_access; /*!< The value of User Access field */
+ uint8_t admin_access; /*!< The value of Admin Access field */
+ uint8_t manu_access; /*!< The value of Manufacturer Access field */
+ struct net_buf_simple *val; /*!< The value of User/Admin/Manufacturer Property */
+} esp_ble_mesh_generic_property_t;
+
+/** User data of Generic User Property Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic User Property Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ uint8_t property_count; /*!< Generic User Property count */
+ esp_ble_mesh_generic_property_t *properties; /*!< Parameters of the Generic User Property state */
+} esp_ble_mesh_gen_user_prop_srv_t;
+
+/** User data of Generic Admin Property Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Admin Property Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ uint8_t property_count; /*!< Generic Admin Property count */
+ esp_ble_mesh_generic_property_t *properties; /*!< Parameters of the Generic Admin Property state */
+} esp_ble_mesh_gen_admin_prop_srv_t;
+
+/** User data of Generic Manufacturer Property Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Manufacturer Property Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ uint8_t property_count; /*!< Generic Manufacturer Property count */
+ esp_ble_mesh_generic_property_t *properties; /*!< Parameters of the Generic Manufacturer Property state */
+} esp_ble_mesh_gen_manu_prop_srv_t;
+
+/** User data of Generic Client Property Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Generic Client Property Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ uint8_t id_count; /*!< Generic Client Property ID count */
+ uint16_t *property_ids; /*!< Parameters of the Generic Client Property state */
+} esp_ble_mesh_gen_client_prop_srv_t;
+
+/** Parameter of Generic OnOff Set state change event */
+typedef struct {
+ uint8_t onoff; /*!< The value of Generic OnOff state */
+} esp_ble_mesh_state_change_gen_onoff_set_t;
+
+/** Parameter of Generic Level Set state change event */
+typedef struct {
+ int16_t level; /*!< The value of Generic Level state */
+} esp_ble_mesh_state_change_gen_level_set_t;
+
+/** Parameter of Generic Delta Set state change event */
+typedef struct {
+ int16_t level; /*!< The value of Generic Level state */
+} esp_ble_mesh_state_change_gen_delta_set_t;
+
+/** Parameter of Generic Move Set state change event */
+typedef struct {
+ int16_t level; /*!< The value of Generic Level state */
+} esp_ble_mesh_state_change_gen_move_set_t;
+
+/** Parameter of Generic Default Transition Time Set state change event */
+typedef struct {
+ uint8_t trans_time; /*!< The value of Generic Default Transition Time state */
+} esp_ble_mesh_state_change_gen_def_trans_time_set_t;
+
+/** Parameter of Generic OnPowerUp Set state change event */
+typedef struct {
+ uint8_t onpowerup; /*!< The value of Generic OnPowerUp state */
+} esp_ble_mesh_state_change_gen_onpowerup_set_t;
+
+/** Parameter of Generic Power Level Set state change event */
+typedef struct {
+ uint16_t power; /*!< The value of Generic Power Actual state */
+} esp_ble_mesh_state_change_gen_power_level_set_t;
+
+/** Parameter of Generic Power Default Set state change event */
+typedef struct {
+ uint16_t power; /*!< The value of Generic Power Default state */
+} esp_ble_mesh_state_change_gen_power_default_set_t;
+
+/** Parameters of Generic Power Range Set state change event */
+typedef struct {
+ uint16_t range_min; /*!< The minimum value of Generic Power Range state */
+ uint16_t range_max; /*!< The maximum value of Generic Power Range state */
+} esp_ble_mesh_state_change_gen_power_range_set_t;
+
+/** Parameters of Generic Location Global Set state change event */
+typedef struct {
+ int32_t latitude; /*!< The Global Latitude value of Generic Location state */
+ int32_t longitude; /*!< The Global Longitude value of Generic Location state */
+ int16_t altitude; /*!< The Global Altitude value of Generic Location state */
+} esp_ble_mesh_state_change_gen_loc_global_set_t;
+
+/** Parameters of Generic Location Local Set state change event */
+typedef struct {
+ int16_t north; /*!< The Local North value of Generic Location state */
+ int16_t east; /*!< The Local East value of Generic Location state */
+ int16_t altitude; /*!< The Local Altitude value of Generic Location state */
+ uint8_t floor_number; /*!< The Floor Number value of Generic Location state */
+ uint16_t uncertainty; /*!< The Uncertainty value of Generic Location state */
+} esp_ble_mesh_state_change_gen_loc_local_set_t;
+
+/** Parameters of Generic User Property Set state change event */
+typedef struct {
+ uint16_t id; /*!< The property id of Generic User Property state */
+ struct net_buf_simple *value; /*!< The property value of Generic User Property state */
+} esp_ble_mesh_state_change_gen_user_property_set_t;
+
+/** Parameters of Generic Admin Property Set state change event */
+typedef struct {
+ uint16_t id; /*!< The property id of Generic Admin Property state */
+ uint8_t access; /*!< The property access of Generic Admin Property state */
+ struct net_buf_simple *value; /*!< The property value of Generic Admin Property state */
+} esp_ble_mesh_state_change_gen_admin_property_set_t;
+
+/** Parameters of Generic Manufacturer Property Set state change event */
+typedef struct {
+ uint16_t id; /*!< The property id of Generic Manufacturer Property state */
+ uint8_t access; /*!< The property value of Generic Manufacturer Property state */
+} esp_ble_mesh_state_change_gen_manu_property_set_t;
+
+/**
+ * @brief Generic Server Model state change value union
+ */
+typedef union {
+ /**
+ * The recv_op in ctx can be used to decide which state is changed.
+ */
+ esp_ble_mesh_state_change_gen_onoff_set_t onoff_set; /*!< Generic OnOff Set */
+ esp_ble_mesh_state_change_gen_level_set_t level_set; /*!< Generic Level Set */
+ esp_ble_mesh_state_change_gen_delta_set_t delta_set; /*!< Generic Delta Set */
+ esp_ble_mesh_state_change_gen_move_set_t move_set; /*!< Generic Move Set */
+ esp_ble_mesh_state_change_gen_def_trans_time_set_t def_trans_time_set; /*!< Generic Default Transition Time Set */
+ esp_ble_mesh_state_change_gen_onpowerup_set_t onpowerup_set; /*!< Generic OnPowerUp Set */
+ esp_ble_mesh_state_change_gen_power_level_set_t power_level_set; /*!< Generic Power Level Set */
+ esp_ble_mesh_state_change_gen_power_default_set_t power_default_set; /*!< Generic Power Default Set */
+ esp_ble_mesh_state_change_gen_power_range_set_t power_range_set; /*!< Generic Power Range Set */
+ esp_ble_mesh_state_change_gen_loc_global_set_t loc_global_set; /*!< Generic Location Global Set */
+ esp_ble_mesh_state_change_gen_loc_local_set_t loc_local_set; /*!< Generic Location Local Set */
+ esp_ble_mesh_state_change_gen_user_property_set_t user_property_set; /*!< Generic User Property Set */
+ esp_ble_mesh_state_change_gen_admin_property_set_t admin_property_set; /*!< Generic Admin Property Set */
+ esp_ble_mesh_state_change_gen_manu_property_set_t manu_property_set; /*!< Generic Manufacturer Property Set */
+} esp_ble_mesh_generic_server_state_change_t;
+
+/** Context of the received Generic User Property Get message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic User Property */
+} esp_ble_mesh_server_recv_gen_user_property_get_t;
+
+/** Context of the received Generic Admin Property Get message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Admin Property */
+} esp_ble_mesh_server_recv_gen_admin_property_get_t;
+
+/** Context of the received Generic Manufacturer Property message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Manufacturer Property */
+} esp_ble_mesh_server_recv_gen_manufacturer_property_get_t;
+
+/** Context of the received Generic Client Properties Get message */
+typedef struct {
+ uint16_t property_id; /*!< A starting Client Property ID present within an element */
+} esp_ble_mesh_server_recv_gen_client_properties_get_t;
+
+/**
+ * @brief Generic Server Model received get message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_gen_user_property_get_t user_property; /*!< Generic User Property Get */
+ esp_ble_mesh_server_recv_gen_admin_property_get_t admin_property; /*!< Generic Admin Property Get */
+ esp_ble_mesh_server_recv_gen_manufacturer_property_get_t manu_property; /*!< Generic Manufacturer Property Get */
+ esp_ble_mesh_server_recv_gen_client_properties_get_t client_properties; /*!< Generic Client Properties Get */
+} esp_ble_mesh_generic_server_recv_get_msg_t;
+
+/** Context of the received Generic OnOff Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint8_t onoff; /*!< Target value of Generic OnOff state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_gen_onoff_set_t;
+
+/** Context of the received Generic Level Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ int16_t level; /*!< Target value of Generic Level state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_gen_level_set_t;
+
+/** Context of the received Generic Delta Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ int32_t delta_level; /*!< Delta change of Generic Level state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_gen_delta_set_t;
+
+/** Context of the received Generic Move Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ int16_t delta_level; /*!< Delta Level step to calculate Move speed for Generic Level state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_gen_move_set_t;
+
+/** Context of the received Generic Default Transition Time Set message */
+typedef struct {
+ uint8_t trans_time; /*!< The value of the Generic Default Transition Time state */
+} esp_ble_mesh_server_recv_gen_def_trans_time_set_t;
+
+/** Context of the received Generic OnPowerUp Set message */
+typedef struct {
+ uint8_t onpowerup; /*!< The value of the Generic OnPowerUp state */
+} esp_ble_mesh_server_recv_gen_onpowerup_set_t;
+
+/** Context of the received Generic Power Level Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t power; /*!< Target value of Generic Power Actual state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_gen_power_level_set_t;
+
+/** Context of the received Generic Power Default Set message */
+typedef struct {
+ uint16_t power; /*!< The value of the Generic Power Default state */
+} esp_ble_mesh_server_recv_gen_power_default_set_t;
+
+/** Context of the received Generic Power Range Set message */
+typedef struct {
+ uint16_t range_min; /*!< Value of Range Min field of Generic Power Range state */
+ uint16_t range_max; /*!< Value of Range Max field of Generic Power Range state */
+} esp_ble_mesh_server_recv_gen_power_range_set_t;
+
+/** Context of the received Generic Location Global Set message */
+typedef struct {
+ int32_t global_latitude; /*!< Global Coordinates (Latitude) */
+ int32_t global_longitude; /*!< Global Coordinates (Longitude) */
+ int16_t global_altitude; /*!< Global Altitude */
+} esp_ble_mesh_server_recv_gen_loc_global_set_t;
+
+/** Context of the received Generic Location Local Set message */
+typedef struct {
+ int16_t local_north; /*!< Local Coordinates (North) */
+ int16_t local_east; /*!< Local Coordinates (East) */
+ int16_t local_altitude; /*!< Local Altitude */
+ uint8_t floor_number; /*!< Floor Number */
+ uint16_t uncertainty; /*!< Uncertainty */
+} esp_ble_mesh_server_recv_gen_loc_local_set_t;
+
+/** Context of the received Generic User Property Set message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic User Property */
+ struct net_buf_simple *property_value; /*!< Raw value for the User Property */
+} esp_ble_mesh_server_recv_gen_user_property_set_t;
+
+/** Context of the received Generic Admin Property Set message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Admin Property */
+ uint8_t user_access; /*!< Enumeration indicating user access */
+ struct net_buf_simple *property_value; /*!< Raw value for the Admin Property */
+} esp_ble_mesh_server_recv_gen_admin_property_set_t;
+
+/** Context of the received Generic Manufacturer Property Set message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Generic Manufacturer Property */
+ uint8_t user_access; /*!< Enumeration indicating user access */
+} esp_ble_mesh_server_recv_gen_manufacturer_property_set_t;
+
+/**
+ * @brief Generic Server Model received set message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_gen_onoff_set_t onoff; /*!< Generic OnOff Set/Generic OnOff Set Unack */
+ esp_ble_mesh_server_recv_gen_level_set_t level; /*!< Generic Level Set/Generic Level Set Unack */
+ esp_ble_mesh_server_recv_gen_delta_set_t delta; /*!< Generic Delta Set/Generic Delta Set Unack */
+ esp_ble_mesh_server_recv_gen_move_set_t move; /*!< Generic Move Set/Generic Move Set Unack */
+ esp_ble_mesh_server_recv_gen_def_trans_time_set_t def_trans_time; /*!< Generic Default Transition Time Set/Generic Default Transition Time Set Unack */
+ esp_ble_mesh_server_recv_gen_onpowerup_set_t onpowerup; /*!< Generic OnPowerUp Set/Generic OnPowerUp Set Unack */
+ esp_ble_mesh_server_recv_gen_power_level_set_t power_level; /*!< Generic Power Level Set/Generic Power Level Set Unack */
+ esp_ble_mesh_server_recv_gen_power_default_set_t power_default; /*!< Generic Power Default Set/Generic Power Default Set Unack */
+ esp_ble_mesh_server_recv_gen_power_range_set_t power_range; /*!< Generic Power Range Set/Generic Power Range Set Unack */
+ esp_ble_mesh_server_recv_gen_loc_global_set_t location_global; /*!< Generic Location Global Set/Generic Location Global Set Unack */
+ esp_ble_mesh_server_recv_gen_loc_local_set_t location_local; /*!< Generic Location Local Set/Generic Location Local Set Unack */
+ esp_ble_mesh_server_recv_gen_user_property_set_t user_property; /*!< Generic User Property Set/Generic User Property Set Unack */
+ esp_ble_mesh_server_recv_gen_admin_property_set_t admin_property; /*!< Generic Admin Property Set/Generic Admin Property Set Unack */
+ esp_ble_mesh_server_recv_gen_manufacturer_property_set_t manu_property; /*!< Generic Manufacturer Property Set/Generic Manufacturer Property Set Unack */
+} esp_ble_mesh_generic_server_recv_set_msg_t;
+
+/**
+ * @brief Generic Server Model callback value union
+ */
+typedef union {
+ esp_ble_mesh_generic_server_state_change_t state_change; /*!< ESP_BLE_MESH_GENERIC_SERVER_STATE_CHANGE_EVT */
+ esp_ble_mesh_generic_server_recv_get_msg_t get; /*!< ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT */
+ esp_ble_mesh_generic_server_recv_set_msg_t set; /*!< ESP_BLE_MESH_GENERIC_SERVER_RECV_SET_MSG_EVT */
+} esp_ble_mesh_generic_server_cb_value_t;
+
+/** Generic Server Model callback parameters */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to Generic Server Models */
+ esp_ble_mesh_msg_ctx_t ctx; /*!< Context of the received messages */
+ esp_ble_mesh_generic_server_cb_value_t value; /*!< Value of the received Generic Messages */
+} esp_ble_mesh_generic_server_cb_param_t;
+
+/** This enum value is the event of Generic Server Model */
+typedef enum {
+ /**
+ * 1. When get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, no event will be
+ * callback to the application layer when Generic Get messages are received.
+ * 2. When set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, this event will
+ * be callback to the application layer when Generic Set/Set Unack messages
+ * are received.
+ */
+ ESP_BLE_MESH_GENERIC_SERVER_STATE_CHANGE_EVT,
+ /**
+ * When get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Generic Get messages are received.
+ */
+ ESP_BLE_MESH_GENERIC_SERVER_RECV_GET_MSG_EVT,
+ /**
+ * When set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Generic Set/Set Unack messages are received.
+ */
+ ESP_BLE_MESH_GENERIC_SERVER_RECV_SET_MSG_EVT,
+ ESP_BLE_MESH_GENERIC_SERVER_EVT_MAX,
+} esp_ble_mesh_generic_server_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Generic Server Model function.
+ */
+
+/**
+ * @brief Generic Server Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_generic_server_cb_t)(esp_ble_mesh_generic_server_cb_event_t event,
+ esp_ble_mesh_generic_server_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Generic Server Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_generic_server_callback(esp_ble_mesh_generic_server_cb_t callback);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_GENERIC_MODEL_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_health_model_api.h b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_health_model_api.h
new file mode 100644
index 00000000..3a636ce1
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_health_model_api.h
@@ -0,0 +1,406 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#ifndef _ESP_BLE_MESH_HEALTH_MODEL_API_H_
+#define _ESP_BLE_MESH_HEALTH_MODEL_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @def ESP_BLE_MESH_MODEL_HEALTH_SRV
+ *
+ * @brief Define a new Health Server Model.
+ *
+ * @note The Health Server Model can only be included by a Primary Element.
+ *
+ * @param srv Pointer to the unique struct esp_ble_mesh_health_srv_t.
+ * @param pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ *
+ * @return New Health Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_HEALTH_SRV(srv, pub) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_HEALTH_SRV, \
+ NULL, pub, srv)
+
+/** @def ESP_BLE_MESH_MODEL_HEALTH_CLI
+ *
+ * @brief Define a new Health Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Health Client Model.
+ *
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Health Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_HEALTH_CLI(cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_HEALTH_CLI, \
+ NULL, NULL, cli_data)
+
+/** @def ESP_BLE_MESH_HEALTH_PUB_DEFINE
+ *
+ * A helper to define a health publication context
+ *
+ * @param _name Name given to the publication context variable.
+ * @param _max Maximum number of faults the element can have.
+ * @param _role Role of the device which contains the model.
+ */
+#define ESP_BLE_MESH_HEALTH_PUB_DEFINE(_name, _max, _role) \
+ ESP_BLE_MESH_MODEL_PUB_DEFINE(_name, (1 + 3 + (_max)), _role)
+
+/**
+ * SIG identifier of Health Fault Test.
+ * 0x01 ~ 0xFF: Vendor Specific Test.
+ */
+#define ESP_BLE_MESH_HEALTH_STANDARD_TEST 0x00
+
+/**
+ * Fault values of Health Fault Test.
+ * 0x33 ~ 0x7F: Reserved for Future Use.
+ * 0x80 ~ 0xFF: Vendor Specific Warning/Error.
+ */
+#define ESP_BLE_MESH_NO_FAULT 0x00
+#define ESP_BLE_MESH_BATTERY_LOW_WARNING 0x01
+#define ESP_BLE_MESH_BATTERY_LOW_ERROR 0x02
+#define ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_LOW_WARNING 0x03
+#define ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_LOW_ERROR 0x04
+#define ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_HIGH_WARNING 0x05
+#define ESP_BLE_MESH_SUPPLY_VOLTAGE_TOO_HIGH_ERROR 0x06
+#define ESP_BLE_MESH_POWER_SUPPLY_INTERRUPTED_WARNING 0x07
+#define ESP_BLE_MESH_POWER_SUPPLY_INTERRUPTED_ERROR 0x08
+#define ESP_BLE_MESH_NO_LOAD_WARNING 0x09
+#define ESP_BLE_MESH_NO_LOAD_ERROR 0x0A
+#define ESP_BLE_MESH_OVERLOAD_WARNING 0x0B
+#define ESP_BLE_MESH_OVERLOAD_ERROR 0x0C
+#define ESP_BLE_MESH_OVERHEAT_WARNING 0x0D
+#define ESP_BLE_MESH_OVERHEAT_ERROR 0x0E
+#define ESP_BLE_MESH_CONDENSATION_WARNING 0x0F
+#define ESP_BLE_MESH_CONDENSATION_ERROR 0x10
+#define ESP_BLE_MESH_VIBRATION_WARNING 0x11
+#define ESP_BLE_MESH_VIBRATION_ERROR 0x12
+#define ESP_BLE_MESH_CONFIGURATION_WARNING 0x13
+#define ESP_BLE_MESH_CONFIGURATION_ERROR 0x14
+#define ESP_BLE_MESH_ELEMENT_NOT_CALIBRATED_WARNING 0x15
+#define ESP_BLE_MESH_ELEMENT_NOT_CALIBRATED_ERROR 0x16
+#define ESP_BLE_MESH_MEMORY_WARNING 0x17
+#define ESP_BLE_MESH_MEMORY_ERROR 0x18
+#define ESP_BLE_MESH_SELF_TEST_WARNING 0x19
+#define ESP_BLE_MESH_SELF_TEST_ERROR 0x1A
+#define ESP_BLE_MESH_INPUT_TOO_LOW_WARNING 0x1B
+#define ESP_BLE_MESH_INPUT_TOO_LOW_ERROR 0x1C
+#define ESP_BLE_MESH_INPUT_TOO_HIGH_WARNING 0x1D
+#define ESP_BLE_MESH_INPUT_TOO_HIGH_ERROR 0x1E
+#define ESP_BLE_MESH_INPUT_NO_CHANGE_WARNING 0x1F
+#define ESP_BLE_MESH_INPUT_NO_CHANGE_ERROR 0x20
+#define ESP_BLE_MESH_ACTUATOR_BLOCKED_WARNING 0x21
+#define ESP_BLE_MESH_ACTUATOR_BLOCKED_ERROR 0x22
+#define ESP_BLE_MESH_HOUSING_OPENED_WARNING 0x23
+#define ESP_BLE_MESH_HOUSING_OPENED_ERROR 0x24
+#define ESP_BLE_MESH_TAMPER_WARNING 0x25
+#define ESP_BLE_MESH_TAMPER_ERROR 0x26
+#define ESP_BLE_MESH_DEVICE_MOVED_WARNING 0x27
+#define ESP_BLE_MESH_DEVICE_MOVED_ERROR 0x28
+#define ESP_BLE_MESH_DEVICE_DROPPED_WARNING 0x29
+#define ESP_BLE_MESH_DEVICE_DROPPED_ERROR 0x2A
+#define ESP_BLE_MESH_OVERFLOW_WARNING 0x2B
+#define ESP_BLE_MESH_OVERFLOW_ERROR 0x2C
+#define ESP_BLE_MESH_EMPTY_WARNING 0x2D
+#define ESP_BLE_MESH_EMPTY_ERROR 0x2E
+#define ESP_BLE_MESH_INTERNAL_BUS_WARNING 0x2F
+#define ESP_BLE_MESH_INTERNAL_BUS_ERROR 0x30
+#define ESP_BLE_MESH_MECHANISM_JAMMED_WARNING 0x31
+#define ESP_BLE_MESH_MECHANISM_JAMMED_ERROR 0x32
+
+/** ESP BLE Mesh Health Server callback */
+typedef struct {
+ /** Clear health registered faults. Initialized by the stack. */
+ esp_ble_mesh_cb_t fault_clear;
+
+ /** Run a specific health test. Initialized by the stack. */
+ esp_ble_mesh_cb_t fault_test;
+
+ /** Health attention on callback. Initialized by the stack. */
+ esp_ble_mesh_cb_t attention_on;
+
+ /** Health attention off callback. Initialized by the stack. */
+ esp_ble_mesh_cb_t attention_off;
+} esp_ble_mesh_health_srv_cb_t;
+
+#define ESP_BLE_MESH_HEALTH_FAULT_ARRAY_SIZE 32
+
+/** ESP BLE Mesh Health Server test Context */
+typedef struct {
+ uint8_t id_count; /*!< Number of Health self-test ID */
+ const uint8_t *test_ids; /*!< Array of Health self-test IDs */
+ uint16_t company_id; /*!< Company ID used to identify the Health Fault state */
+ uint8_t prev_test_id; /*!< Current test ID of the health fault test */
+ uint8_t current_faults[ESP_BLE_MESH_HEALTH_FAULT_ARRAY_SIZE]; /*!< Array of current faults */
+ uint8_t registered_faults[ESP_BLE_MESH_HEALTH_FAULT_ARRAY_SIZE]; /*!< Array of registered faults */
+} __attribute__((packed)) esp_ble_mesh_health_test_t;
+
+/** ESP BLE Mesh Health Server Model Context */
+typedef struct {
+ /** Pointer to Health Server Model */
+ esp_ble_mesh_model_t *model;
+
+ /** Health callback struct */
+ esp_ble_mesh_health_srv_cb_t health_cb;
+
+ /** Attention Timer state */
+ struct k_delayed_work attention_timer;
+
+ /** Attention Timer start flag */
+ bool attention_timer_start;
+
+ /** Health Server fault test */
+ esp_ble_mesh_health_test_t health_test;
+} esp_ble_mesh_health_srv_t;
+
+/** Parameter of Health Fault Get */
+typedef struct {
+ uint16_t company_id; /*!< Bluetooth assigned 16-bit Company ID */
+} esp_ble_mesh_health_fault_get_t;
+
+/** Parameter of Health Attention Set */
+typedef struct {
+ uint8_t attention; /*!< Value of the Attention Timer state */
+} esp_ble_mesh_health_attention_set_t;
+
+/** Parameter of Health Period Set */
+typedef struct {
+ uint8_t fast_period_divisor; /*!< Divider for the Publish Period */
+} esp_ble_mesh_health_period_set_t;
+
+/** Parameter of Health Fault Test */
+typedef struct {
+ uint16_t company_id; /*!< Bluetooth assigned 16-bit Company ID */
+ uint8_t test_id; /*!< ID of a specific test to be performed */
+} esp_ble_mesh_health_fault_test_t;
+
+/** Parameter of Health Fault Clear */
+typedef struct {
+ uint16_t company_id; /*!< Bluetooth assigned 16-bit Company ID */
+} esp_ble_mesh_health_fault_clear_t;
+
+/**
+ * @brief For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET
+ * ESP_BLE_MESH_MODEL_OP_ATTENTION_GET
+ * ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_GET
+ * the get_state parameter in the esp_ble_mesh_health_client_get_state function should not be set to NULL.
+ */
+typedef union {
+ esp_ble_mesh_health_fault_get_t fault_get; /*!< For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET. */
+} esp_ble_mesh_health_client_get_state_t;
+
+/**
+ * @brief For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR
+ * ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK
+ * ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST
+ * ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK
+ * ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET
+ * ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK
+ * ESP_BLE_MESH_MODEL_OP_ATTENTION_SET
+ * ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK
+ * the set_state parameter in the esp_ble_mesh_health_client_set_state function should not be set to NULL.
+ */
+typedef union {
+ esp_ble_mesh_health_attention_set_t attention_set; /*!< For ESP_BLE_MESH_MODEL_OP_ATTENTION_SET or ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK. */
+ esp_ble_mesh_health_period_set_t period_set; /*!< For ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET or ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK. */
+ esp_ble_mesh_health_fault_test_t fault_test; /*!< For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST or ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK. */
+ esp_ble_mesh_health_fault_clear_t fault_clear; /*!< For ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR or ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK. */
+} esp_ble_mesh_health_client_set_state_t;
+
+/** Parameters of Health Current Status */
+typedef struct {
+ uint8_t test_id; /*!< ID of a most recently performed test */
+ uint16_t company_id; /*!< Bluetooth assigned 16-bit Company ID */
+ struct net_buf_simple *fault_array; /*!< FaultArray field contains a sequence of 1-octet fault values */
+} esp_ble_mesh_health_current_status_cb_t;
+
+/** Parameters of Health Fault Status */
+typedef struct {
+ uint8_t test_id; /*!< ID of a most recently performed test */
+ uint16_t company_id; /*!< Bluetooth assigned 16-bit Company ID */
+ struct net_buf_simple *fault_array; /*!< FaultArray field contains a sequence of 1-octet fault values */
+} esp_ble_mesh_health_fault_status_cb_t;
+
+/** Parameter of Health Period Status */
+typedef struct {
+ uint8_t fast_period_divisor; /*!< Divider for the Publish Period */
+} esp_ble_mesh_health_period_status_cb_t;
+
+/** Parameter of Health Attention Status */
+typedef struct {
+ uint8_t attention; /*!< Value of the Attention Timer state */
+} esp_ble_mesh_health_attention_status_cb_t;
+
+/**
+ * @brief Health Client Model received message union
+ */
+typedef union {
+ esp_ble_mesh_health_current_status_cb_t current_status; /*!< The health current status value */
+ esp_ble_mesh_health_fault_status_cb_t fault_status; /*!< The health fault status value */
+ esp_ble_mesh_health_period_status_cb_t period_status; /*!< The health period status value */
+ esp_ble_mesh_health_attention_status_cb_t attention_status; /*!< The health attention status value */
+} esp_ble_mesh_health_client_common_cb_param_t;
+
+/** Health Client Model callback parameters */
+typedef struct {
+ int error_code; /*!< Appropriate error code */
+ esp_ble_mesh_client_common_param_t *params; /*!< The client common parameters. */
+ esp_ble_mesh_health_client_common_cb_param_t status_cb; /*!< The health message status callback values */
+} esp_ble_mesh_health_client_cb_param_t;
+
+/** This enum value is the event of Health Client Model */
+typedef enum {
+ ESP_BLE_MESH_HEALTH_CLIENT_GET_STATE_EVT,
+ ESP_BLE_MESH_HEALTH_CLIENT_SET_STATE_EVT,
+ ESP_BLE_MESH_HEALTH_CLIENT_PUBLISH_EVT,
+ ESP_BLE_MESH_HEALTH_CLIENT_TIMEOUT_EVT,
+ ESP_BLE_MESH_HEALTH_CLIENT_EVT_MAX,
+} esp_ble_mesh_health_client_cb_event_t;
+
+/** Parameter of publishing Health Current Status completion event */
+typedef struct {
+ int error_code; /*!< The result of publishing Health Current Status */
+ esp_ble_mesh_elem_t *element; /*!< Pointer to the element which contains the Health Server Model */
+} esp_ble_mesh_health_fault_update_comp_cb_t;
+
+/** Parameters of Health Fault Clear event */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Health Server Model */
+ uint16_t company_id; /*!< Bluetooth assigned 16-bit Company ID */
+} esp_ble_mesh_health_fault_clear_cb_t;
+
+/** Parameters of Health Fault Test event */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Health Server Model */
+ uint8_t test_id; /*!< ID of a specific test to be performed */
+ uint16_t company_id; /*!< Bluetooth assigned 16-bit Company ID */
+} esp_ble_mesh_health_fault_test_cb_t;
+
+/** Parameter of Health Attention On event */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Health Server Model */
+ uint8_t time; /*!< Duration of attention timer on (in seconds) */
+} esp_ble_mesh_health_attention_on_cb_t;
+
+/** Parameter of Health Attention Off event */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Health Server Model */
+} esp_ble_mesh_health_attention_off_cb_t;
+
+/**
+ * @brief Health Server Model callback parameters union
+ */
+typedef union {
+ esp_ble_mesh_health_fault_update_comp_cb_t fault_update_comp; /*!< ESP_BLE_MESH_HEALTH_SERVER_FAULT_UPDATE_COMP_EVT */
+ esp_ble_mesh_health_fault_clear_cb_t fault_clear; /*!< ESP_BLE_MESH_HEALTH_SERVER_FAULT_CLEAR_EVT */
+ esp_ble_mesh_health_fault_test_cb_t fault_test; /*!< ESP_BLE_MESH_HEALTH_SERVER_FAULT_TEST_EVT */
+ esp_ble_mesh_health_attention_on_cb_t attention_on; /*!< ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_ON_EVT */
+ esp_ble_mesh_health_attention_off_cb_t attention_off; /*!< ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_OFF_EVT */
+} esp_ble_mesh_health_server_cb_param_t;
+
+/** This enum value is the event of Health Server Model */
+typedef enum {
+ ESP_BLE_MESH_HEALTH_SERVER_FAULT_UPDATE_COMP_EVT,
+ ESP_BLE_MESH_HEALTH_SERVER_FAULT_CLEAR_EVT,
+ ESP_BLE_MESH_HEALTH_SERVER_FAULT_TEST_EVT,
+ ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_ON_EVT,
+ ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_OFF_EVT,
+ ESP_BLE_MESH_HEALTH_SERVER_EVT_MAX,
+} esp_ble_mesh_health_server_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Health Client and Server Model function.
+ */
+
+/**
+ * @brief Health Client Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_health_client_cb_t)(esp_ble_mesh_health_client_cb_event_t event,
+ esp_ble_mesh_health_client_cb_param_t *param);
+
+/**
+ * @brief Health Server Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_health_server_cb_t)(esp_ble_mesh_health_server_cb_event_t event,
+ esp_ble_mesh_health_server_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Health Model callback, the callback will report Health Client & Server Model events.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_health_client_callback(esp_ble_mesh_health_client_cb_t callback);
+
+/**
+ * @brief Register BLE Mesh Health Server Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_health_server_callback(esp_ble_mesh_health_server_cb_t callback);
+
+/**
+ * @brief This function is called to get the Health Server states using the Health Client Model get messages.
+ *
+ * @note If you want to find the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_opcode_health_client_get_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] get_state: Pointer to a union, each kind of opcode corresponds to one structure inside.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_health_client_get_state_t *get_state);
+
+/**
+ * @brief This function is called to set the Health Server states using the Health Client Model set messages.
+ *
+ * @note If you want to find the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_opcode_health_client_set_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] set_state: Pointer to a union, each kind of opcode corresponds to one structure inside.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_health_client_set_state_t *set_state);
+
+/**
+ * @brief This function is called by the Health Server Model to update the context of its Health Current status.
+ *
+ * @param[in] element: The element to which the Health Server Model belongs.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_health_server_fault_update(esp_ble_mesh_elem_t *element);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_HEALTH_MODEL_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_lighting_model_api.h b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_lighting_model_api.h
new file mode 100644
index 00000000..c610c77a
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_lighting_model_api.h
@@ -0,0 +1,1674 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/** @file
+ * @brief Bluetooth Mesh Light Client Model APIs.
+ */
+
+#ifndef _ESP_BLE_MESH_LIGHTING_MODEL_API_H_
+#define _ESP_BLE_MESH_LIGHTING_MODEL_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_CLI
+ *
+ * @brief Define a new Light Lightness Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Light Lightness Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Light Lightness Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_CTL_CLI
+ *
+ * @brief Define a new Light CTL Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Light CTL Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Light CTL Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_CTL_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_HSL_CLI
+ *
+ * @brief Define a new Light HSL Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Light HSL Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Light HSL Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_HSL_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_XYL_CLI
+ *
+ * @brief Define a new Light xyL Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Light xyL Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Light xyL Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_XYL_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_LC_CLI
+ *
+ * @brief Define a new Light LC Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Light LC Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Light LC Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_LC_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LC_CLI, \
+ NULL, cli_pub, cli_data)
+
+/**
+ * @brief Bluetooth Mesh Light Lightness Client Model Get and Set parameters structure.
+ */
+
+/** Parameters of Light Lightness Set */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t lightness; /*!< Target value of light lightness actual state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_lightness_set_t;
+
+/** Parameters of Light Lightness Linear Set */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t lightness; /*!< Target value of light lightness linear state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_lightness_linear_set_t;
+
+/** Parameter of Light Lightness Default Set */
+typedef struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Default state */
+} esp_ble_mesh_light_lightness_default_set_t;
+
+/** Parameters of Light Lightness Range Set */
+typedef struct {
+ uint16_t range_min; /*!< Value of range min field of light lightness range state */
+ uint16_t range_max; /*!< Value of range max field of light lightness range state */
+} esp_ble_mesh_light_lightness_range_set_t;
+
+/** Parameters of Light CTL Set */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t ctl_lightness; /*!< Target value of light ctl lightness state */
+ uint16_t ctl_temperature; /*!< Target value of light ctl temperature state */
+ int16_t ctl_delta_uv; /*!< Target value of light ctl delta UV state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_ctl_set_t;
+
+/** Parameters of Light CTL Temperature Set */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t ctl_temperature; /*!< Target value of light ctl temperature state */
+ int16_t ctl_delta_uv; /*!< Target value of light ctl delta UV state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_ctl_temperature_set_t;
+
+/** Parameters of Light CTL Temperature Range Set */
+typedef struct {
+ uint16_t range_min; /*!< Value of temperature range min field of light ctl temperature range state */
+ uint16_t range_max; /*!< Value of temperature range max field of light ctl temperature range state */
+} esp_ble_mesh_light_ctl_temperature_range_set_t;
+
+/** Parameters of Light CTL Default Set */
+typedef struct {
+ uint16_t lightness; /*!< Value of light lightness default state */
+ uint16_t temperature; /*!< Value of light temperature default state */
+ int16_t delta_uv; /*!< Value of light delta UV default state */
+} esp_ble_mesh_light_ctl_default_set_t;
+
+/** Parameters of Light HSL Set */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t hsl_lightness; /*!< Target value of light hsl lightness state */
+ uint16_t hsl_hue; /*!< Target value of light hsl hue state */
+ uint16_t hsl_saturation; /*!< Target value of light hsl saturation state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_hsl_set_t;
+
+/** Parameters of Light HSL Hue Set */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t hue; /*!< Target value of light hsl hue state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_hsl_hue_set_t;
+
+/** Parameters of Light HSL Saturation Set */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t saturation; /*!< Target value of light hsl hue state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_hsl_saturation_set_t;
+
+/** Parameters of Light HSL Default Set */
+typedef struct {
+ uint16_t lightness; /*!< Value of light lightness default state */
+ uint16_t hue; /*!< Value of light hue default state */
+ uint16_t saturation; /*!< Value of light saturation default state */
+} esp_ble_mesh_light_hsl_default_set_t;
+
+/** Parameters of Light HSL Range Set */
+typedef struct {
+ uint16_t hue_range_min; /*!< Value of hue range min field of light hsl hue range state */
+ uint16_t hue_range_max; /*!< Value of hue range max field of light hsl hue range state */
+ uint16_t saturation_range_min; /*!< Value of saturation range min field of light hsl saturation range state */
+ uint16_t saturation_range_max; /*!< Value of saturation range max field of light hsl saturation range state */
+} esp_ble_mesh_light_hsl_range_set_t;
+
+/** Parameters of Light xyL Set */
+typedef struct {
+ bool op_en; /*!< Indicate whether optional parameters included */
+ uint16_t xyl_lightness; /*!< The target value of the Light xyL Lightness state */
+ uint16_t xyl_x; /*!< The target value of the Light xyL x state */
+ uint16_t xyl_y; /*!< The target value of the Light xyL y state */
+ uint8_t tid; /*!< Transaction Identifier */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_xyl_set_t;
+
+/** Parameters of Light xyL Default Set */
+typedef struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Default state */
+ uint16_t xyl_x; /*!< The value of the Light xyL x Default state */
+ uint16_t xyl_y; /*!< The value of the Light xyL y Default state */
+} esp_ble_mesh_light_xyl_default_set_t;
+
+/** Parameters of Light xyL Range Set */
+typedef struct {
+ uint16_t xyl_x_range_min; /*!< The value of the xyL x Range Min field of the Light xyL x Range state */
+ uint16_t xyl_x_range_max; /*!< The value of the xyL x Range Max field of the Light xyL x Range state */
+ uint16_t xyl_y_range_min; /*!< The value of the xyL y Range Min field of the Light xyL y Range state */
+ uint16_t xyl_y_range_max; /*!< The value of the xyL y Range Max field of the Light xyL y Range state */
+} esp_ble_mesh_light_xyl_range_set_t;
+
+/** Parameter of Light LC Mode Set */
+typedef struct {
+ uint8_t mode; /*!< The target value of the Light LC Mode state */
+} esp_ble_mesh_light_lc_mode_set_t;
+
+/** Parameter of Light LC OM Set */
+typedef struct {
+ uint8_t mode; /*!< The target value of the Light LC Occupancy Mode state */
+} esp_ble_mesh_light_lc_om_set_t;
+
+/** Parameters of Light LC Light OnOff Set */
+typedef struct {
+ bool op_en; /*!< Indicate whether optional parameters included */
+ uint8_t light_onoff; /*!< The target value of the Light LC Light OnOff state */
+ uint8_t tid; /*!< Transaction Identifier */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_light_lc_light_onoff_set_t;
+
+/** Parameter of Light LC Property Get */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Light LC Property */
+} esp_ble_mesh_light_lc_property_get_t;
+
+/** Parameters of Light LC Property Set */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Light LC Property */
+ struct net_buf_simple *property_value; /*!< Raw value for the Light LC Property */
+} esp_ble_mesh_light_lc_property_set_t;
+
+/**
+ * @brief Lighting Client Model get message union
+ */
+typedef union {
+ esp_ble_mesh_light_lc_property_get_t lc_property_get; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_GET */
+} esp_ble_mesh_light_client_get_state_t;
+
+/**
+ * @brief Lighting Client Model set message union
+ */
+typedef union {
+ esp_ble_mesh_light_lightness_set_t lightness_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_SET_UNACK */
+ esp_ble_mesh_light_lightness_linear_set_t lightness_linear_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_SET_UNACK */
+ esp_ble_mesh_light_lightness_default_set_t lightness_default_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_SET_UNACK */
+ esp_ble_mesh_light_lightness_range_set_t lightness_range_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_SET_UNACK */
+ esp_ble_mesh_light_ctl_set_t ctl_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_SET_UNACK */
+ esp_ble_mesh_light_ctl_temperature_set_t ctl_temperature_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_SET_UNACK */
+ esp_ble_mesh_light_ctl_temperature_range_set_t ctl_temperature_range_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_SET_UNACK */
+ esp_ble_mesh_light_ctl_default_set_t ctl_default_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_SET_UNACK */
+ esp_ble_mesh_light_hsl_set_t hsl_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SET_UNACK */
+ esp_ble_mesh_light_hsl_hue_set_t hsl_hue_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_SET_UNACK */
+ esp_ble_mesh_light_hsl_saturation_set_t hsl_saturation_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_SET_UNACK */
+ esp_ble_mesh_light_hsl_default_set_t hsl_default_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_SET_UNACK */
+ esp_ble_mesh_light_hsl_range_set_t hsl_range_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_SET_UNACK */
+ esp_ble_mesh_light_xyl_set_t xyl_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_SET_UNACK */
+ esp_ble_mesh_light_xyl_default_set_t xyl_default_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_SET_UNACK */
+ esp_ble_mesh_light_xyl_range_set_t xyl_range_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_SET_UNACK */
+ esp_ble_mesh_light_lc_mode_set_t lc_mode_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_SET_UNACK */
+ esp_ble_mesh_light_lc_om_set_t lc_om_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_SET_UNACK */
+ esp_ble_mesh_light_lc_light_onoff_set_t lc_light_onoff_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_SET_UNACK */
+ esp_ble_mesh_light_lc_property_set_t lc_property_set; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET & ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_SET_UNACK */
+} esp_ble_mesh_light_client_set_state_t;
+
+/**
+ * @brief Bluetooth Mesh Light Lightness Client Model Get and Set callback parameters structure.
+ */
+
+/** Parameters of Light Lightness Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t present_lightness; /*!< Current value of light lightness actual state */
+ uint16_t target_lightness; /*!< Target value of light lightness actual state (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_light_lightness_status_cb_t;
+
+/** Parameters of Light Lightness Linear Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t present_lightness; /*!< Current value of light lightness linear state */
+ uint16_t target_lightness; /*!< Target value of light lightness linear state (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_light_lightness_linear_status_cb_t;
+
+/** Parameter of Light Lightness Last Status */
+typedef struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Last state */
+} esp_ble_mesh_light_lightness_last_status_cb_t;
+
+/** Parameter of Light Lightness Default Status */
+typedef struct {
+ uint16_t lightness; /*!< The value of the Light Lightness default State */
+} esp_ble_mesh_light_lightness_default_status_cb_t;
+
+/** Parameters of Light Lightness Range Status */
+typedef struct {
+ uint8_t status_code; /*!< Status Code for the request message */
+ uint16_t range_min; /*!< Value of range min field of light lightness range state */
+ uint16_t range_max; /*!< Value of range max field of light lightness range state */
+} esp_ble_mesh_light_lightness_range_status_cb_t;
+
+/** Parameters of Light CTL Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t present_ctl_lightness; /*!< Current value of light ctl lightness state */
+ uint16_t present_ctl_temperature; /*!< Current value of light ctl temperature state */
+ uint16_t target_ctl_lightness; /*!< Target value of light ctl lightness state (optional) */
+ uint16_t target_ctl_temperature; /*!< Target value of light ctl temperature state (C.1) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_light_ctl_status_cb_t;
+
+/** Parameters of Light CTL Temperature Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t present_ctl_temperature; /*!< Current value of light ctl temperature state */
+ uint16_t present_ctl_delta_uv; /*!< Current value of light ctl delta UV state */
+ uint16_t target_ctl_temperature; /*!< Target value of light ctl temperature state (optional) */
+ uint16_t target_ctl_delta_uv; /*!< Target value of light ctl delta UV state (C.1) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_light_ctl_temperature_status_cb_t;
+
+/** Parameters of Light CTL Temperature Range Status */
+typedef struct {
+ uint8_t status_code; /*!< Status code for the request message */
+ uint16_t range_min; /*!< Value of temperature range min field of light ctl temperature range state */
+ uint16_t range_max; /*!< Value of temperature range max field of light ctl temperature range state */
+} esp_ble_mesh_light_ctl_temperature_range_status_cb_t;
+
+/** Parameters of Light CTL Default Status */
+typedef struct {
+ uint16_t lightness; /*!< Value of light lightness default state */
+ uint16_t temperature; /*!< Value of light temperature default state */
+ int16_t delta_uv; /*!< Value of light delta UV default state */
+} esp_ble_mesh_light_ctl_default_status_cb_t;
+
+/** Parameters of Light HSL Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t hsl_lightness; /*!< Current value of light hsl lightness state */
+ uint16_t hsl_hue; /*!< Current value of light hsl hue state */
+ uint16_t hsl_saturation; /*!< Current value of light hsl saturation state */
+ uint8_t remain_time; /*!< Time to complete state transition (optional) */
+} esp_ble_mesh_light_hsl_status_cb_t;
+
+/** Parameters of Light HSL Target Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t hsl_lightness_target; /*!< Target value of light hsl lightness state */
+ uint16_t hsl_hue_target; /*!< Target value of light hsl hue state */
+ uint16_t hsl_saturation_target; /*!< Target value of light hsl saturation state */
+ uint8_t remain_time; /*!< Time to complete state transition (optional) */
+} esp_ble_mesh_light_hsl_target_status_cb_t;
+
+/** Parameters of Light HSL Hue Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t present_hue; /*!< Current value of light hsl hue state */
+ uint16_t target_hue; /*!< Target value of light hsl hue state (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_light_hsl_hue_status_cb_t;
+
+/** Parameters of Light HSL Saturation Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t present_saturation; /*!< Current value of light hsl saturation state */
+ uint16_t target_saturation; /*!< Target value of light hsl saturation state (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_light_hsl_saturation_status_cb_t;
+
+/** Parameters of Light HSL Default Status */
+typedef struct {
+ uint16_t lightness; /*!< Value of light lightness default state */
+ uint16_t hue; /*!< Value of light hue default state */
+ uint16_t saturation; /*!< Value of light saturation default state */
+} esp_ble_mesh_light_hsl_default_status_cb_t;
+
+/** Parameters of Light HSL Range Status */
+typedef struct {
+ uint8_t status_code; /*!< Status code for the request message */
+ uint16_t hue_range_min; /*!< Value of hue range min field of light hsl hue range state */
+ uint16_t hue_range_max; /*!< Value of hue range max field of light hsl hue range state */
+ uint16_t saturation_range_min; /*!< Value of saturation range min field of light hsl saturation range state */
+ uint16_t saturation_range_max; /*!< Value of saturation range max field of light hsl saturation range state */
+} esp_ble_mesh_light_hsl_range_status_cb_t;
+
+/** Parameters of Light xyL Status */
+typedef struct {
+ bool op_en; /*!< Indicate whether optional parameters included */
+ uint16_t xyl_lightness; /*!< The present value of the Light xyL Lightness state */
+ uint16_t xyl_x; /*!< The present value of the Light xyL x state */
+ uint16_t xyl_y; /*!< The present value of the Light xyL y state */
+ uint8_t remain_time; /*!< Time to complete state transition (optional) */
+} esp_ble_mesh_light_xyl_status_cb_t;
+
+/** Parameters of Light xyL Target Status */
+typedef struct {
+ bool op_en; /*!< Indicate whether optional parameters included */
+ uint16_t target_xyl_lightness; /*!< The target value of the Light xyL Lightness state */
+ uint16_t target_xyl_x; /*!< The target value of the Light xyL x state */
+ uint16_t target_xyl_y; /*!< The target value of the Light xyL y state */
+ uint8_t remain_time; /*!< Time to complete state transition (optional) */
+} esp_ble_mesh_light_xyl_target_status_cb_t;
+
+/** Parameters of Light xyL Default Status */
+typedef struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Default state */
+ uint16_t xyl_x; /*!< The value of the Light xyL x Default state */
+ uint16_t xyl_y; /*!< The value of the Light xyL y Default state */
+} esp_ble_mesh_light_xyl_default_status_cb_t;
+
+/** Parameters of Light xyL Range Status */
+typedef struct {
+ uint8_t status_code; /*!< Status Code for the requesting message */
+ uint16_t xyl_x_range_min; /*!< The value of the xyL x Range Min field of the Light xyL x Range state */
+ uint16_t xyl_x_range_max; /*!< The value of the xyL x Range Max field of the Light xyL x Range state */
+ uint16_t xyl_y_range_min; /*!< The value of the xyL y Range Min field of the Light xyL y Range state */
+ uint16_t xyl_y_range_max; /*!< The value of the xyL y Range Max field of the Light xyL y Range state */
+} esp_ble_mesh_light_xyl_range_status_cb_t;
+
+/** Parameter of Light LC Mode Status */
+typedef struct {
+ uint8_t mode; /*!< The present value of the Light LC Mode state */
+} esp_ble_mesh_light_lc_mode_status_cb_t;
+
+/** Parameter of Light LC OM Status */
+typedef struct {
+ uint8_t mode; /*!< The present value of the Light LC Occupancy Mode state */
+} esp_ble_mesh_light_lc_om_status_cb_t;
+
+/** Parameters of Light LC Light OnOff Status */
+typedef struct {
+ bool op_en; /*!< Indicate whether optional parameters included */
+ uint8_t present_light_onoff; /*!< The present value of the Light LC Light OnOff state */
+ uint8_t target_light_onoff; /*!< The target value of the Light LC Light OnOff state (Optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_light_lc_light_onoff_status_cb_t;
+
+/** Parameters of Light LC Property Status */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Light LC Property */
+ struct net_buf_simple *property_value; /*!< Raw value for the Light LC Property */
+} esp_ble_mesh_light_lc_property_status_cb_t;
+
+/**
+ * @brief Lighting Client Model received message union
+ */
+typedef union {
+ esp_ble_mesh_light_lightness_status_cb_t lightness_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS */
+ esp_ble_mesh_light_lightness_linear_status_cb_t lightness_linear_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS */
+ esp_ble_mesh_light_lightness_last_status_cb_t lightness_last_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LAST_STATUS */
+ esp_ble_mesh_light_lightness_default_status_cb_t lightness_default_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_DEFAULT_STATUS */
+ esp_ble_mesh_light_lightness_range_status_cb_t lightness_range_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_RANGE_STATUS */
+ esp_ble_mesh_light_ctl_status_cb_t ctl_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_STATUS */
+ esp_ble_mesh_light_ctl_temperature_status_cb_t ctl_temperature_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS */
+ esp_ble_mesh_light_ctl_temperature_range_status_cb_t ctl_temperature_range_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_RANGE_STATUS */
+ esp_ble_mesh_light_ctl_default_status_cb_t ctl_default_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_CTL_DEFAULT_STATUS */
+ esp_ble_mesh_light_hsl_status_cb_t hsl_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_STATUS */
+ esp_ble_mesh_light_hsl_target_status_cb_t hsl_target_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_TARGET_STATUS */
+ esp_ble_mesh_light_hsl_hue_status_cb_t hsl_hue_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_STATUS */
+ esp_ble_mesh_light_hsl_saturation_status_cb_t hsl_saturation_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_STATUS */
+ esp_ble_mesh_light_hsl_default_status_cb_t hsl_default_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_DEFAULT_STATUS */
+ esp_ble_mesh_light_hsl_range_status_cb_t hsl_range_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_HSL_RANGE_STATUS */
+ esp_ble_mesh_light_xyl_status_cb_t xyl_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_STATUS */
+ esp_ble_mesh_light_xyl_target_status_cb_t xyl_target_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_TARGET_STATUS */
+ esp_ble_mesh_light_xyl_default_status_cb_t xyl_default_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_DEFAULT_STATUS */
+ esp_ble_mesh_light_xyl_range_status_cb_t xyl_range_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_XYL_RANGE_STATUS */
+ esp_ble_mesh_light_lc_mode_status_cb_t lc_mode_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_MODE_STATUS */
+ esp_ble_mesh_light_lc_om_status_cb_t lc_om_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_OM_STATUS */
+ esp_ble_mesh_light_lc_light_onoff_status_cb_t lc_light_onoff_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS */
+ esp_ble_mesh_light_lc_property_status_cb_t lc_property_status; /*!< For ESP_BLE_MESH_MODEL_OP_LIGHT_LC_PROPERTY_STATUS */
+} esp_ble_mesh_light_client_status_cb_t;
+
+/** Lighting Client Model callback parameters */
+typedef struct {
+ int error_code; /*!< Appropriate error code */
+ esp_ble_mesh_client_common_param_t *params; /*!< The client common parameters. */
+ esp_ble_mesh_light_client_status_cb_t status_cb; /*!< The light status message callback values */
+} esp_ble_mesh_light_client_cb_param_t;
+
+/** This enum value is the event of Lighting Client Model */
+typedef enum {
+ ESP_BLE_MESH_LIGHT_CLIENT_GET_STATE_EVT,
+ ESP_BLE_MESH_LIGHT_CLIENT_SET_STATE_EVT,
+ ESP_BLE_MESH_LIGHT_CLIENT_PUBLISH_EVT,
+ ESP_BLE_MESH_LIGHT_CLIENT_TIMEOUT_EVT,
+ ESP_BLE_MESH_LIGHT_CLIENT_EVT_MAX,
+} esp_ble_mesh_light_client_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Light Client Model function.
+ */
+
+/**
+ * @brief Lighting Client Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_light_client_cb_t)(esp_ble_mesh_light_client_cb_event_t event,
+ esp_ble_mesh_light_client_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Light Client Model callback.
+ *
+ * @param[in] callback: pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_light_client_callback(esp_ble_mesh_light_client_cb_t callback);
+
+/**
+ * @brief Get the value of Light Server Model states using the Light Client Model get messages.
+ *
+ * @note If you want to know the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_light_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] get_state: Pointer of light get message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_light_client_get_state_t *get_state);
+
+/**
+ * @brief Set the value of Light Server Model states using the Light Client Model set messages.
+ *
+ * @note If you want to know the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_light_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] set_state: Pointer of light set message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_light_client_set_state_t *set_state);
+
+/**
+ * @brief Lighting Server Models related context.
+ */
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SRV
+ *
+ * @brief Define a new Light Lightness Server Model.
+ *
+ * @note 1. The Light Lightness Server model extends the Generic Power OnOff
+ * Server model and the Generic Level Server model. When this model
+ * is present on an Element, the corresponding Light Lightness Setup
+ * Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_lightness_srv_t.
+ *
+ * @return New Light Lightness Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SETUP_SRV
+ *
+ * @brief Define a new Light Lightness Setup Server Model.
+ *
+ * @note 1. The Light Lightness Setup Server model extends the Light Lightness
+ * Server model and the Generic Power OnOff Setup Server model.
+ * 2. This model shall support model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_lightness_setup_srv_t.
+ *
+ * @return New Light Lightness Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_LIGHTNESS_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_CTL_SRV
+ *
+ * @brief Define a new Light CTL Server Model.
+ *
+ * @note 1. The Light CTL Server model extends the Light Lightness Server model.
+ * When this model is present on an Element, the corresponding Light
+ * CTL Temperature Server model and the corresponding Light CTL Setup
+ * Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ * 3. The model requires two elements: the main element and the Temperature
+ * element. The Temperature element contains the corresponding Light CTL
+ * Temperature Server model and an instance of a Generic Level state
+ * bound to the Light CTL Temperature state on the Temperature element.
+ * The Light CTL Temperature state on the Temperature element is bound to
+ * the Light CTL state on the main element.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_ctl_srv_t.
+ *
+ * @return New Light CTL Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_CTL_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_CTL_SETUP_SRV
+ *
+ * @brief Define a new Light CTL Setup Server Model.
+ *
+ * @note 1. The Light CTL Setup Server model extends the Light CTL Server and
+ * the Light Lightness Setup Server.
+ * 2. This model shall support model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_ctl_setup_srv_t.
+ *
+ * @return New Light CTL Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_CTL_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_CTL_TEMP_SRV
+ *
+ * @brief Define a new Light CTL Temperature Server Model.
+ *
+ * @note 1. The Light CTL Temperature Server model extends the Generic Level
+ * Server model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_ctl_temp_srv_t.
+ *
+ * @return New Light CTL Temperature Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_CTL_TEMP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_HSL_SRV
+ *
+ * @brief Define a new Light HSL Server Model.
+ *
+ * @note 1. The Light HSL Server model extends the Light Lightness Server model. When
+ * this model is present on an Element, the corresponding Light HSL Hue
+ * Server model and the corresponding Light HSL Saturation Server model and
+ * the corresponding Light HSL Setup Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ * 3. The model requires three elements: the main element and the Hue element
+ * and the Saturation element. The Hue element contains the corresponding
+ * Light HSL Hue Server model and an instance of a Generic Level state bound
+ * to the Light HSL Hue state on the Hue element. The Saturation element
+ * contains the corresponding Light HSL Saturation Server model and an
+ * instance of a Generic Level state bound to the Light HSL Saturation state
+ * on the Saturation element. The Light HSL Hue state on the Hue element is
+ * bound to the Light HSL state on the main element and the Light HSL
+ * Saturation state on the Saturation element is bound to the Light HSL state
+ * on the main element.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_srv_t.
+ *
+ * @return New Light HSL Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_HSL_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_HSL_SETUP_SRV
+ *
+ * @brief Define a new Light HSL Setup Server Model.
+ *
+ * @note 1. The Light HSL Setup Server model extends the Light HSL Server and
+ * the Light Lightness Setup Server.
+ * 2. This model shall support model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_setup_srv_t.
+ *
+ * @return New Light HSL Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_HSL_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_HSL_HUE_SRV
+ *
+ * @brief Define a new Light HSL Hue Server Model.
+ *
+ * @note 1. The Light HSL Hue Server model extends the Generic Level Server model.
+ * This model is associated with the Light HSL Server model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_hue_srv_t.
+ *
+ * @return New Light HSL Hue Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_HSL_HUE_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_HSL_SAT_SRV
+ *
+ * @brief Define a new Light HSL Saturation Server Model.
+ *
+ * @note 1. The Light HSL Saturation Server model extends the Generic Level Server
+ * model. This model is associated with the Light HSL Server model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_hsl_sat_srv_t.
+ *
+ * @return New Light HSL Saturation Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_HSL_SAT_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_XYL_SRV
+ *
+ * @brief Define a new Light xyL Server Model.
+ *
+ * @note 1. The Light xyL Server model extends the Light Lightness Server model.
+ * When this model is present on an Element, the corresponding Light xyL
+ * Setup Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_xyl_srv_t.
+ *
+ * @return New Light xyL Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_XYL_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_XYL_SETUP_SRV
+ *
+ * @brief Define a new Light xyL Setup Server Model.
+ *
+ * @note 1. The Light xyL Setup Server model extends the Light xyL Server and
+ * the Light Lightness Setup Server.
+ * 2. This model shall support model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_xyl_setup_srv_t.
+ *
+ * @return New Light xyL Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_XYL_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_LC_SRV
+ *
+ * @brief Define a new Light LC Server Model.
+ *
+ * @note 1. The Light LC (Lightness Control) Server model extends the Light
+ * Lightness Server model and the Generic OnOff Server model. When
+ * this model is present on an Element, the corresponding Light LC
+ * Setup Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ * 3. This model may be used to represent an element that is a client to
+ * a Sensor Server model and controls the Light Lightness Actual state
+ * via defined state bindings.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_lc_srv_t.
+ *
+ * @return New Light LC Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_LC_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_LIGHT_LC_SETUP_SRV
+ *
+ * @brief Define a new Light LC Setup Server Model.
+ *
+ * @note 1. The Light LC (Lightness Control) Setup model extends the Light LC
+ * Server model.
+ * 2. This model shall support model publication and model subscription.
+ * 3. This model may be used to configure setup parameters for the Light
+ * LC Server model.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_light_lc_setup_srv_t.
+ *
+ * @return New Light LC Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_LIGHT_LC_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_LIGHT_LC_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** Parameters of Light Lightness state */
+typedef struct {
+ uint16_t lightness_linear; /*!< The present value of Light Lightness Linear state */
+ uint16_t target_lightness_linear; /*!< The target value of Light Lightness Linear state */
+
+ uint16_t lightness_actual; /*!< The present value of Light Lightness Actual state */
+ uint16_t target_lightness_actual; /*!< The target value of Light Lightness Actual state */
+
+ uint16_t lightness_last; /*!< The value of Light Lightness Last state */
+ uint16_t lightness_default; /*!< The value of Light Lightness Default state */
+
+ uint8_t status_code; /*!< The status code of setting Light Lightness Range state */
+ uint16_t lightness_range_min; /*!< The minimum value of Light Lightness Range state */
+ uint16_t lightness_range_max; /*!< The maximum value of Light Lightness Range state */
+} esp_ble_mesh_light_lightness_state_t;
+
+/** User data of Light Lightness Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting Lightness Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_lightness_state_t *state; /*!< Parameters of the Light Lightness state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t actual_transition; /*!< Parameters of state transition */
+ esp_ble_mesh_state_transition_t linear_transition; /*!< Parameters of state transition */
+ int32_t tt_delta_lightness_actual; /*!< Delta change value of lightness actual state transition */
+ int32_t tt_delta_lightness_linear; /*!< Delta change value of lightness linear state transition */
+} esp_ble_mesh_light_lightness_srv_t;
+
+/** User data of Light Lightness Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting Lightness Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_lightness_state_t *state; /*!< Parameters of the Light Lightness state */
+} esp_ble_mesh_light_lightness_setup_srv_t;
+
+/** Parameters of Light CTL state */
+typedef struct {
+ uint16_t lightness; /*!< The present value of Light CTL Lightness state */
+ uint16_t target_lightness; /*!< The target value of Light CTL Lightness state */
+
+ uint16_t temperature; /*!< The present value of Light CTL Temperature state */
+ uint16_t target_temperature; /*!< The target value of Light CTL Temperature state */
+
+ int16_t delta_uv; /*!< The present value of Light CTL Delta UV state */
+ int16_t target_delta_uv; /*!< The target value of Light CTL Delta UV state */
+
+ uint8_t status_code; /*!< The statue code of setting Light CTL Temperature Range state */
+ uint16_t temperature_range_min; /*!< The minimum value of Light CTL Temperature Range state */
+ uint16_t temperature_range_max; /*!< The maximum value of Light CTL Temperature Range state */
+
+ uint16_t lightness_default; /*!< The value of Light Lightness Default state */
+ uint16_t temperature_default; /*!< The value of Light CTL Temperature Default state */
+ int16_t delta_uv_default; /*!< The value of Light CTL Delta UV Default state */
+} esp_ble_mesh_light_ctl_state_t;
+
+/** User data of Light CTL Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting CTL Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_ctl_state_t *state; /*!< Parameters of the Light CTL state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_lightness; /*!< Delta change value of lightness state transition */
+ int32_t tt_delta_temperature; /*!< Delta change value of temperature state transition */
+ int32_t tt_delta_delta_uv; /*!< Delta change value of delta uv state transition */
+} esp_ble_mesh_light_ctl_srv_t;
+
+/** User data of Light CTL Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting CTL Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_ctl_state_t *state; /*!< Parameters of the Light CTL state */
+} esp_ble_mesh_light_ctl_setup_srv_t;
+
+/** User data of Light CTL Temperature Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting CTL Temperature Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_ctl_state_t *state; /*!< Parameters of the Light CTL state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_temperature; /*!< Delta change value of temperature state transition */
+ int32_t tt_delta_delta_uv; /*!< Delta change value of delta uv state transition */
+} esp_ble_mesh_light_ctl_temp_srv_t;
+
+/** Parameters of Light HSL state */
+typedef struct {
+ uint16_t lightness; /*!< The present value of Light HSL Lightness state */
+ uint16_t target_lightness; /*!< The target value of Light HSL Lightness state */
+
+ uint16_t hue; /*!< The present value of Light HSL Hue state */
+ uint16_t target_hue; /*!< The target value of Light HSL Hue state */
+
+ uint16_t saturation; /*!< The present value of Light HSL Saturation state */
+ uint16_t target_saturation; /*!< The target value of Light HSL Saturation state */
+
+ uint16_t lightness_default; /*!< The value of Light Lightness Default state */
+ uint16_t hue_default; /*!< The value of Light HSL Hue Default state */
+ uint16_t saturation_default; /*!< The value of Light HSL Saturation Default state */
+
+ uint8_t status_code; /*!< The status code of setting Light HSL Hue & Saturation Range state */
+ uint16_t hue_range_min; /*!< The minimum value of Light HSL Hue Range state */
+ uint16_t hue_range_max; /*!< The maximum value of Light HSL Hue Range state */
+ uint16_t saturation_range_min; /*!< The minimum value of Light HSL Saturation state */
+ uint16_t saturation_range_max; /*!< The maximum value of Light HSL Saturation state */
+} esp_ble_mesh_light_hsl_state_t;
+
+/** User data of Light HSL Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting HSL Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_hsl_state_t *state; /*!< Parameters of the Light HSL state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_lightness; /*!< Delta change value of lightness state transition */
+ int32_t tt_delta_hue; /*!< Delta change value of hue state transition */
+ int32_t tt_delta_saturation; /*!< Delta change value of saturation state transition */
+} esp_ble_mesh_light_hsl_srv_t;
+
+/** User data of Light HSL Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting HSL Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_hsl_state_t *state; /*!< Parameters of the Light HSL state */
+} esp_ble_mesh_light_hsl_setup_srv_t;
+
+/** User data of Light HSL Hue Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting HSL Hue Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_hsl_state_t *state; /*!< Parameters of the Light HSL state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_hue; /*!< Delta change value of hue state transition */
+} esp_ble_mesh_light_hsl_hue_srv_t;
+
+/** User data of Light HSL Saturation Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting HSL Saturation Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_hsl_state_t *state; /*!< Parameters of the Light HSL state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_saturation; /*!< Delta change value of saturation state transition */
+} esp_ble_mesh_light_hsl_sat_srv_t;
+
+/** Parameters of Light xyL state */
+typedef struct {
+ uint16_t lightness; /*!< The present value of Light xyL Lightness state */
+ uint16_t target_lightness; /*!< The target value of Light xyL Lightness state */
+
+ uint16_t x; /*!< The present value of Light xyL x state */
+ uint16_t target_x; /*!< The target value of Light xyL x state */
+
+ uint16_t y; /*!< The present value of Light xyL y state */
+ uint16_t target_y; /*!< The target value of Light xyL y state */
+
+ uint16_t lightness_default; /*!< The value of Light Lightness Default state */
+ uint16_t x_default; /*!< The value of Light xyL x Default state */
+ uint16_t y_default; /*!< The value of Light xyL y Default state */
+
+ uint8_t status_code; /*!< The status code of setting Light xyL x & y Range state */
+ uint16_t x_range_min; /*!< The minimum value of Light xyL x Range state */
+ uint16_t x_range_max; /*!< The maximum value of Light xyL x Range state */
+ uint16_t y_range_min; /*!< The minimum value of Light xyL y Range state */
+ uint16_t y_range_max; /*!< The maximum value of Light xyL y Range state */
+} esp_ble_mesh_light_xyl_state_t;
+
+/** User data of Light xyL Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting xyL Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_xyl_state_t *state; /*!< Parameters of the Light xyL state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+ int32_t tt_delta_lightness; /*!< Delta change value of lightness state transition */
+ int32_t tt_delta_x; /*!< Delta change value of x state transition */
+ int32_t tt_delta_y; /*!< Delta change value of y state transition */
+} esp_ble_mesh_light_xyl_srv_t;
+
+/** User data of Light xyL Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting xyL Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_xyl_state_t *state; /*!< Parameters of the Light xyL state */
+} esp_ble_mesh_light_xyl_setup_srv_t;
+
+/** Parameters of Light LC states */
+typedef struct {
+ /**
+ * 0b0 The controller is turned off.
+ * - The binding with the Light Lightness state is disabled.
+ * 0b1 The controller is turned on.
+ * - The binding with the Light Lightness state is enabled.
+ */
+ uint32_t mode : 1, /*!< The value of Light LC Mode state */
+ occupancy_mode : 1, /*!< The value of Light LC Occupancy Mode state */
+ light_onoff : 1, /*!< The present value of Light LC Light OnOff state */
+ target_light_onoff : 1, /*!< The target value of Light LC Light OnOff state */
+ occupancy : 1, /*!< The value of Light LC Occupancy state */
+ ambient_luxlevel : 24; /*!< The value of Light LC Ambient LuxLevel state */
+
+ /**
+ * 1. Light LC Linear Output = max((Lightness Out)^2/65535, Regulator Output)
+ * 2. If the Light LC Mode state is set to 0b1, the binding is enabled and upon
+ * a change of the Light LC Linear Output state, the following operation
+ * shall be performed:
+ * Light Lightness Linear = Light LC Linear Output
+ * 3. If the Light LC Mode state is set to 0b0, the binding is disabled (i.e.,
+ * upon a change of the Light LC Linear Output state, no operation on the
+ * Light Lightness Linear state is performed).
+ */
+ uint16_t linear_output; /*!< The value of Light LC Linear Output state */
+} esp_ble_mesh_light_lc_state_t;
+
+/**
+ * Parameters of Light Property states.
+ * The Light LC Property states are read / write states that determine the
+ * configuration of a Light Lightness Controller. Each state is represented
+ * by a device property and is controlled by Light LC Property messages.
+ */
+typedef struct {
+ /**
+ * A timing state that determines the delay for changing the Light LC
+ * Occupancy state upon receiving a Sensor Status message from an
+ * occupancy sensor.
+ */
+ uint32_t time_occupancy_delay; /*!< The value of Light LC Time Occupancy Delay state */
+ /**
+ * A timing state that determines the time the controlled lights fade
+ * to the level determined by the Light LC Lightness On state.
+ */
+ uint32_t time_fade_on; /*!< The value of Light LC Time Fade On state */
+ /**
+ * A timing state that determines the time the controlled lights stay
+ * at the level determined by the Light LC Lightness On state.
+ */
+ uint32_t time_run_on; /*!< The value of Light LC Time Run On state */
+ /**
+ * A timing state that determines the time the controlled lights fade
+ * from the level determined by the Light LC Lightness On state to the
+ * level determined by the Light Lightness Prolong state.
+ */
+ uint32_t time_fade; /*!< The value of Light LC Time Fade state */
+ /**
+ * A timing state that determines the time the controlled lights stay at
+ * the level determined by the Light LC Lightness Prolong state.
+ */
+ uint32_t time_prolong; /*!< The value of Light LC Time Prolong state */
+ /**
+ * A timing state that determines the time the controlled lights fade from
+ * the level determined by the Light LC Lightness Prolong state to the level
+ * determined by the Light LC Lightness Standby state when the transition is
+ * automatic.
+ */
+ uint32_t time_fade_standby_auto; /*!< The value of Light LC Time Fade Standby Auto state */
+ /**
+ * A timing state that determines the time the controlled lights fade from
+ * the level determined by the Light LC Lightness Prolong state to the level
+ * determined by the Light LC Lightness Standby state when the transition is
+ * triggered by a change in the Light LC Light OnOff state.
+ */
+ uint32_t time_fade_standby_manual; /*!< The value of Light LC Time Fade Standby Manual state */
+
+ /**
+ * A lightness state that determines the perceptive light lightness at the
+ * Occupancy and Run internal controller states.
+ */
+ uint16_t lightness_on; /*!< The value of Light LC Lightness On state */
+ /**
+ * A lightness state that determines the light lightness at the Prolong
+ * internal controller state.
+ */
+ uint16_t lightness_prolong; /*!< The value of Light LC Lightness Prolong state */
+ /**
+ * A lightness state that determines the light lightness at the Standby
+ * internal controller state.
+ */
+ uint16_t lightness_standby; /*!< The value of Light LC Lightness Standby state */
+
+ /**
+ * A uint16 state representing the Ambient LuxLevel level that determines
+ * if the controller transitions from the Light Control Standby state.
+ */
+ uint16_t ambient_luxlevel_on; /*!< The value of Light LC Ambient LuxLevel On state */
+ /**
+ * A uint16 state representing the required Ambient LuxLevel level in the
+ * Prolong state.
+ */
+ uint16_t ambient_luxlevel_prolong; /*!< The value of Light LC Ambient LuxLevel Prolong state */
+ /**
+ * A uint16 state representing the required Ambient LuxLevel level in the
+ * Standby state.
+ */
+ uint16_t ambient_luxlevel_standby; /*!< The value of Light LC Ambient LuxLevel Standby state */
+
+ /**
+ * A float32 state representing the integral coefficient that determines the
+ * integral part of the equation defining the output of the Light LC PI
+ * Feedback Regulator, when Light LC Ambient LuxLevel is less than LuxLevel
+ * Out. Valid range: 0.0 ~ 1000.0. The default value is 250.0.
+ */
+ float regulator_kiu; /*!< The value of Light LC Regulator Kiu state */
+ /**
+ * A float32 state representing the integral coefficient that determines the
+ * integral part of the equation defining the output of the Light LC PI
+ * Feedback Regulator, when Light LC Ambient LuxLevel is greater than or equal
+ * to the value of the LuxLevel Out state. Valid range: 0.0 ~ 1000.0. The
+ * default value is 25.0.
+ */
+ float regulator_kid; /*!< The value of Light LC Regulator Kid state */
+ /**
+ * A float32 state representing the proportional coefficient that determines
+ * the proportional part of the equation defining the output of the Light LC
+ * PI Feedback Regulator, when Light LC Ambient LuxLevel is less than the value
+ * of the LuxLevel Out state. Valid range: 0.0 ~ 1000.0. The default value is 80.0.
+ */
+ float regulator_kpu; /*!< The value of Light LC Regulator Kpu state */
+ /**
+ * A float32 state representing the proportional coefficient that determines
+ * the proportional part of the equation defining the output of the Light LC PI
+ * Feedback Regulator, when Light LC Ambient LuxLevel is greater than or equal
+ * to the value of the LuxLevel Out state. Valid range: 0.0 ~ 1000.0. The default
+ * value is 80.0.
+ */
+ float regulator_kpd; /*!< The value of Light LC Regulator Kpd state */
+ /**
+ * A int8 state representing the percentage accuracy of the Light LC PI Feedback
+ * Regulator. Valid range: 0.0 ~ 100.0. The default value is 2.0.
+ */
+ int8_t regulator_accuracy; /*!< The value of Light LC Regulator Accuracy state */
+
+ /**
+ * If the message Raw field contains a Raw Value for the Time Since Motion
+ * Sensed device property, which represents a value less than or equal to
+ * the value of the Light LC Occupancy Delay state, it shall delay setting
+ * the Light LC Occupancy state to 0b1 by the difference between the value
+ * of the Light LC Occupancy Delay state and the received Time Since Motion
+ * value.
+ */
+ uint32_t set_occupancy_to_1_delay; /*!< The value of the difference between value of the
+ Light LC Occupancy Delay state and the received
+ Time Since Motion value */
+} esp_ble_mesh_light_lc_property_state_t;
+
+/** This enum value is the Light LC State Machine states */
+typedef enum {
+ ESP_BLE_MESH_LC_OFF,
+ ESP_BLE_MESH_LC_STANDBY,
+ ESP_BLE_MESH_LC_FADE_ON,
+ ESP_BLE_MESH_LC_RUN,
+ ESP_BLE_MESH_LC_FADE,
+ ESP_BLE_MESH_LC_PROLONG,
+ ESP_BLE_MESH_LC_FADE_STANDBY_AUTO,
+ ESP_BLE_MESH_LC_FADE_STANDBY_MANUAL,
+} esp_ble_mesh_lc_state_t;
+
+/** Parameters of Light LC state machine */
+typedef struct {
+ /**
+ * The Fade On, Fade, Fade Standby Auto, and Fade Standby Manual states are
+ * transition states that define the transition of the Lightness Out and
+ * LuxLevel Out states. This transition can be started as a result of the
+ * Light LC State Machine change or as a result of receiving the Light LC
+ * Light OnOff Set or Light LC Light Set Unacknowledged message.
+ */
+ struct {
+ uint8_t fade_on; /*!< The value of transition time of Light LC Time Fade On */
+ uint8_t fade; /*!< The value of transition time of Light LC Time Fade */
+ uint8_t fade_standby_auto; /*!< The value of transition time of Light LC Time Fade Standby Auto */
+ uint8_t fade_standby_manual; /*!< The value of transition time of Light LC Time Fade Standby Manual */
+ } trans_time; /*!< The value of transition time */
+ esp_ble_mesh_lc_state_t state; /*!< The value of Light LC state machine state */
+ struct k_delayed_work timer; /*!< Timer of Light LC state machine */
+} esp_ble_mesh_light_lc_state_machine_t;
+
+/** Parameters of Light Lightness controller */
+typedef struct {
+ esp_ble_mesh_light_lc_state_t state; /*!< Parameters of Light LC state */
+ esp_ble_mesh_light_lc_property_state_t prop_state; /*!< Parameters of Light LC Property state */
+ esp_ble_mesh_light_lc_state_machine_t state_machine; /*!< Parameters of Light LC state machine */
+} esp_ble_mesh_light_control_t;
+
+/** User data of Light LC Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting LC Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_control_t *lc; /*!< Parameters of the Light controller */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+} esp_ble_mesh_light_lc_srv_t;
+
+/** User data of Light LC Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Lighting LC Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_light_control_t *lc; /*!< Parameters of the Light controller */
+} esp_ble_mesh_light_lc_setup_srv_t;
+
+/** Parameter of Light Lightness Actual state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light Lightness Actual state */
+} esp_ble_mesh_state_change_light_lightness_set_t;
+
+/** Parameter of Light Lightness Linear state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light Lightness Linear state */
+} esp_ble_mesh_state_change_light_lightness_linear_set_t;
+
+/** Parameter of Light Lightness Default state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light Lightness Default state */
+} esp_ble_mesh_state_change_light_lightness_default_set_t;
+
+/** Parameters of Light Lightness Range state change event */
+typedef struct {
+ uint16_t range_min; /*!< The minimum value of Light Lightness Range state */
+ uint16_t range_max; /*!< The maximum value of Light Lightness Range state */
+} esp_ble_mesh_state_change_light_lightness_range_set_t;
+
+/** Parameters of Light CTL state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light CTL Lightness state */
+ uint16_t temperature; /*!< The value of Light CTL Temperature state */
+ int16_t delta_uv; /*!< The value of Light CTL Delta UV state */
+} esp_ble_mesh_state_change_light_ctl_set_t;
+
+/** Parameters of Light CTL Temperature state change event */
+typedef struct {
+ uint16_t temperature; /*!< The value of Light CTL Temperature state */
+ int16_t delta_uv; /*!< The value of Light CTL Delta UV state */
+} esp_ble_mesh_state_change_light_ctl_temperature_set_t;
+
+/** Parameters of Light CTL Temperature Range state change event */
+typedef struct {
+ uint16_t range_min; /*!< The minimum value of Light CTL Temperature Range state */
+ uint16_t range_max; /*!< The maximum value of Light CTL Temperature Range state */
+} esp_ble_mesh_state_change_light_ctl_temperature_range_set_t;
+
+/** Parameters of Light CTL Default state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light Lightness Default state */
+ uint16_t temperature; /*!< The value of Light CTL Temperature Default state */
+ int16_t delta_uv; /*!< The value of Light CTL Delta UV Default state */
+} esp_ble_mesh_state_change_light_ctl_default_set_t;
+
+/** Parameters of Light HSL state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light HSL Lightness state */
+ uint16_t hue; /*!< The value of Light HSL Hue state */
+ uint16_t saturation; /*!< The value of Light HSL Saturation state */
+} esp_ble_mesh_state_change_light_hsl_set_t;
+
+/** Parameter of Light HSL Hue state change event */
+typedef struct {
+ uint16_t hue; /*!< The value of Light HSL Hue state */
+} esp_ble_mesh_state_change_light_hsl_hue_set_t;
+
+/** Parameter of Light HSL Saturation state change event */
+typedef struct {
+ uint16_t saturation; /*!< The value of Light HSL Saturation state */
+} esp_ble_mesh_state_change_light_hsl_saturation_set_t;
+
+/** Parameters of Light HSL Default state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light HSL Lightness Default state */
+ uint16_t hue; /*!< The value of Light HSL Hue Default state */
+ uint16_t saturation; /*!< The value of Light HSL Saturation Default state */
+} esp_ble_mesh_state_change_light_hsl_default_set_t;
+
+/** Parameters of Light HSL Range state change event */
+typedef struct {
+ uint16_t hue_range_min; /*!< The minimum hue value of Light HSL Range state */
+ uint16_t hue_range_max; /*!< The maximum hue value of Light HSL Range state */
+ uint16_t saturation_range_min; /*!< The minimum saturation value of Light HSL Range state */
+ uint16_t saturation_range_max; /*!< The maximum saturation value of Light HSL Range state */
+} esp_ble_mesh_state_change_light_hsl_range_set_t;
+
+/** Parameters of Light xyL state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light xyL Lightness state */
+ uint16_t x; /*!< The value of Light xyL x state */
+ uint16_t y; /*!< The value of Light xyL y state */
+} esp_ble_mesh_state_change_light_xyl_set_t;
+
+/** Parameters of Light xyL Default state change event */
+typedef struct {
+ uint16_t lightness; /*!< The value of Light Lightness Default state */
+ uint16_t x; /*!< The value of Light xyL x Default state */
+ uint16_t y; /*!< The value of Light xyL y Default state */
+} esp_ble_mesh_state_change_light_xyl_default_set_t;
+
+/** Parameters of Light xyL Range state change event */
+typedef struct {
+ uint16_t x_range_min; /*!< The minimum value of Light xyL x Range state */
+ uint16_t x_range_max; /*!< The maximum value of Light xyL x Range state */
+ uint16_t y_range_min; /*!< The minimum value of Light xyL y Range state */
+ uint16_t y_range_max; /*!< The maximum value of Light xyL y Range state */
+} esp_ble_mesh_state_change_light_xyl_range_set_t;
+
+/** Parameter of Light LC Mode state change event */
+typedef struct {
+ uint8_t mode; /*!< The value of Light LC Mode state */
+} esp_ble_mesh_state_change_light_lc_mode_set_t;
+
+/** Parameter of Light LC Occupancy Mode state change event */
+typedef struct {
+ uint8_t mode; /*!< The value of Light LC Occupancy Mode state */
+} esp_ble_mesh_state_change_light_lc_om_set_t;
+
+/** Parameter of Light LC Light OnOff state change event */
+typedef struct {
+ uint8_t onoff; /*!< The value of Light LC Light OnOff state */
+} esp_ble_mesh_state_change_light_lc_light_onoff_set_t;
+
+/** Parameters of Light LC Property state change event */
+typedef struct {
+ uint16_t property_id; /*!< The property id of Light LC Property state */
+ struct net_buf_simple *property_value; /*!< The property value of Light LC Property state */
+} esp_ble_mesh_state_change_light_lc_property_set_t;
+
+/** Parameters of Sensor Status state change event */
+typedef struct {
+ uint16_t property_id; /*!< The value of Sensor Property ID */
+ /** Parameters of Sensor Status related state */
+ union {
+ uint8_t occupancy; /*!< The value of Light LC Occupancy state */
+ uint32_t set_occupancy_to_1_delay; /*!< The value of Light LC Set Occupancy to 1 Delay state */
+ uint32_t ambient_luxlevel; /*!< The value of Light LC Ambient Luxlevel state */
+ } state;
+} esp_ble_mesh_state_change_sensor_status_t;
+
+/**
+ * @brief Lighting Server Model state change value union
+ */
+typedef union {
+ /**
+ * The recv_op in ctx can be used to decide which state is changed.
+ */
+ esp_ble_mesh_state_change_light_lightness_set_t lightness_set; /*!< Light Lightness Set */
+ esp_ble_mesh_state_change_light_lightness_linear_set_t lightness_linear_set; /*!< Light Lightness Linear Set */
+ esp_ble_mesh_state_change_light_lightness_default_set_t lightness_default_set; /*!< Light Lightness Default Set */
+ esp_ble_mesh_state_change_light_lightness_range_set_t lightness_range_set; /*!< Light Lightness Range Set */
+ esp_ble_mesh_state_change_light_ctl_set_t ctl_set; /*!< Light CTL Set */
+ esp_ble_mesh_state_change_light_ctl_temperature_set_t ctl_temp_set; /*!< Light CTL Temperature Set */
+ esp_ble_mesh_state_change_light_ctl_temperature_range_set_t ctl_temp_range_set; /*!< Light CTL Temperature Range Set */
+ esp_ble_mesh_state_change_light_ctl_default_set_t ctl_default_set; /*!< Light CTL Default Set */
+ esp_ble_mesh_state_change_light_hsl_set_t hsl_set; /*!< Light HSL Set */
+ esp_ble_mesh_state_change_light_hsl_hue_set_t hsl_hue_set; /*!< Light HSL Hue Set */
+ esp_ble_mesh_state_change_light_hsl_saturation_set_t hsl_saturation_set; /*!< Light HSL Saturation Set */
+ esp_ble_mesh_state_change_light_hsl_default_set_t hsl_default_set; /*!< Light HSL Default Set */
+ esp_ble_mesh_state_change_light_hsl_range_set_t hsl_range_set; /*!< Light HSL Range Set */
+ esp_ble_mesh_state_change_light_xyl_set_t xyl_set; /*!< Light xyL Set */
+ esp_ble_mesh_state_change_light_xyl_default_set_t xyl_default_set; /*!< Light xyL Default Set */
+ esp_ble_mesh_state_change_light_xyl_range_set_t xyl_range_set; /*!< Light xyL Range Set */
+ esp_ble_mesh_state_change_light_lc_mode_set_t lc_mode_set; /*!< Light LC Mode Set */
+ esp_ble_mesh_state_change_light_lc_om_set_t lc_om_set; /*!< Light LC Occupancy Mode Set */
+ esp_ble_mesh_state_change_light_lc_light_onoff_set_t lc_light_onoff_set; /*!< Light LC Light OnOff Set */
+ esp_ble_mesh_state_change_light_lc_property_set_t lc_property_set; /*!< Light LC Property Set */
+ esp_ble_mesh_state_change_sensor_status_t sensor_status; /*!< Sensor Status */
+} esp_ble_mesh_lighting_server_state_change_t;
+
+/** Context of the received Light LC Property Get message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Light LC Property */
+} esp_ble_mesh_server_recv_light_lc_property_get_t;
+
+/**
+ * @brief Lighting Server Model received get message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_light_lc_property_get_t lc_property; /*!< Light LC Property Get */
+} esp_ble_mesh_lighting_server_recv_get_msg_t;
+
+/** Context of the received Light Lightness Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t lightness; /*!< Target value of light lightness actual state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_lightness_set_t;
+
+/** Context of the received Light Lightness Linear Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t lightness; /*!< Target value of light lightness linear state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_lightness_linear_set_t;
+
+/** Context of the received Light Lightness Default Set message */
+typedef struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Default state */
+} esp_ble_mesh_server_recv_light_lightness_default_set_t;
+
+/** Context of the received Light Lightness Range Set message */
+typedef struct {
+ uint16_t range_min; /*!< Value of range min field of light lightness range state */
+ uint16_t range_max; /*!< Value of range max field of light lightness range state */
+} esp_ble_mesh_server_recv_light_lightness_range_set_t;
+
+/** Context of the received Light CTL Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t lightness; /*!< Target value of light ctl lightness state */
+ uint16_t temperature; /*!< Target value of light ctl temperature state */
+ int16_t delta_uv; /*!< Target value of light ctl delta UV state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_ctl_set_t;
+
+/** Context of the received Light CTL Temperature Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t temperature; /*!< Target value of light ctl temperature state */
+ int16_t delta_uv; /*!< Target value of light ctl delta UV state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_ctl_temperature_set_t;
+
+/** Context of the received Light CTL Temperature Range Set message */
+typedef struct {
+ uint16_t range_min; /*!< Value of temperature range min field of light ctl temperature range state */
+ uint16_t range_max; /*!< Value of temperature range max field of light ctl temperature range state */
+} esp_ble_mesh_server_recv_light_ctl_temperature_range_set_t;
+
+/** Context of the received Light CTL Default Set message */
+typedef struct {
+ uint16_t lightness; /*!< Value of light lightness default state */
+ uint16_t temperature; /*!< Value of light temperature default state */
+ int16_t delta_uv; /*!< Value of light delta UV default state */
+} esp_ble_mesh_server_recv_light_ctl_default_set_t;
+
+/** Context of the received Light HSL Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t lightness; /*!< Target value of light hsl lightness state */
+ uint16_t hue; /*!< Target value of light hsl hue state */
+ uint16_t saturation; /*!< Target value of light hsl saturation state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_hsl_set_t;
+
+/** Context of the received Light HSL Hue Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t hue; /*!< Target value of light hsl hue state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_hsl_hue_set_t;
+
+/** Context of the received Light HSL Saturation Set message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t saturation; /*!< Target value of light hsl hue state */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_hsl_saturation_set_t;
+
+/** Context of the received Light HSL Default Set message */
+typedef struct {
+ uint16_t lightness; /*!< Value of light lightness default state */
+ uint16_t hue; /*!< Value of light hue default state */
+ uint16_t saturation; /*!< Value of light saturation default state */
+} esp_ble_mesh_server_recv_light_hsl_default_set_t;
+
+/** Context of the received Light HSL Range Set message */
+typedef struct {
+ uint16_t hue_range_min; /*!< Value of hue range min field of light hsl hue range state */
+ uint16_t hue_range_max; /*!< Value of hue range max field of light hsl hue range state */
+ uint16_t saturation_range_min; /*!< Value of saturation range min field of light hsl saturation range state */
+ uint16_t saturation_range_max; /*!< Value of saturation range max field of light hsl saturation range state */
+} esp_ble_mesh_server_recv_light_hsl_range_set_t;
+
+/** Context of the received Light xyL Set message */
+typedef struct {
+ bool op_en; /*!< Indicate whether optional parameters included */
+ uint16_t lightness; /*!< The target value of the Light xyL Lightness state */
+ uint16_t x; /*!< The target value of the Light xyL x state */
+ uint16_t y; /*!< The target value of the Light xyL y state */
+ uint8_t tid; /*!< Transaction Identifier */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_xyl_set_t;
+
+/** Context of the received Light xyL Default Set message */
+typedef struct {
+ uint16_t lightness; /*!< The value of the Light Lightness Default state */
+ uint16_t x; /*!< The value of the Light xyL x Default state */
+ uint16_t y; /*!< The value of the Light xyL y Default state */
+} esp_ble_mesh_server_recv_light_xyl_default_set_t;
+
+/** Context of the received Light xyl Range Set message */
+typedef struct {
+ uint16_t x_range_min; /*!< The value of the xyL x Range Min field of the Light xyL x Range state */
+ uint16_t x_range_max; /*!< The value of the xyL x Range Max field of the Light xyL x Range state */
+ uint16_t y_range_min; /*!< The value of the xyL y Range Min field of the Light xyL y Range state */
+ uint16_t y_range_max; /*!< The value of the xyL y Range Max field of the Light xyL y Range state */
+} esp_ble_mesh_server_recv_light_xyl_range_set_t;
+
+/** Context of the received Light LC Mode Set message */
+typedef struct {
+ uint8_t mode; /*!< The target value of the Light LC Mode state */
+} esp_ble_mesh_server_recv_light_lc_mode_set_t;
+
+/** Context of the received Light OM Set message */
+typedef struct {
+ uint8_t mode; /*!< The target value of the Light LC Occupancy Mode state */
+} esp_ble_mesh_server_recv_light_lc_om_set_t;
+
+/** Context of the received Light LC Light OnOff Set message */
+typedef struct {
+ bool op_en; /*!< Indicate whether optional parameters included */
+ uint8_t light_onoff; /*!< The target value of the Light LC Light OnOff state */
+ uint8_t tid; /*!< Transaction Identifier */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_light_lc_light_onoff_set_t;
+
+/** Context of the received Light LC Property Set message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a Light LC Property */
+ struct net_buf_simple *property_value; /*!< Raw value for the Light LC Property */
+} esp_ble_mesh_server_recv_light_lc_property_set_t;
+
+/**
+ * @brief Lighting Server Model received set message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_light_lightness_set_t lightness; /*!< Light Lightness Set/Light Lightness Set Unack */
+ esp_ble_mesh_server_recv_light_lightness_linear_set_t lightness_linear; /*!< Light Lightness Linear Set/Light Lightness Linear Set Unack */
+ esp_ble_mesh_server_recv_light_lightness_default_set_t lightness_default; /*!< Light Lightness Default Set/Light Lightness Default Set Unack */
+ esp_ble_mesh_server_recv_light_lightness_range_set_t lightness_range; /*!< Light Lightness Range Set/Light Lightness Range Set Unack */
+ esp_ble_mesh_server_recv_light_ctl_set_t ctl; /*!< Light CTL Set/Light CTL Set Unack */
+ esp_ble_mesh_server_recv_light_ctl_temperature_set_t ctl_temp; /*!< Light CTL Temperature Set/Light CTL Temperature Set Unack */
+ esp_ble_mesh_server_recv_light_ctl_temperature_range_set_t ctl_temp_range; /*!< Light CTL Temperature Range Set/Light CTL Temperature Range Set Unack */
+ esp_ble_mesh_server_recv_light_ctl_default_set_t ctl_default; /*!< Light CTL Default Set/Light CTL Default Set Unack */
+ esp_ble_mesh_server_recv_light_hsl_set_t hsl; /*!< Light HSL Set/Light HSL Set Unack */
+ esp_ble_mesh_server_recv_light_hsl_hue_set_t hsl_hue; /*!< Light HSL Hue Set/Light HSL Hue Set Unack */
+ esp_ble_mesh_server_recv_light_hsl_saturation_set_t hsl_saturation; /*!< Light HSL Saturation Set/Light HSL Saturation Set Unack */
+ esp_ble_mesh_server_recv_light_hsl_default_set_t hsl_default; /*!< Light HSL Default Set/Light HSL Default Set Unack */
+ esp_ble_mesh_server_recv_light_hsl_range_set_t hsl_range; /*!< Light HSL Range Set/Light HSL Range Set Unack */
+ esp_ble_mesh_server_recv_light_xyl_set_t xyl; /*!< Light xyL Set/Light xyL Set Unack */
+ esp_ble_mesh_server_recv_light_xyl_default_set_t xyl_default; /*!< Light xyL Default Set/Light xyL Default Set Unack */
+ esp_ble_mesh_server_recv_light_xyl_range_set_t xyl_range; /*!< Light xyL Range Set/Light xyL Range Set Unack */
+ esp_ble_mesh_server_recv_light_lc_mode_set_t lc_mode; /*!< Light LC Mode Set/Light LC Mode Set Unack */
+ esp_ble_mesh_server_recv_light_lc_om_set_t lc_om; /*!< Light LC OM Set/Light LC OM Set Unack */
+ esp_ble_mesh_server_recv_light_lc_light_onoff_set_t lc_light_onoff; /*!< Light LC Light OnOff Set/Light LC Light OnOff Set Unack */
+ esp_ble_mesh_server_recv_light_lc_property_set_t lc_property; /*!< Light LC Property Set/Light LC Property Set Unack */
+} esp_ble_mesh_lighting_server_recv_set_msg_t;
+
+/** Context of the received Sensor Status message */
+typedef struct {
+ struct net_buf_simple *data; /*!< Value of sensor data state (optional) */
+} esp_ble_mesh_server_recv_sensor_status_t;
+
+/**
+ * @brief Lighting Server Model received status message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_sensor_status_t sensor_status; /*!< Sensor Status */
+} esp_ble_mesh_lighting_server_recv_status_msg_t;
+
+/**
+ * @brief Lighting Server Model callback value union
+ */
+typedef union {
+ esp_ble_mesh_lighting_server_state_change_t state_change; /*!< ESP_BLE_MESH_LIGHTING_SERVER_STATE_CHANGE_EVT */
+ esp_ble_mesh_lighting_server_recv_get_msg_t get; /*!< ESP_BLE_MESH_LIGHTING_SERVER_RECV_GET_MSG_EVT */
+ esp_ble_mesh_lighting_server_recv_set_msg_t set; /*!< ESP_BLE_MESH_LIGHTING_SERVER_RECV_SET_MSG_EVT */
+ esp_ble_mesh_lighting_server_recv_status_msg_t status; /*!< ESP_BLE_MESH_LIGHTING_SERVER_RECV_STATUS_MSG_EVT */
+} esp_ble_mesh_lighting_server_cb_value_t;
+
+/** Lighting Server Model callback parameters */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to Lighting Server Models */
+ esp_ble_mesh_msg_ctx_t ctx; /*!< Context of the received messages */
+ esp_ble_mesh_lighting_server_cb_value_t value; /*!< Value of the received Lighting Messages */
+} esp_ble_mesh_lighting_server_cb_param_t;
+
+/** This enum value is the event of Lighting Server Model */
+typedef enum {
+ /**
+ * 1. When get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, no event will be
+ * callback to the application layer when Lighting Get messages are received.
+ * 2. When set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, this event will
+ * be callback to the application layer when Lighting Set/Set Unack messages
+ * are received.
+ */
+ ESP_BLE_MESH_LIGHTING_SERVER_STATE_CHANGE_EVT,
+ /**
+ * When get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Lighting Get messages are received.
+ */
+ ESP_BLE_MESH_LIGHTING_SERVER_RECV_GET_MSG_EVT,
+ /**
+ * When set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Lighting Set/Set Unack messages are received.
+ */
+ ESP_BLE_MESH_LIGHTING_SERVER_RECV_SET_MSG_EVT,
+ /**
+ * When status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will
+ * be callback to the application layer when Sensor Status message is received.
+ */
+ ESP_BLE_MESH_LIGHTING_SERVER_RECV_STATUS_MSG_EVT,
+ ESP_BLE_MESH_LIGHTING_SERVER_EVT_MAX,
+} esp_ble_mesh_lighting_server_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Lighting Server Model function.
+ */
+
+/**
+ * @brief Lighting Server Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_lighting_server_cb_t)(esp_ble_mesh_lighting_server_cb_event_t event,
+ esp_ble_mesh_lighting_server_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Lighting Server Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_lighting_server_callback(esp_ble_mesh_lighting_server_cb_t callback);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_LIGHTING_MODEL_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_sensor_model_api.h b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_sensor_model_api.h
new file mode 100644
index 00000000..ba72c223
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_sensor_model_api.h
@@ -0,0 +1,709 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/** @file
+ * @brief Bluetooth Mesh Sensor Client Model APIs.
+ */
+
+#ifndef _ESP_BLE_MESH_SENSOR_MODEL_API_H_
+#define _ESP_BLE_MESH_SENSOR_MODEL_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @def ESP_BLE_MESH_MODEL_SENSOR_CLI
+ *
+ * @brief Define a new Sensor Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Sensor Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Sensor Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SENSOR_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SENSOR_CLI, \
+ NULL, cli_pub, cli_data)
+
+/**
+ * @brief Bluetooth Mesh Sensor Client Model Get and Set parameters structure.
+ */
+
+/** Parameters of Sensor Descriptor Get */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property ID of a sensor (optional) */
+} esp_ble_mesh_sensor_descriptor_get_t;
+
+/** Parameter of Sensor Cadence Get */
+typedef struct {
+ uint16_t property_id; /*!< Property ID of a sensor */
+} esp_ble_mesh_sensor_cadence_get_t;
+
+/** Parameters of Sensor Cadence Set */
+typedef struct {
+ uint16_t property_id; /*!< Property ID for the sensor */
+ uint8_t fast_cadence_period_divisor : 7, /*!< Divisor for the publish period */
+ status_trigger_type : 1; /*!< The unit and format of the Status Trigger Delta fields */
+ struct net_buf_simple *status_trigger_delta_down; /*!< Delta down value that triggers a status message */
+ struct net_buf_simple *status_trigger_delta_up; /*!< Delta up value that triggers a status message */
+ uint8_t status_min_interval; /*!< Minimum interval between two consecutive Status messages */
+ struct net_buf_simple *fast_cadence_low; /*!< Low value for the fast cadence range */
+ struct net_buf_simple *fast_cadence_high; /*!< Fast value for the fast cadence range */
+} esp_ble_mesh_sensor_cadence_set_t;
+
+/** Parameter of Sensor Settings Get */
+typedef struct {
+ uint16_t sensor_property_id; /*!< Property ID of a sensor */
+} esp_ble_mesh_sensor_settings_get_t;
+
+/** Parameters of Sensor Setting Get */
+typedef struct {
+ uint16_t sensor_property_id; /*!< Property ID of a sensor */
+ uint16_t sensor_setting_property_id; /*!< Setting ID identifying a setting within a sensor */
+} esp_ble_mesh_sensor_setting_get_t;
+
+/** Parameters of Sensor Setting Set */
+typedef struct {
+ uint16_t sensor_property_id; /*!< Property ID identifying a sensor */
+ uint16_t sensor_setting_property_id; /*!< Setting ID identifying a setting within a sensor */
+ struct net_buf_simple *sensor_setting_raw; /*!< Raw value for the setting */
+} esp_ble_mesh_sensor_setting_set_t;
+
+/** Parameters of Sensor Get */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property ID for the sensor (optional) */
+} esp_ble_mesh_sensor_get_t;
+
+/** Parameters of Sensor Column Get */
+typedef struct {
+ uint16_t property_id; /*!< Property identifying a sensor */
+ struct net_buf_simple *raw_value_x; /*!< Raw value identifying a column */
+} esp_ble_mesh_sensor_column_get_t;
+
+/** Parameters of Sensor Series Get */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property identifying a sensor */
+ struct net_buf_simple *raw_value_x1; /*!< Raw value identifying a starting column (optional) */
+ struct net_buf_simple *raw_value_x2; /*!< Raw value identifying an ending column (C.1) */
+} esp_ble_mesh_sensor_series_get_t;
+
+/**
+ * @brief Sensor Client Model get message union
+ */
+typedef union {
+ esp_ble_mesh_sensor_descriptor_get_t descriptor_get; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_GET */
+ esp_ble_mesh_sensor_cadence_get_t cadence_get; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_GET */
+ esp_ble_mesh_sensor_settings_get_t settings_get; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_GET */
+ esp_ble_mesh_sensor_setting_get_t setting_get; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_GET */
+ esp_ble_mesh_sensor_get_t sensor_get; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_GET */
+ esp_ble_mesh_sensor_column_get_t column_get; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_GET */
+ esp_ble_mesh_sensor_series_get_t series_get; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_GET */
+} esp_ble_mesh_sensor_client_get_state_t;
+
+/**
+ * @brief Sensor Client Model set message union
+ */
+typedef union {
+ esp_ble_mesh_sensor_cadence_set_t cadence_set; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET & ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_SET_UNACK */
+ esp_ble_mesh_sensor_setting_set_t setting_set; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET & ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_SET_UNACK */
+} esp_ble_mesh_sensor_client_set_state_t;
+
+/**
+ * @brief Bluetooth Mesh Sensor Client Model Get and Set callback parameters structure.
+ */
+
+/** Parameter of Sensor Descriptor Status */
+typedef struct {
+ struct net_buf_simple *descriptor; /*!< Sequence of 8-octet sensor descriptors (optional) */
+} esp_ble_mesh_sensor_descriptor_status_cb_t;
+
+/** Parameters of Sensor Cadence Status */
+typedef struct {
+ uint16_t property_id; /*!< Property for the sensor */
+ struct net_buf_simple *sensor_cadence_value; /*!< Value of sensor cadence state */
+} esp_ble_mesh_sensor_cadence_status_cb_t;
+
+/** Parameters of Sensor Settings Status */
+typedef struct {
+ uint16_t sensor_property_id; /*!< Property ID identifying a sensor */
+ struct net_buf_simple *sensor_setting_property_ids; /*!< A sequence of N sensor setting property IDs (optional) */
+} esp_ble_mesh_sensor_settings_status_cb_t;
+
+/** Parameters of Sensor Setting Status */
+typedef struct {
+ bool op_en; /*!< Indicate id optional parameters are included */
+ uint16_t sensor_property_id; /*!< Property ID identifying a sensor */
+ uint16_t sensor_setting_property_id; /*!< Setting ID identifying a setting within a sensor */
+ uint8_t sensor_setting_access; /*!< Read/Write access rights for the setting (optional) */
+ struct net_buf_simple *sensor_setting_raw; /*!< Raw value for the setting */
+} esp_ble_mesh_sensor_setting_status_cb_t;
+
+/** Parameter of Sensor Status */
+typedef struct {
+ struct net_buf_simple *marshalled_sensor_data; /*!< Value of sensor data state (optional) */
+} esp_ble_mesh_sensor_status_cb_t;
+
+/** Parameters of Sensor Column Status */
+typedef struct {
+ uint16_t property_id; /*!< Property identifying a sensor and the Y axis */
+ struct net_buf_simple *sensor_column_value; /*!< Left values of sensor column status */
+} esp_ble_mesh_sensor_column_status_cb_t;
+
+/** Parameters of Sensor Series Status */
+typedef struct {
+ uint16_t property_id; /*!< Property identifying a sensor and the Y axis */
+ struct net_buf_simple *sensor_series_value; /*!< Left values of sensor series status */
+} esp_ble_mesh_sensor_series_status_cb_t;
+
+/**
+ * @brief Sensor Client Model received message union
+ */
+typedef union {
+ esp_ble_mesh_sensor_descriptor_status_cb_t descriptor_status; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_DESCRIPTOR_STATUS */
+ esp_ble_mesh_sensor_cadence_status_cb_t cadence_status; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_CADENCE_STATUS */
+ esp_ble_mesh_sensor_settings_status_cb_t settings_status; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTINGS_STATUS */
+ esp_ble_mesh_sensor_setting_status_cb_t setting_status; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_SETTING_STATUS */
+ esp_ble_mesh_sensor_status_cb_t sensor_status; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_STATUS */
+ esp_ble_mesh_sensor_column_status_cb_t column_status; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_COLUMN_STATUS */
+ esp_ble_mesh_sensor_series_status_cb_t series_status; /*!< For ESP_BLE_MESH_MODEL_OP_SENSOR_SERIES_STATUS */
+} esp_ble_mesh_sensor_client_status_cb_t;
+
+/** Sensor Client Model callback parameters */
+typedef struct {
+ int error_code; /*!< 0: success,
+ * otherwise failure. For the error code values please refer to errno.h file.
+ * A negative sign is added to the standard error codes in errno.h. */
+ esp_ble_mesh_client_common_param_t *params; /*!< The client common parameters. */
+ esp_ble_mesh_sensor_client_status_cb_t status_cb; /*!< The sensor status message callback values */
+} esp_ble_mesh_sensor_client_cb_param_t;
+
+/** This enum value is the event of Sensor Client Model */
+typedef enum {
+ ESP_BLE_MESH_SENSOR_CLIENT_GET_STATE_EVT,
+ ESP_BLE_MESH_SENSOR_CLIENT_SET_STATE_EVT,
+ ESP_BLE_MESH_SENSOR_CLIENT_PUBLISH_EVT,
+ ESP_BLE_MESH_SENSOR_CLIENT_TIMEOUT_EVT,
+ ESP_BLE_MESH_SENSOR_CLIENT_EVT_MAX,
+} esp_ble_mesh_sensor_client_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Sensor Client Model function.
+ */
+
+/**
+ * @brief Sensor Client Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_sensor_client_cb_t)(esp_ble_mesh_sensor_client_cb_event_t event,
+ esp_ble_mesh_sensor_client_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Sensor Client Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_sensor_client_callback(esp_ble_mesh_sensor_client_cb_t callback);
+
+/**
+ * @brief Get the value of Sensor Server Model states using the Sensor Client Model get messages.
+ *
+ * @note If you want to know the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_sensor_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] get_state: Pointer to sensor get message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_sensor_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_sensor_client_get_state_t *get_state);
+
+/**
+ * @brief Set the value of Sensor Server Model states using the Sensor Client Model set messages.
+ *
+ * @note If you want to know the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_sensor_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] set_state: Pointer to sensor set message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_sensor_client_set_state_t *set_state);
+
+/**
+ * @brief Sensor Server Models related context.
+ */
+
+/** @def ESP_BLE_MESH_MODEL_SENSOR_SRV
+ *
+ * @brief Define a new Sensor Server Model.
+ *
+ * @note 1. The Sensor Server model is a root model. When this model is present
+ * on an element, the corresponding Sensor Setup Server model shall
+ * also be present.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_sensor_srv_t.
+ *
+ * @return New Sensor Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SENSOR_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SENSOR_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_SENSOR_SETUP_SRV
+ *
+ * @brief Define a new Sensor Setup Server Model.
+ *
+ * @note 1. The Sensor Setup Server model extends the Sensor Server model.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_sensor_setup_srv_t.
+ *
+ * @return New Sensor Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SENSOR_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SENSOR_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+#define ESP_BLE_MESH_INVALID_SENSOR_PROPERTY_ID 0x0000 /*!< Invalid Sensor Property ID */
+
+#define ESP_BLE_MESH_SENSOR_PROPERTY_ID_LEN 0x02 /*!< Length of Sensor Property ID */
+
+#define ESP_BLE_MESH_SENSOR_DESCRIPTOR_LEN 0x08 /*!< Length of Sensor Descriptor state */
+
+#define ESP_BLE_MESH_SENSOR_UNSPECIFIED_POS_TOLERANCE 0x000 /*!< Unspecified Sensor Positive Tolerance */
+#define ESP_BLE_MESH_SENSOR_UNSPECIFIED_NEG_TOLERANCE 0x000 /*!< Unspecified Sensor Negative Tolerance */
+
+#define ESP_BLE_MESH_SENSOR_NOT_APPL_MEASURE_PERIOD 0x00 /*!< Not applicable Sensor Measurement Period */
+
+#define ESP_BLE_MESH_SENSOR_NOT_APPL_UPDATE_INTERVAL 0x00 /*!< Not applicable Sensor Update Interval */
+
+#define ESP_BLE_MESH_INVALID_SENSOR_SETTING_PROPERTY_ID 0x0000 /*!< Invalid Sensor Setting Property ID */
+
+#define ESP_BLE_MESH_SENSOR_SETTING_PROPERTY_ID_LEN 0x02 /*!< Length of Sensor Setting Property ID */
+#define ESP_BLE_MESH_SENSOR_SETTING_ACCESS_LEN 0x01 /*!< Length of Sensor Setting Access */
+
+#define ESP_BLE_MESH_SENSOR_SETTING_ACCESS_READ 0x01 /*!< Sensor Setting Access - Read */
+#define ESP_BLE_MESH_SENSOR_SETTING_ACCESS_READ_WRITE 0x03 /*!< Sensor Setting Access - Read & Write */
+
+#define ESP_BLE_MESH_SENSOR_DIVISOR_TRIGGER_TYPE_LEN 0x01 /*!< Length of Sensor Divisor Trigger Type */
+#define ESP_BLE_MESH_SENSOR_STATUS_MIN_INTERVAL_LEN 0x01 /*!< Length of Sensor Status Min Interval */
+
+#define ESP_BLE_MESH_SENSOR_PERIOD_DIVISOR_MAX_VALUE 15 /*!< Maximum value of Sensor Period Divisor */
+
+#define ESP_BLE_MESH_SENSOR_STATUS_MIN_INTERVAL_MAX 26 /*!< Maximum value of Sensor Status Min Interval */
+
+/**
+ * Sensor Status Trigger Type - Format Type of the characteristic
+ * that the Sensor Property ID state references
+ */
+#define ESP_BLE_MESH_SENSOR_STATUS_TRIGGER_TYPE_CHAR 0
+/** Sensor Status Trigger Type - Format Type "uint16" */
+#define ESP_BLE_MESH_SENSOR_STATUS_TRIGGER_TYPE_UINT16 1
+
+#define ESP_BLE_MESH_SENSOR_DATA_FORMAT_A 0x00 /*!< Sensor Data Format A */
+#define ESP_BLE_MESH_SENSOR_DATA_FORMAT_B 0x01 /*!< Sensor Data Format B */
+
+#define ESP_BLE_MESH_SENSOR_DATA_FORMAT_A_MPID_LEN 0x02 /*!< MPID length of Sensor Data Format A */
+#define ESP_BLE_MESH_SENSOR_DATA_FORMAT_B_MPID_LEN 0x03 /*!< MPID length of Sensor Data Format B */
+
+/**
+ * Zero length of Sensor Data.
+ *
+ * Note:
+ * The Length field is a 1-based uint7 value (valid range 0x0–0x7F,
+ * representing range of 1–127). The value 0x7F represents a length
+ * of zero.
+ */
+#define ESP_BLE_MESH_SENSOR_DATA_ZERO_LEN 0x7F
+
+/** @def ESP_BLE_MESH_GET_SENSOR_DATA_FORMAT
+ *
+ * @brief Get format of the sensor data.
+ *
+ * @note Multiple sensor data may be concatenated. Make sure the _data pointer is
+ * updated before getting the format of the corresponding sensor data.
+ *
+ * @param _data Pointer to the start of the sensor data.
+ *
+ * @return Format of the sensor data.
+ */
+#define ESP_BLE_MESH_GET_SENSOR_DATA_FORMAT(_data) (((_data)[0]) & BIT_MASK(1))
+
+/** @def ESP_BLE_MESH_GET_SENSOR_DATA_LENGTH
+ *
+ * @brief Get length of the sensor data.
+ *
+ * @note Multiple sensor data may be concatenated. Make sure the _data pointer is
+ * updated before getting the length of the corresponding sensor data.
+ *
+ * @param _data Pointer to the start of the sensor data.
+ * @param _fmt Format of the sensor data.
+ *
+ * @return Length (zero-based) of the sensor data.
+ */
+#define ESP_BLE_MESH_GET_SENSOR_DATA_LENGTH(_data, _fmt) \
+ (((_fmt) == ESP_BLE_MESH_SENSOR_DATA_FORMAT_A) ? ((((_data)[0]) >> 1) & BIT_MASK(4)) : ((((_data)[0]) >> 1) & BIT_MASK(7)))
+
+/** @def ESP_BLE_MESH_GET_SENSOR_DATA_PROPERTY_ID
+ *
+ * @brief Get Sensor Property ID of the sensor data.
+ *
+ * @note Multiple sensor data may be concatenated. Make sure the _data pointer is
+ * updated before getting Sensor Property ID of the corresponding sensor data.
+ *
+ * @param _data Pointer to the start of the sensor data.
+ * @param _fmt Format of the sensor data.
+ *
+ * @return Sensor Property ID of the sensor data.
+ */
+#define ESP_BLE_MESH_GET_SENSOR_DATA_PROPERTY_ID(_data, _fmt) \
+ (((_fmt) == ESP_BLE_MESH_SENSOR_DATA_FORMAT_A) ? ((((_data)[1]) << 3) | (((_data)[0]) >> 5)) : ((((_data)[2]) << 8) | ((_data)[1])))
+
+/** @def ESP_BLE_MESH_SENSOR_DATA_FORMAT_A_MPID
+ *
+ * @brief Generate a MPID value for sensor data with Format A.
+ *
+ * @note 1. The Format field is 0b0 and indicates that Format A is used.
+ * 2. The Length field is a 1-based uint4 value (valid range 0x0–0xF,
+ * representing range of 1–16).
+ * 3. The Property ID is an 11-bit bit field representing 11 LSb of a Property ID.
+ * 4. This format may be used for Property Values that are not longer than 16
+ * octets and for Property IDs less than 0x0800.
+ *
+ * @param _len Length of Sensor Raw value.
+ * @param _id Sensor Property ID.
+ *
+ * @return 2-octet MPID value for sensor data with Format A.
+ *
+ */
+#define ESP_BLE_MESH_SENSOR_DATA_FORMAT_A_MPID(_len, _id) \
+ ((((_id) & BIT_MASK(11)) << 5) | (((_len) & BIT_MASK(4)) << 1) | ESP_BLE_MESH_SENSOR_DATA_FORMAT_A)
+
+/** @def ESP_BLE_MESH_SENSOR_DATA_FORMAT_B_MPID
+ *
+ * @brief Generate a MPID value for sensor data with Format B.
+ *
+ * @note 1. The Format field is 0b1 and indicates Format B is used.
+ * 2. The Length field is a 1-based uint7 value (valid range 0x0–0x7F, representing
+ * range of 1–127). The value 0x7F represents a length of zero.
+ * 3. The Property ID is a 16-bit bit field representing a Property ID.
+ * 4. This format may be used for Property Values not longer than 128 octets and for
+ * any Property IDs. Property values longer than 128 octets are not supported by
+ * the Sensor Status message.
+ * 5. Exclude the generated 1-octet value, the 2-octet Sensor Property ID
+ *
+ * @param _len Length of Sensor Raw value.
+ * @param _id Sensor Property ID.
+ *
+ * @return 3-octet MPID value for sensor data with Format B.
+ *
+ */
+#define ESP_BLE_MESH_SENSOR_DATA_FORMAT_B_MPID(_len, _id) \
+ (((_id) << 8) | (((_len) & BIT_MASK(7)) << 1) | ESP_BLE_MESH_SENSOR_DATA_FORMAT_B)
+
+/** This enum value is value of Sensor Sampling Function */
+enum esp_ble_mesh_sensor_sample_func {
+ ESP_BLE_MESH_SAMPLE_FUNC_UNSPECIFIED,
+ ESP_BLE_MESH_SAMPLE_FUNC_INSTANTANEOUS,
+ ESP_BLE_MESH_SAMPLE_FUNC_ARITHMETIC_MEAN,
+ ESP_BLE_MESH_SAMPLE_FUNC_RMS,
+ ESP_BLE_MESH_SAMPLE_FUNC_MAXIMUM,
+ ESP_BLE_MESH_SAMPLE_FUNC_MINIMUM,
+ ESP_BLE_MESH_SAMPLE_FUNC_ACCUMULATED,
+ ESP_BLE_MESH_SAMPLE_FUNC_COUNT,
+};
+
+/** Parameters of Sensor Descriptor state */
+typedef struct {
+ uint32_t positive_tolerance : 12, /*!< The value of Sensor Positive Tolerance field */
+ negative_tolerance : 12, /*!< The value of Sensor Negative Tolerance field */
+ sampling_function : 8; /*!< The value of Sensor Sampling Function field */
+ uint8_t measure_period; /*!< The value of Sensor Measurement Period field */
+ uint8_t update_interval; /*!< The value of Sensor Update Interval field */
+} esp_ble_mesh_sensor_descriptor_t;
+
+/** Parameters of Sensor Setting state */
+typedef struct {
+ uint16_t property_id; /*!< The value of Sensor Setting Property ID field */
+ uint8_t access; /*!< The value of Sensor Setting Access field */
+ struct net_buf_simple *raw; /*!< The value of Sensor Setting Raw field */
+} esp_ble_mesh_sensor_setting_t;
+
+/** Parameters of Sensor Cadence state */
+typedef struct {
+ uint8_t period_divisor : 7, /*!< The value of Fast Cadence Period Divisor field */
+ trigger_type : 1; /*!< The value of Status Trigger Type field */
+ /**
+ * Note:
+ * The parameter "size" in trigger_delta_down, trigger_delta_up, fast_cadence_low &
+ * fast_cadence_high indicates the exact length of these four parameters, and they
+ * are associated with the Sensor Property ID. Users need to initialize the "size"
+ * precisely.
+ */
+ struct net_buf_simple *trigger_delta_down; /*!< The value of Status Trigger Delta Down field */
+ struct net_buf_simple *trigger_delta_up; /*!< The value of Status Trigger Delta Up field */
+ uint8_t min_interval; /*!< The value of Status Min Interval field */
+ struct net_buf_simple *fast_cadence_low; /*!< The value of Fast Cadence Low field */
+ struct net_buf_simple *fast_cadence_high; /*!< The value of Fast Cadence High field */
+} esp_ble_mesh_sensor_cadence_t;
+
+/** Parameters of Sensor Data state */
+typedef struct {
+ /**
+ * Format A: The Length field is a 1-based uint4 value (valid range 0x0–0xF,
+ * representing range of 1 – 16).
+ * Format B: The Length field is a 1-based uint7 value (valid range 0x0–0x7F,
+ * representing range of 1 – 127). The value 0x7F represents a
+ * length of zero.
+ */
+ uint8_t format : 1, /*!< The value of the Sensor Data format */
+ length : 7; /*!< The value of the Sensor Data length */
+ struct net_buf_simple *raw_value; /*!< The value of Sensor Data raw value */
+} esp_ble_mesh_sensor_data_t;
+
+/** Parameters of Sensor Series Column state */
+typedef struct {
+ struct net_buf_simple *raw_value_x; /*!< The value of Sensor Raw Value X field */
+ struct net_buf_simple *column_width; /*!< The value of Sensor Column Width field */
+ struct net_buf_simple *raw_value_y; /*!< The value of Sensor Raw Value Y field */
+} esp_ble_mesh_sensor_series_column_t;
+
+/** Parameters of Sensor states */
+typedef struct {
+ uint16_t sensor_property_id; /*!< The value of Sensor Property ID field */
+
+ /* Constant throughout the lifetime of an element */
+ esp_ble_mesh_sensor_descriptor_t descriptor; /*!< Parameters of the Sensor Descriptor state */
+
+ /**
+ * Multiple Sensor Setting states may be present for each sensor.
+ * The Sensor Setting Property ID values shall be unique for each
+ * Sensor Property ID that identifies a sensor within an element.
+ */
+ const uint8_t setting_count; /*!< */
+ esp_ble_mesh_sensor_setting_t *settings; /*!< Parameters of the Sensor Setting state */
+
+ /**
+ * The Sensor Cadence state may be not supported by sensors based
+ * on device properties referencing "non-scalar characteristics"
+ * such as "histograms" or "composite characteristics".
+ */
+ esp_ble_mesh_sensor_cadence_t *cadence; /*!< Parameters of the Sensor Cadence state */
+
+ esp_ble_mesh_sensor_data_t sensor_data; /*!< Parameters of the Sensor Data state */
+
+ esp_ble_mesh_sensor_series_column_t series_column; /*!< Parameters of the Sensor Series Column state */
+} esp_ble_mesh_sensor_state_t;
+
+/** User data of Sensor Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Sensor Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ const uint8_t state_count; /*!< Sensor state count */
+ esp_ble_mesh_sensor_state_t *states; /*!< Parameters of the Sensor states */
+} esp_ble_mesh_sensor_srv_t;
+
+/** User data of Sensor Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Sensor Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ const uint8_t state_count; /*!< Sensor state count */
+ esp_ble_mesh_sensor_state_t *states; /*!< Parameters of the Sensor states */
+} esp_ble_mesh_sensor_setup_srv_t;
+
+/** Parameters of Sensor Cadence Set state change event */
+typedef struct {
+ uint16_t property_id; /*!< The value of Sensor Property ID state */
+ uint8_t period_divisor : 7, /*!< The value of Fast Cadence Period Divisor state */
+ trigger_type : 1; /*!< The value of Status Trigger Type state */
+ struct net_buf_simple *trigger_delta_down; /*!< The value of Status Trigger Delta Down state */
+ struct net_buf_simple *trigger_delta_up; /*!< The value of Status Trigger Delta Up state */
+ uint8_t min_interval; /*!< The value of Status Min Interval state */
+ struct net_buf_simple *fast_cadence_low; /*!< The value of Fast Cadence Low state */
+ struct net_buf_simple *fast_cadence_high; /*!< The value of Fast Cadence High state */
+} esp_ble_mesh_state_change_sensor_cadence_set_t;
+
+/** Parameters of Sensor Setting Set state change event */
+typedef struct {
+ uint16_t property_id; /*!< The value of Sensor Property ID state */
+ uint16_t setting_property_id; /*!< The value of Sensor Setting Property ID state */
+ struct net_buf_simple *setting_value; /*!< The value of Sensor Property Value state */
+} esp_ble_mesh_state_change_sensor_setting_set_t;
+
+/**
+ * @brief Sensor Server Model state change value union
+ */
+typedef union {
+ /**
+ * The recv_op in ctx can be used to decide which state is changed.
+ */
+ esp_ble_mesh_state_change_sensor_cadence_set_t sensor_cadence_set; /*!< Sensor Cadence Set */
+ esp_ble_mesh_state_change_sensor_setting_set_t sensor_setting_set; /*!< Sensor Setting Set */
+} esp_ble_mesh_sensor_server_state_change_t;
+
+/** Context of the received Sensor Descriptor Get message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property ID of a sensor (optional) */
+} esp_ble_mesh_server_recv_sensor_descriptor_get_t;
+
+/** Context of the received Sensor Cadence Get message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID of a sensor */
+} esp_ble_mesh_server_recv_sensor_cadence_get_t;
+
+/** Context of the received Sensor Settings Get message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID of a sensor */
+} esp_ble_mesh_server_recv_sensor_settings_get_t;
+
+/** Context of the received Sensor Setting Get message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID of a sensor */
+ uint16_t setting_property_id; /*!< Setting ID identifying a setting within a sensor */
+} esp_ble_mesh_server_recv_sensor_setting_get_t;
+
+/** Context of the received Sensor Get message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property ID for the sensor (optional) */
+} esp_ble_mesh_server_recv_sensor_get_t;
+
+/** Context of the received Sensor Column Get message */
+typedef struct {
+ uint16_t property_id; /*!< Property identifying a sensor */
+ struct net_buf_simple *raw_value_x; /*!< Raw value identifying a column */
+} esp_ble_mesh_server_recv_sensor_column_get_t;
+
+/** Context of the received Sensor Series Get message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t property_id; /*!< Property identifying a sensor */
+ struct net_buf_simple *raw_value; /*!< Raw value containing X1 and X2 (optional) */
+} esp_ble_mesh_server_recv_sensor_series_get_t;
+
+/**
+ * @brief Sensor Server Model received get message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_sensor_descriptor_get_t sensor_descriptor; /*!< Sensor Descriptor Get */
+ esp_ble_mesh_server_recv_sensor_cadence_get_t sensor_cadence; /*!< Sensor Cadence Get */
+ esp_ble_mesh_server_recv_sensor_settings_get_t sensor_settings; /*!< Sensor Settings Get */
+ esp_ble_mesh_server_recv_sensor_setting_get_t sensor_setting; /*!< Sensor Setting Get */
+ esp_ble_mesh_server_recv_sensor_get_t sensor_data; /*!< Sensor Get */
+ esp_ble_mesh_server_recv_sensor_column_get_t sensor_column; /*!< Sensor Column Get */
+ esp_ble_mesh_server_recv_sensor_series_get_t sensor_series; /*!< Sensor Series Get */
+} esp_ble_mesh_sensor_server_recv_get_msg_t;
+
+/** Context of the received Sensor Cadence Set message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID for the sensor */
+ struct net_buf_simple *cadence; /*!< Value of Sensor Cadence state */
+} esp_ble_mesh_server_recv_sensor_cadence_set_t;
+
+/** Context of the received Sensor Setting Set message */
+typedef struct {
+ uint16_t property_id; /*!< Property ID identifying a sensor */
+ uint16_t setting_property_id; /*!< Setting ID identifying a setting within a sensor */
+ struct net_buf_simple *setting_raw; /*!< Raw value for the setting */
+} esp_ble_mesh_server_recv_sensor_setting_set_t;
+
+/**
+ * @brief Sensor Server Model received set message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_sensor_cadence_set_t sensor_cadence; /*!< Sensor Cadence Set */
+ esp_ble_mesh_server_recv_sensor_setting_set_t sensor_setting; /*!< Sensor Setting Set */
+} esp_ble_mesh_sensor_server_recv_set_msg_t;
+
+/**
+ * @brief Sensor Server Model callback value union
+ */
+typedef union {
+ esp_ble_mesh_sensor_server_state_change_t state_change; /*!< ESP_BLE_MESH_SENSOR_SERVER_STATE_CHANGE_EVT */
+ esp_ble_mesh_sensor_server_recv_get_msg_t get; /*!< ESP_BLE_MESH_SENSOR_SERVER_RECV_GET_MSG_EVT */
+ esp_ble_mesh_sensor_server_recv_set_msg_t set; /*!< ESP_BLE_MESH_SENSOR_SERVER_RECV_SET_MSG_EVT */
+} esp_ble_mesh_sensor_server_cb_value_t;
+
+/** Sensor Server Model callback parameters */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to Sensor Server Models */
+ esp_ble_mesh_msg_ctx_t ctx; /*!< Context of the received messages */
+ esp_ble_mesh_sensor_server_cb_value_t value; /*!< Value of the received Sensor Messages */
+} esp_ble_mesh_sensor_server_cb_param_t;
+
+/** This enum value is the event of Sensor Server Model */
+typedef enum {
+ /**
+ * 1. When get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, no event will be
+ * callback to the application layer when Sensor Get messages are received.
+ * 2. When set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, this event will
+ * be callback to the application layer when Sensor Set/Set Unack messages
+ * are received.
+ */
+ ESP_BLE_MESH_SENSOR_SERVER_STATE_CHANGE_EVT,
+ /**
+ * When get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Sensor Get messages are received.
+ */
+ ESP_BLE_MESH_SENSOR_SERVER_RECV_GET_MSG_EVT,
+ /**
+ * When set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Sensor Set/Set Unack messages are received.
+ */
+ ESP_BLE_MESH_SENSOR_SERVER_RECV_SET_MSG_EVT,
+ ESP_BLE_MESH_SENSOR_SERVER_EVT_MAX,
+} esp_ble_mesh_sensor_server_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Sensor Server Model function.
+ */
+
+/**
+ * @brief Sensor Server Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_sensor_server_cb_t)(esp_ble_mesh_sensor_server_cb_event_t event,
+ esp_ble_mesh_sensor_server_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Sensor Server Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_sensor_server_callback(esp_ble_mesh_sensor_server_cb_t callback);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_SENSOR_MODEL_API_H_ */
diff --git a/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_time_scene_model_api.h b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_time_scene_model_api.h
new file mode 100644
index 00000000..34700f8b
--- /dev/null
+++ b/lib/bt/esp_ble_mesh/api/models/include/esp_ble_mesh_time_scene_model_api.h
@@ -0,0 +1,911 @@
+/*
+ * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/** @file
+ * @brief Bluetooth Mesh Time and Scene Client Model APIs.
+ */
+
+#ifndef _ESP_BLE_MESH_TIME_SCENE_MODEL_API_H_
+#define _ESP_BLE_MESH_TIME_SCENE_MODEL_API_H_
+
+#include "esp_ble_mesh_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @def ESP_BLE_MESH_MODEL_TIME_CLI
+ *
+ * @brief Define a new Time Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Time Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Time Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_TIME_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_TIME_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_SCENE_CLI
+ *
+ * @brief Define a new Scene Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Scene Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Scene Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SCENE_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SCENE_CLI, \
+ NULL, cli_pub, cli_data)
+
+/** @def ESP_BLE_MESH_MODEL_SCHEDULER_CLI
+ *
+ * @brief Define a new Scheduler Client Model.
+ *
+ * @note This API needs to be called for each element on which
+ * the application needs to have a Scheduler Client Model.
+ *
+ * @param cli_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param cli_data Pointer to the unique struct esp_ble_mesh_client_t.
+ *
+ * @return New Scheduler Client Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SCHEDULER_CLI(cli_pub, cli_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SCHEDULER_CLI, \
+ NULL, cli_pub, cli_data)
+
+/**
+ * @brief Bluetooth Mesh Time Scene Client Model Get and Set parameters structure.
+ */
+
+/** Parameters of Time Set */
+typedef struct {
+ uint8_t tai_seconds[5]; /*!< The current TAI time in seconds */
+ uint8_t sub_second; /*!< The sub-second time in units of 1/256 second */
+ uint8_t uncertainty; /*!< The estimated uncertainty in 10-millisecond steps */
+ uint16_t time_authority : 1; /*!< 0 = No Time Authority, 1 = Time Authority */
+ uint16_t tai_utc_delta : 15; /*!< Current difference between TAI and UTC in seconds */
+ uint8_t time_zone_offset; /*!< The local time zone offset in 15-minute increments */
+} esp_ble_mesh_time_set_t;
+
+/** Parameters of Time Zone Set */
+typedef struct {
+ uint8_t time_zone_offset_new; /*!< Upcoming local time zone offset */
+ uint8_t tai_zone_change[5]; /*!< TAI Seconds time of the upcoming Time Zone Offset change */
+} esp_ble_mesh_time_zone_set_t;
+
+/** Parameters of TAI-UTC Delta Set */
+typedef struct {
+ uint16_t tai_utc_delta_new : 15; /*!< Upcoming difference between TAI and UTC in seconds */
+ uint16_t padding : 1; /*!< Always 0b0. Other values are Prohibited. */
+ uint8_t tai_delta_change[5]; /*!< TAI Seconds time of the upcoming TAI-UTC Delta change */
+} esp_ble_mesh_tai_utc_delta_set_t;
+
+/** Parameter of Time Role Set */
+typedef struct {
+ uint8_t time_role; /*!< The Time Role for the element */
+} esp_ble_mesh_time_role_set_t;
+
+/** Parameter of Scene Store */
+typedef struct {
+ uint16_t scene_number; /*!< The number of scenes to be stored */
+} esp_ble_mesh_scene_store_t;
+
+/** Parameters of Scene Recall */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t scene_number; /*!< The number of scenes to be recalled */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_scene_recall_t;
+
+/** Parameter of Scene Delete */
+typedef struct {
+ uint16_t scene_number; /*!< The number of scenes to be deleted */
+} esp_ble_mesh_scene_delete_t;
+
+/** Parameter of Scheduler Action Get */
+typedef struct {
+ uint8_t index; /*!< Index of the Schedule Register entry to get */
+} esp_ble_mesh_scheduler_act_get_t;
+
+/** Parameters of Scheduler Action Set */
+typedef struct {
+ uint64_t index : 4; /*!< Index of the Schedule Register entry to set */
+ uint64_t year : 7; /*!< Scheduled year for the action */
+ uint64_t month : 12; /*!< Scheduled month for the action */
+ uint64_t day : 5; /*!< Scheduled day of the month for the action */
+ uint64_t hour : 5; /*!< Scheduled hour for the action */
+ uint64_t minute : 6; /*!< Scheduled minute for the action */
+ uint64_t second : 6; /*!< Scheduled second for the action */
+ uint64_t day_of_week : 7; /*!< Schedule days of the week for the action */
+ uint64_t action : 4; /*!< Action to be performed at the scheduled time */
+ uint64_t trans_time : 8; /*!< Transition time for this action */
+ uint16_t scene_number; /*!< Transition time for this action */
+} esp_ble_mesh_scheduler_act_set_t;
+
+/**
+ * @brief Time Scene Client Model get message union
+ */
+typedef union {
+ esp_ble_mesh_scheduler_act_get_t scheduler_act_get; /*!< For ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_GET */
+} esp_ble_mesh_time_scene_client_get_state_t;
+
+/**
+ * @brief Time Scene Client Model set message union
+ */
+typedef union {
+ esp_ble_mesh_time_set_t time_set; /*!< For ESP_BLE_MESH_MODEL_OP_TIME_SET */
+ esp_ble_mesh_time_zone_set_t time_zone_set; /*!< For ESP_BLE_MESH_MODEL_OP_TIME_ZONE_SET */
+ esp_ble_mesh_tai_utc_delta_set_t tai_utc_delta_set; /*!< For ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_SET */
+ esp_ble_mesh_time_role_set_t time_role_set; /*!< For ESP_BLE_MESH_MODEL_OP_TIME_ROLE_SET */
+ esp_ble_mesh_scene_store_t scene_store; /*!< For ESP_BLE_MESH_MODEL_OP_SCENE_STORE & ESP_BLE_MESH_MODEL_OP_SCENE_STORE_UNACK */
+ esp_ble_mesh_scene_recall_t scene_recall; /*!< For ESP_BLE_MESH_MODEL_OP_SCENE_RECALL & ESP_BLE_MESH_MODEL_OP_SCENE_RECALL_UNACK */
+ esp_ble_mesh_scene_delete_t scene_delete; /*!< For ESP_BLE_MESH_MODEL_OP_SCENE_DELETE & ESP_BLE_MESH_MODEL_OP_SCENE_DELETE_UNACK */
+ esp_ble_mesh_scheduler_act_set_t scheduler_act_set; /*!< For ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET & ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_SET_UNACK */
+} esp_ble_mesh_time_scene_client_set_state_t;
+
+/**
+ * @brief Bluetooth Mesh Time Scene Client Model Get and Set callback parameters structure.
+ */
+
+/** Parameters of Time Status */
+typedef struct {
+ uint8_t tai_seconds[5]; /*!< The current TAI time in seconds */
+ uint8_t sub_second; /*!< The sub-second time in units of 1/256 second */
+ uint8_t uncertainty; /*!< The estimated uncertainty in 10-millisecond steps */
+ uint16_t time_authority : 1; /*!< 0 = No Time Authority, 1 = Time Authority */
+ uint16_t tai_utc_delta : 15; /*!< Current difference between TAI and UTC in seconds */
+ uint8_t time_zone_offset; /*!< The local time zone offset in 15-minute increments */
+} esp_ble_mesh_time_status_cb_t;
+
+/** Parameters of Time Zone Status */
+typedef struct {
+ uint8_t time_zone_offset_curr; /*!< Current local time zone offset */
+ uint8_t time_zone_offset_new; /*!< Upcoming local time zone offset */
+ uint8_t tai_zone_change[5]; /*!< TAI Seconds time of the upcoming Time Zone Offset change */
+} esp_ble_mesh_time_zone_status_cb_t;
+
+/** Parameters of TAI-UTC Delta Status */
+typedef struct {
+ uint16_t tai_utc_delta_curr : 15; /*!< Current difference between TAI and UTC in seconds */
+ uint16_t padding_1 : 1; /*!< Always 0b0. Other values are Prohibited. */
+ uint16_t tai_utc_delta_new : 15; /*!< Upcoming difference between TAI and UTC in seconds */
+ uint16_t padding_2 : 1; /*!< Always 0b0. Other values are Prohibited. */
+ uint8_t tai_delta_change[5]; /*!< TAI Seconds time of the upcoming TAI-UTC Delta change */
+} esp_ble_mesh_tai_utc_delta_status_cb_t;
+
+/** Parameter of Time Role Status */
+typedef struct {
+ uint8_t time_role; /*!< The Time Role for the element */
+} esp_ble_mesh_time_role_status_cb_t;
+
+/** Parameters of Scene Status */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint8_t status_code; /*!< Status code of the last operation */
+ uint16_t current_scene; /*!< Scene Number of the current scene */
+ uint16_t target_scene; /*!< Scene Number of the target scene (optional) */
+ uint8_t remain_time; /*!< Time to complete state transition (C.1) */
+} esp_ble_mesh_scene_status_cb_t;
+
+/** Parameters of Scene Register Status */
+typedef struct {
+ uint8_t status_code; /*!< Status code for the previous operation */
+ uint16_t current_scene; /*!< Scene Number of the current scene */
+ struct net_buf_simple *scenes; /*!< A list of scenes stored within an element */
+} esp_ble_mesh_scene_register_status_cb_t;
+
+/** Parameter of Scheduler Status */
+typedef struct {
+ uint16_t schedules; /*!< Bit field indicating defined Actions in the Schedule Register */
+} esp_ble_mesh_scheduler_status_cb_t;
+
+/** Parameters of Scheduler Action Status */
+typedef struct {
+ uint64_t index : 4; /*!< Enumerates (selects) a Schedule Register entry */
+ uint64_t year : 7; /*!< Scheduled year for the action */
+ uint64_t month : 12; /*!< Scheduled month for the action */
+ uint64_t day : 5; /*!< Scheduled day of the month for the action */
+ uint64_t hour : 5; /*!< Scheduled hour for the action */
+ uint64_t minute : 6; /*!< Scheduled minute for the action */
+ uint64_t second : 6; /*!< Scheduled second for the action */
+ uint64_t day_of_week : 7; /*!< Schedule days of the week for the action */
+ uint64_t action : 4; /*!< Action to be performed at the scheduled time */
+ uint64_t trans_time : 8; /*!< Transition time for this action */
+ uint16_t scene_number; /*!< Transition time for this action */
+} esp_ble_mesh_scheduler_act_status_cb_t;
+
+/**
+ * @brief Time Scene Client Model received message union
+ */
+typedef union {
+ esp_ble_mesh_time_status_cb_t time_status; /*!< For ESP_BLE_MESH_MODEL_OP_TIME_STATUS */
+ esp_ble_mesh_time_zone_status_cb_t time_zone_status; /*!< For ESP_BLE_MESH_MODEL_OP_TIME_ZONE_STATUS */
+ esp_ble_mesh_tai_utc_delta_status_cb_t tai_utc_delta_status; /*!< For ESP_BLE_MESH_MODEL_OP_TAI_UTC_DELTA_STATUS */
+ esp_ble_mesh_time_role_status_cb_t time_role_status; /*!< For ESP_BLE_MESH_MODEL_OP_TIME_ROLE_STATUS */
+ esp_ble_mesh_scene_status_cb_t scene_status; /*!< For ESP_BLE_MESH_MODEL_OP_SCENE_STATUS */
+ esp_ble_mesh_scene_register_status_cb_t scene_register_status; /*!< For ESP_BLE_MESH_MODEL_OP_SCENE_REGISTER_STATUS */
+ esp_ble_mesh_scheduler_status_cb_t scheduler_status; /*!< For ESP_BLE_MESH_MODEL_OP_SCHEDULER_STATUS */
+ esp_ble_mesh_scheduler_act_status_cb_t scheduler_act_status; /*!< For ESP_BLE_MESH_MODEL_OP_SCHEDULER_ACT_STATUS */
+} esp_ble_mesh_time_scene_client_status_cb_t;
+
+/** Time Scene Client Model callback parameters */
+typedef struct {
+ int error_code; /*!< Appropriate error code */
+ esp_ble_mesh_client_common_param_t *params; /*!< The client common parameters. */
+ esp_ble_mesh_time_scene_client_status_cb_t status_cb; /*!< The scene status message callback values */
+} esp_ble_mesh_time_scene_client_cb_param_t;
+
+/** This enum value is the event of Time Scene Client Model */
+typedef enum {
+ ESP_BLE_MESH_TIME_SCENE_CLIENT_GET_STATE_EVT,
+ ESP_BLE_MESH_TIME_SCENE_CLIENT_SET_STATE_EVT,
+ ESP_BLE_MESH_TIME_SCENE_CLIENT_PUBLISH_EVT,
+ ESP_BLE_MESH_TIME_SCENE_CLIENT_TIMEOUT_EVT,
+ ESP_BLE_MESH_TIME_SCENE_CLIENT_EVT_MAX,
+} esp_ble_mesh_time_scene_client_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Time Scene Client Model function.
+ */
+
+/**
+ * @brief Time Scene Client Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_time_scene_client_cb_t)(esp_ble_mesh_time_scene_client_cb_event_t event,
+ esp_ble_mesh_time_scene_client_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Time Scene Client Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_time_scene_client_callback(esp_ble_mesh_time_scene_client_cb_t callback);
+
+/**
+ * @brief Get the value of Time Scene Server Model states using the Time Scene Client Model get messages.
+ *
+ * @note If you want to know the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_time_scene_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] get_state: Pointer to time scene get message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ */
+esp_err_t esp_ble_mesh_time_scene_client_get_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_time_scene_client_get_state_t *get_state);
+
+/**
+ * @brief Set the value of Time Scene Server Model states using the Time Scene Client Model set messages.
+ *
+ * @note If you want to know the opcodes and corresponding meanings accepted by this API,
+ * please refer to esp_ble_mesh_time_scene_message_opcode_t in esp_ble_mesh_defs.h
+ *
+ * @param[in] params: Pointer to BLE Mesh common client parameters.
+ * @param[in] set_state: Pointer to time scene set message value.
+ * Shall not be set to NULL.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ */
+esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_param_t *params,
+ esp_ble_mesh_time_scene_client_set_state_t *set_state);
+
+/**
+ * @brief Time Scene Server Models related context.
+ */
+
+/** @def ESP_BLE_MESH_MODEL_TIME_SRV
+ *
+ * @brief Define a new Time Server Model.
+ *
+ * @note 1. The Time Server model is a root model. When this model is present on an
+ * Element, the corresponding Time Setup Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_time_srv_t.
+ *
+ * @return New Time Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_TIME_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_TIME_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_TIME_SETUP_SRV
+ *
+ * @brief Define a new Time Setup Server Model.
+ *
+ * @note 1. The Time Setup Server model extends the Time Server model. Time is
+ * sensitive information that is propagated across a mesh network.
+ * 2. Only an authorized Time Client should be allowed to change the Time
+ * and Time Role states. A dedicated application key Bluetooth SIG
+ * Proprietary should be used on the Time Setup Server to restrict
+ * access to the server to only authorized Time Clients.
+ * 3. This model does not support subscribing nor publishing.
+ *
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_time_setup_srv_t.
+ *
+ * @return New Time Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_TIME_SETUP_SRV(srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_TIME_SETUP_SRV, \
+ NULL, NULL, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_SCENE_SRV
+ *
+ * @brief Define a new Scene Server Model.
+ *
+ * @note 1. The Scene Server model is a root model. When this model is present
+ * on an Element, the corresponding Scene Setup Server model shall
+ * also be present.
+ * 2. This model shall support model publication and model subscription.
+ * 3. The model may be present only on the Primary element of a node.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_scene_srv_t.
+ *
+ * @return New Scene Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SCENE_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SCENE_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_SCENE_SETUP_SRV
+ *
+ * @brief Define a new Scene Setup Server Model.
+ *
+ * @note 1. The Scene Setup Server model extends the Scene Server model and
+ * the Generic Default Transition Time Server model.
+ * 2. This model shall support model subscription.
+ * 3. The model may be present only on the Primary element of a node.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_scene_setup_srv_t.
+ *
+ * @return New Scene Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SCENE_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SCENE_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_SCHEDULER_SRV
+ *
+ * @brief Define a new Scheduler Server Model.
+ *
+ * @note 1. The Scheduler Server model extends the Scene Server model. When
+ * this model is present on an Element, the corresponding Scheduler
+ * Setup Server model shall also be present.
+ * 2. This model shall support model publication and model subscription.
+ * 3. The model may be present only on the Primary element of a node.
+ * 4. The model requires the Time Server model shall be present on the element.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_scheduler_srv_t.
+ *
+ * @return New Scheduler Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SCHEDULER_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SCHEDULER_SRV, \
+ NULL, srv_pub, srv_data)
+
+/** @def ESP_BLE_MESH_MODEL_SCHEDULER_SETUP_SRV
+ *
+ * @brief Define a new Scheduler Setup Server Model.
+ *
+ * @note 1. The Scheduler Setup Server model extends the Scheduler Server and
+ * the Scene Setup Server models.
+ * 2. This model shall support model subscription.
+ * 3. The model may be present only on the Primary element of a node.
+ *
+ * @param srv_pub Pointer to the unique struct esp_ble_mesh_model_pub_t.
+ * @param srv_data Pointer to the unique struct esp_ble_mesh_scheduler_setup_srv_t.
+ *
+ * @return New Scheduler Setup Server Model instance.
+ */
+#define ESP_BLE_MESH_MODEL_SCHEDULER_SETUP_SRV(srv_pub, srv_data) \
+ ESP_BLE_MESH_SIG_MODEL(ESP_BLE_MESH_MODEL_ID_SCHEDULER_SETUP_SRV, \
+ NULL, srv_pub, srv_data)
+
+#define ESP_BLE_MESH_UNKNOWN_TAI_SECONDS 0x0000000000 /*!< Unknown TAI Seconds */
+#define ESP_BLE_MESH_UNKNOWN_TAI_ZONE_CHANGE 0x0000000000 /*!< Unknown TAI of Zone Change */
+#define ESP_BLE_MESH_UNKNOWN_TAI_DELTA_CHANGE 0x0000000000 /*!< Unknown TAI of Delta Change */
+
+#define ESP_BLE_MESH_TAI_UTC_DELTA_MAX_VALUE 0x7FFF /*!< Maximum TAI-UTC Delta value */
+
+#define ESP_BLE_MESH_TAI_SECONDS_LEN 0x05 /*!< Length of TAI Seconds */
+#define ESP_BLE_MESH_TAI_OF_ZONE_CHANGE_LEN 0x05 /*!< Length of TAI of Zone Change */
+#define ESP_BLE_MESH_TAI_OF_DELTA_CHANGE_LEN 0x05 /*!< Length of TAI of Delta Change */
+
+#define ESP_BLE_MESH_INVALID_SCENE_NUMBER 0x0000 /*!< Invalid Scene Number */
+#define ESP_BLE_MESH_SCENE_NUMBER_LEN 0x02 /*!< Length of the Scene Number */
+
+#define ESP_BLE_MESH_SCHEDULE_YEAR_ANY_YEAR 0x64 /*!< Any year of the Scheduled year */
+
+#define ESP_BLE_MESH_SCHEDULE_DAY_ANY_DAY 0x00 /*!< Any day of the Scheduled day */
+
+#define ESP_BLE_MESH_SCHEDULE_HOUR_ANY_HOUR 0x18 /*!< Any hour of the Scheduled hour */
+#define ESP_BLE_MESH_SCHEDULE_HOUR_ONCE_A_DAY 0x19 /*!< Any hour of the Scheduled Day */
+
+#define ESP_BLE_MESH_SCHEDULE_SEC_ANY_OF_HOUR 0x3C /*!< Any minute of the Scheduled hour */
+#define ESP_BLE_MESH_SCHEDULE_SEC_EVERY_15_MIN 0x3D /*!< Every 15 minutes of the Scheduled hour */
+#define ESP_BLE_MESH_SCHEDULE_SEC_EVERY_20_MIN 0x3E /*!< Every 20 minutes of the Scheduled hour */
+#define ESP_BLE_MESH_SCHEDULE_SEC_ONCE_AN_HOUR 0x3F /*!< Once of the Scheduled hour */
+
+#define ESP_BLE_MESH_SCHEDULE_SEC_ANY_OF_MIN 0x3C /*!< Any second of the Scheduled minute */
+#define ESP_BLE_MESH_SCHEDULE_SEC_EVERY_15_SEC 0x3D /*!< Every 15 seconds of the Scheduled minute */
+#define ESP_BLE_MESH_SCHEDULE_SEC_EVERY_20_SEC 0x3E /*!< Every 20 seconds of the Scheduled minute */
+#define ESP_BLE_MESH_SCHEDULE_SEC_ONCE_AN_MIN 0x3F /*!< Once of the Scheduled minute */
+
+#define ESP_BLE_MESH_SCHEDULE_ACT_TURN_OFF 0x00 /*!< Scheduled Action - Turn Off */
+#define ESP_BLE_MESH_SCHEDULE_ACT_TURN_ON 0x01 /*!< Scheduled Action - Turn On */
+#define ESP_BLE_MESH_SCHEDULE_ACT_SCENE_RECALL 0x02 /*!< Scheduled Action - Scene Recall */
+#define ESP_BLE_MESH_SCHEDULE_ACT_NO_ACTION 0x0F /*!< Scheduled Action - No Action */
+
+#define ESP_BLE_MESH_SCHEDULE_SCENE_NO_SCENE 0x0000 /*!< Scheduled Scene - No Scene */
+
+#define ESP_BLE_MESH_SCHEDULE_ENTRY_MAX_INDEX 0x0F /*!< Maximum number of Scheduled entries */
+
+#define ESP_BLE_MESH_TIME_NONE 0x00 /*!< Time Role - None */
+#define ESP_BLE_MESH_TIME_AUTHORITY 0x01 /*!< Time Role - Mesh Time Authority */
+#define ESP_BLE_MESH_TIME_RELAY 0x02 /*!< Time Role - Mesh Time Relay */
+#define ESP_BLE_MESH_TIME_CLIENT 0x03 /*!< Time Role - Mesh Time Client */
+
+#define ESP_BLE_MESH_SCENE_SUCCESS 0x00 /*!< Scene operation - Success */
+#define ESP_BLE_MESH_SCENE_REG_FULL 0x01 /*!< Scene operation - Scene Register Full */
+#define ESP_BLE_MESH_SCENE_NOT_FOUND 0x02 /*!< Scene operation - Scene Not Found */
+
+/** Parameters of Time state */
+typedef struct {
+ struct {
+ uint8_t tai_seconds[5]; /*!< The value of the TAI Seconds state */
+ uint8_t subsecond; /*!< The value of the Subsecond field */
+ uint8_t uncertainty; /*!< The value of the Uncertainty field */
+ uint8_t time_zone_offset_curr; /*!< The value of the Time Zone Offset Current field */
+ uint8_t time_zone_offset_new; /*!< The value of the Time Zone Offset New state */
+ uint8_t tai_zone_change[5]; /*!< The value of the TAI of Zone Change field */
+ uint16_t time_authority : 1, /*!< The value of the Time Authority bit */
+ tai_utc_delta_curr : 15; /*!< The value of the TAI-UTC Delta Current state */
+ uint16_t tai_utc_delta_new : 15; /*!< The value of the TAI-UTC Delta New state */
+ uint8_t tai_delta_change[5]; /*!< The value of the TAI of Delta Change field */
+ } time; /*!< Parameters of the Time state */
+ uint8_t time_role; /*!< The value of the Time Role state */
+} esp_ble_mesh_time_state_t;
+
+/** User data of Time Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Time Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_time_state_t *state; /*!< Parameters of the Time state */
+} esp_ble_mesh_time_srv_t;
+
+/** User data of Time Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Time Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_time_state_t *state; /*!< Parameters of the Time state */
+} esp_ble_mesh_time_setup_srv_t;
+
+/**
+ * 1. Scene Store is an operation of storing values of a present state of an element.
+ * 2. The structure and meaning of the stored state is determined by a model. States
+ * to be stored are specified by each model.
+ * 3. The Scene Store operation shall persistently store all values of all states
+ * marked as Stored with Scene for all models present on all elements of a node.
+ * 4. If a model is extending another model, the extending model shall determine the
+ * Stored with Scene behavior of that model.
+ */
+
+/** Parameters of Scene Register state */
+typedef struct {
+ uint16_t scene_number; /*!< The value of the Scene Number */
+ uint8_t scene_type; /*!< The value of the Scene Type */
+ /**
+ * Scene value may use a union to represent later, the union contains
+ * structures of all the model states which can be stored in a scene.
+ */
+ struct net_buf_simple *scene_value; /*!< The value of the Scene Value */
+} esp_ble_mesh_scene_register_t;
+
+/**
+ * Parameters of Scenes state.
+ *
+ * Scenes serve as memory banks for storage of states (e.g., a power level
+ * or a light level/color). Values of states of an element can be stored
+ * as a scene and can be recalled later from the scene memory.
+ *
+ * A scene is represented by a Scene Number, which is a 16-bit non-zero,
+ * mesh-wide value. (There can be a maximum of 65535 scenes in a mesh
+ * network.) The meaning of a scene, as well as the state storage container
+ * associated with it, are determined by a model.
+ *
+ * The Scenes state change may start numerous parallel model transitions.
+ * In that case, each individual model handles the transition internally.
+ *
+ * The scene transition is defined as a group of individual model transitions
+ * started by a Scene Recall operation. The scene transition is in progress
+ * when at least one transition from the group of individual model transitions
+ * is in progress.
+ */
+typedef struct {
+ const uint16_t scene_count; /*!< The Scenes state's scene count */
+ esp_ble_mesh_scene_register_t *scenes; /*!< Parameters of the Scenes state */
+
+ /**
+ * The Current Scene state is a 16-bit value that contains either the Scene
+ * Number of the currently active scene or a value of 0x0000 when no scene
+ * is active.
+ *
+ * When a Scene Store operation or a Scene Recall operation completes with
+ * success, the Current Scene state value shall be to the Scene Number used
+ * during that operation.
+ *
+ * When the Current Scene Number is deleted from a Scene Register state as a
+ * result of Scene Delete operation, the Current Scene state shall be set to
+ * 0x0000.
+ *
+ * When any of the element's state that is marked as “Stored with Scene” has
+ * changed not as a result of a Scene Recall operation, the value of the
+ * Current Scene state shall be set to 0x0000.
+ *
+ * When a scene transition is in progress, the value of the Current Scene
+ * state shall be set to 0x0000.
+ */
+ uint16_t current_scene; /*!< The value of the Current Scene state */
+
+ /**
+ * The Target Scene state is a 16-bit value that contains the target Scene
+ * Number when a scene transition is in progress.
+ *
+ * When the scene transition is in progress and the target Scene Number is
+ * deleted from a Scene Register state as a result of Scene Delete operation,
+ * the Target Scene state shall be set to 0x0000.
+ *
+ * When the scene transition is in progress and a new Scene Number is stored
+ * in the Scene Register as a result of Scene Store operation, the Target
+ * Scene state shall be set to the new Scene Number.
+ *
+ * When the scene transition is not in progress, the value of the Target Scene
+ * state shall be set to 0x0000.
+ */
+ uint16_t target_scene; /*!< The value of the Target Scene state */
+
+ /* Indicate the status code for the last operation */
+ uint8_t status_code; /*!< The status code of the last scene operation */
+
+ /* Indicate if scene transition is in progress */
+ bool in_progress; /*!< Indicate if the scene transition is in progress */
+} esp_ble_mesh_scenes_state_t;
+
+/** User data of Scene Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Scene Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_scenes_state_t *state; /*!< Parameters of the Scenes state */
+ esp_ble_mesh_last_msg_info_t last; /*!< Parameters of the last received set message */
+ esp_ble_mesh_state_transition_t transition; /*!< Parameters of state transition */
+} esp_ble_mesh_scene_srv_t;
+
+/** User data of Scene Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Scene Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_scenes_state_t *state; /*!< Parameters of the Scenes state */
+} esp_ble_mesh_scene_setup_srv_t;
+
+/** Parameters of Scheduler Register state */
+typedef struct {
+ bool in_use; /*!< Indicate if the registered schedule is in use */
+ uint64_t year : 7, /*!< The value of Scheduled year for the action */
+ month : 12, /*!< The value of Scheduled month for the action */
+ day : 5, /*!< The value of Scheduled day of the month for the action */
+ hour : 5, /*!< The value of Scheduled hour for the action */
+ minute : 6, /*!< The value of Scheduled minute for the action */
+ second : 6, /*!< The value of Scheduled second for the action */
+ day_of_week : 7, /*!< The value of Schedule days of the week for the action */
+ action : 4, /*!< The value of Action to be performed at the scheduled time */
+ trans_time : 8; /*!< The value of Transition time for this action */
+ uint16_t scene_number; /*!< The value of Scene Number to be used for some actions */
+} esp_ble_mesh_schedule_register_t;
+
+/** Parameters of Scheduler state */
+typedef struct {
+ const uint8_t schedule_count; /*!< Scheduler count */
+ esp_ble_mesh_schedule_register_t *schedules; /*!< Up to 16 scheduled entries */
+} esp_ble_mesh_scheduler_state_t;
+
+/** User data of Scheduler Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Scheduler Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_scheduler_state_t *state; /*!< Parameters of the Scheduler state */
+} esp_ble_mesh_scheduler_srv_t;
+
+/** User data of Scheduler Setup Server Model */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to the Scheduler Setup Server Model. Initialized internally. */
+ esp_ble_mesh_server_rsp_ctrl_t rsp_ctrl; /*!< Response control of the server model received messages */
+ esp_ble_mesh_scheduler_state_t *state; /*!< Parameters of the Scheduler state */
+} esp_ble_mesh_scheduler_setup_srv_t;
+
+/** Parameters of Time Set state change event */
+typedef struct {
+ uint8_t tai_seconds[5]; /*!< The current TAI time in seconds */
+ uint8_t subsecond; /*!< The sub-second time in units of 1/256 second */
+ uint8_t uncertainty; /*!< The estimated uncertainty in 10-millisecond steps */
+ uint16_t time_authority : 1; /*!< 0 = No Time Authority, 1 = Time Authority */
+ uint16_t tai_utc_delta_curr : 15; /*!< Current difference between TAI and UTC in seconds */
+ uint8_t time_zone_offset_curr; /*!< The local time zone offset in 15-minute increments */
+} esp_ble_mesh_state_change_time_set_t;
+
+/** Parameters of Time Status state change event */
+typedef struct {
+ uint8_t tai_seconds[5]; /*!< The current TAI time in seconds */
+ uint8_t subsecond; /*!< The sub-second time in units of 1/256 second */
+ uint8_t uncertainty; /*!< The estimated uncertainty in 10-millisecond steps */
+ uint16_t time_authority : 1; /*!< 0 = No Time Authority, 1 = Time Authority */
+ uint16_t tai_utc_delta_curr : 15; /*!< Current difference between TAI and UTC in seconds */
+ uint8_t time_zone_offset_curr; /*!< The local time zone offset in 15-minute increments */
+} esp_ble_mesh_state_change_time_status_t;
+
+/** Parameters of Time Zone Set state change event */
+typedef struct {
+ uint8_t time_zone_offset_new; /*!< Upcoming local time zone offset */
+ uint8_t tai_zone_change[5]; /*!< TAI Seconds time of the upcoming Time Zone Offset change */
+} esp_ble_mesh_state_change_time_zone_set_t;
+
+/** Parameters of TAI UTC Delta Set state change event */
+typedef struct {
+ uint16_t tai_utc_delta_new : 15; /*!< Upcoming difference between TAI and UTC in seconds */
+ uint8_t tai_delta_change[5]; /*!< TAI Seconds time of the upcoming TAI-UTC Delta change */
+} esp_ble_mesh_state_change_tai_utc_delta_set_t;
+
+/** Parameter of Time Role Set state change event */
+typedef struct {
+ uint8_t time_role; /*!< The Time Role for the element */
+} esp_ble_mesh_state_change_time_role_set_t;
+
+/** Parameter of Scene Store state change event */
+typedef struct {
+ uint16_t scene_number; /*!< The number of scenes to be stored */
+} esp_ble_mesh_state_change_scene_store_t;
+
+/** Parameter of Scene Recall state change event */
+typedef struct {
+ uint16_t scene_number; /*!< The number of scenes to be recalled */
+} esp_ble_mesh_state_change_scene_recall_t;
+
+/** Parameter of Scene Delete state change event */
+typedef struct {
+ uint16_t scene_number; /*!< The number of scenes to be deleted */
+} esp_ble_mesh_state_change_scene_delete_t;
+
+/** Parameter of Scheduler Action Set state change event */
+typedef struct {
+ uint64_t index : 4; /*!< Index of the Schedule Register entry to set */
+ uint64_t year : 7; /*!< Scheduled year for the action */
+ uint64_t month : 12; /*!< Scheduled month for the action */
+ uint64_t day : 5; /*!< Scheduled day of the month for the action */
+ uint64_t hour : 5; /*!< Scheduled hour for the action */
+ uint64_t minute : 6; /*!< Scheduled minute for the action */
+ uint64_t second : 6; /*!< Scheduled second for the action */
+ uint64_t day_of_week : 7; /*!< Schedule days of the week for the action */
+ uint64_t action : 4; /*!< Action to be performed at the scheduled time */
+ uint64_t trans_time : 8; /*!< Transition time for this action */
+ uint16_t scene_number; /*!< Scene number to be used for some actions */
+} esp_ble_mesh_state_change_scheduler_act_set_t;
+
+/**
+ * @brief Time Scene Server Model state change value union
+ */
+typedef union {
+ /**
+ * The recv_op in ctx can be used to decide which state is changed.
+ */
+ esp_ble_mesh_state_change_time_set_t time_set; /*!< Time Set */
+ esp_ble_mesh_state_change_time_status_t time_status; /*!< Time Status */
+ esp_ble_mesh_state_change_time_zone_set_t time_zone_set; /*!< Time Zone Set */
+ esp_ble_mesh_state_change_tai_utc_delta_set_t tai_utc_delta_set; /*!< TAI UTC Delta Set */
+ esp_ble_mesh_state_change_time_role_set_t time_role_set; /*!< Time Role Set */
+ esp_ble_mesh_state_change_scene_store_t scene_store; /*!< Scene Store */
+ esp_ble_mesh_state_change_scene_recall_t scene_recall; /*!< Scene Recall */
+ esp_ble_mesh_state_change_scene_delete_t scene_delete; /*!< Scene Delete */
+ esp_ble_mesh_state_change_scheduler_act_set_t scheduler_act_set; /*!< Scheduler Action Set */
+} esp_ble_mesh_time_scene_server_state_change_t;
+
+/** Context of the received Scheduler Action Get message */
+typedef struct {
+ uint8_t index; /*!< Index of the Schedule Register entry to get */
+} esp_ble_mesh_server_recv_scheduler_act_get_t;
+
+/**
+ * @brief Time Scene Server Model received get message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_scheduler_act_get_t scheduler_act; /*!< Scheduler Action Get */
+} esp_ble_mesh_time_scene_server_recv_get_msg_t;
+
+/** Context of the received Time Set message */
+typedef struct {
+ uint8_t tai_seconds[5]; /*!< The current TAI time in seconds */
+ uint8_t subsecond; /*!< The sub-second time in units of 1/256 second */
+ uint8_t uncertainty; /*!< The estimated uncertainty in 10-millisecond steps */
+ uint16_t time_authority : 1; /*!< 0 = No Time Authority, 1 = Time Authority */
+ uint16_t tai_utc_delta : 15; /*!< Current difference between TAI and UTC in seconds */
+ uint8_t time_zone_offset; /*!< The local time zone offset in 15-minute increments */
+} esp_ble_mesh_server_recv_time_set_t;
+
+/** Context of the received Time Zone Set message */
+typedef struct {
+ uint8_t time_zone_offset_new; /*!< Upcoming local time zone offset */
+ uint8_t tai_zone_change[5]; /*!< TAI Seconds time of the upcoming Time Zone Offset change */
+} esp_ble_mesh_server_recv_time_zone_set_t;
+
+/** Context of the received TAI UTC Delta Set message */
+typedef struct {
+ uint16_t tai_utc_delta_new : 15; /*!< Upcoming difference between TAI and UTC in seconds */
+ uint16_t padding : 1; /*!< Always 0b0. Other values are Prohibited. */
+ uint8_t tai_delta_change[5]; /*!< TAI Seconds time of the upcoming TAI-UTC Delta change */
+} esp_ble_mesh_server_recv_tai_utc_delta_set_t;
+
+/** Context of the received Time Role Set message */
+typedef struct {
+ uint8_t time_role; /*!< The Time Role for the element */
+} esp_ble_mesh_server_recv_time_role_set_t;
+
+/** Context of the received Scene Store message */
+typedef struct {
+ uint16_t scene_number; /*!< The number of scenes to be stored */
+} esp_ble_mesh_server_recv_scene_store_t;
+
+/** Context of the received Scene Recall message */
+typedef struct {
+ bool op_en; /*!< Indicate if optional parameters are included */
+ uint16_t scene_number; /*!< The number of scenes to be recalled */
+ uint8_t tid; /*!< Transaction ID */
+ uint8_t trans_time; /*!< Time to complete state transition (optional) */
+ uint8_t delay; /*!< Indicate message execution delay (C.1) */
+} esp_ble_mesh_server_recv_scene_recall_t;
+
+/** Context of the received Scene Delete message */
+typedef struct {
+ uint16_t scene_number; /*!< The number of scenes to be deleted */
+} esp_ble_mesh_server_recv_scene_delete_t;
+
+/** Context of the received Scheduler Action Set message */
+typedef struct {
+ uint64_t index : 4; /*!< Index of the Schedule Register entry to set */
+ uint64_t year : 7; /*!< Scheduled year for the action */
+ uint64_t month : 12; /*!< Scheduled month for the action */
+ uint64_t day : 5; /*!< Scheduled day of the month for the action */
+ uint64_t hour : 5; /*!< Scheduled hour for the action */
+ uint64_t minute : 6; /*!< Scheduled minute for the action */
+ uint64_t second : 6; /*!< Scheduled second for the action */
+ uint64_t day_of_week : 7; /*!< Schedule days of the week for the action */
+ uint64_t action : 4; /*!< Action to be performed at the scheduled time */
+ uint64_t trans_time : 8; /*!< Transition time for this action */
+ uint16_t scene_number; /*!< Scene number to be used for some actions */
+} esp_ble_mesh_server_recv_scheduler_act_set_t;
+
+/**
+ * @brief Time Scene Server Model received set message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_time_set_t time; /*!< Time Set */
+ esp_ble_mesh_server_recv_time_zone_set_t time_zone; /*!< Time Zone Set */
+ esp_ble_mesh_server_recv_tai_utc_delta_set_t tai_utc_delta; /*!< TAI-UTC Delta Set */
+ esp_ble_mesh_server_recv_time_role_set_t time_role; /*!< Time Role Set */
+ esp_ble_mesh_server_recv_scene_store_t scene_store; /*!< Scene Store/Scene Store Unack */
+ esp_ble_mesh_server_recv_scene_recall_t scene_recall; /*!< Scene Recall/Scene Recall Unack */
+ esp_ble_mesh_server_recv_scene_delete_t scene_delete; /*!< Scene Delete/Scene Delete Unack */
+ esp_ble_mesh_server_recv_scheduler_act_set_t scheduler_act; /*!< Scheduler Action Set/Scheduler Action Set Unack */
+} esp_ble_mesh_time_scene_server_recv_set_msg_t;
+
+/** Context of the received Time Status message */
+typedef struct {
+ uint8_t tai_seconds[5]; /*!< The current TAI time in seconds */
+ uint8_t subsecond; /*!< The sub-second time in units of 1/256 second */
+ uint8_t uncertainty; /*!< The estimated uncertainty in 10-millisecond steps */
+ uint16_t time_authority : 1; /*!< 0 = No Time Authority, 1 = Time Authority */
+ uint16_t tai_utc_delta : 15; /*!< Current difference between TAI and UTC in seconds */
+ uint8_t time_zone_offset; /*!< The local time zone offset in 15-minute increments */
+} esp_ble_mesh_server_recv_time_status_t;
+
+/**
+ * @brief Time Scene Server Model received status message union
+ */
+typedef union {
+ esp_ble_mesh_server_recv_time_status_t time_status; /*!< Time Status */
+} esp_ble_mesh_time_scene_server_recv_status_msg_t;
+
+/**
+ * @brief Time Scene Server Model callback value union
+ */
+typedef union {
+ esp_ble_mesh_time_scene_server_state_change_t state_change; /*!< ESP_BLE_MESH_TIME_SCENE_SERVER_STATE_CHANGE_EVT */
+ esp_ble_mesh_time_scene_server_recv_get_msg_t get; /*!< ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_GET_MSG_EVT */
+ esp_ble_mesh_time_scene_server_recv_set_msg_t set; /*!< ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_SET_MSG_EVT */
+ esp_ble_mesh_time_scene_server_recv_status_msg_t status; /*!< ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_STATUS_MSG_EVT */
+} esp_ble_mesh_time_scene_server_cb_value_t;
+
+/** Time Scene Server Model callback parameters */
+typedef struct {
+ esp_ble_mesh_model_t *model; /*!< Pointer to Time and Scenes Server Models */
+ esp_ble_mesh_msg_ctx_t ctx; /*!< Context of the received messages */
+ esp_ble_mesh_time_scene_server_cb_value_t value; /*!< Value of the received Time and Scenes Messages */
+} esp_ble_mesh_time_scene_server_cb_param_t;
+
+/** This enum value is the event of Time Scene Server Model */
+typedef enum {
+ /**
+ * 1. When get_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, no event will be
+ * callback to the application layer when Time Scene Get messages are received.
+ * 2. When set_auto_rsp is set to ESP_BLE_MESH_SERVER_AUTO_RSP, this event will
+ * be callback to the application layer when Time Scene Set/Set Unack messages
+ * are received.
+ */
+ ESP_BLE_MESH_TIME_SCENE_SERVER_STATE_CHANGE_EVT,
+ /**
+ * When get_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Time Scene Get messages are received.
+ */
+ ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_GET_MSG_EVT,
+ /**
+ * When set_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will be
+ * callback to the application layer when Time Scene Set/Set Unack messages are received.
+ */
+ ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_SET_MSG_EVT,
+ /**
+ * When status_auto_rsp is set to ESP_BLE_MESH_SERVER_RSP_BY_APP, this event will
+ * be callback to the application layer when TIme Status message is received.
+ */
+ ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_STATUS_MSG_EVT,
+ ESP_BLE_MESH_TIME_SCENE_SERVER_EVT_MAX,
+} esp_ble_mesh_time_scene_server_cb_event_t;
+
+/**
+ * @brief Bluetooth Mesh Time and Scenes Server Model function.
+ */
+
+/**
+ * @brief Time Scene Server Model callback function type
+ * @param event: Event type
+ * @param param: Pointer to callback parameter
+ */
+typedef void (* esp_ble_mesh_time_scene_server_cb_t)(esp_ble_mesh_time_scene_server_cb_event_t event,
+ esp_ble_mesh_time_scene_server_cb_param_t *param);
+
+/**
+ * @brief Register BLE Mesh Time and Scenes Server Model callback.
+ *
+ * @param[in] callback: Pointer to the callback function.
+ *
+ * @return ESP_OK on success or error code otherwise.
+ *
+ */
+esp_err_t esp_ble_mesh_register_time_scene_server_callback(esp_ble_mesh_time_scene_server_cb_t callback);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ESP_BLE_MESH_TIME_SCENE_MODEL_API_H_ */