From 675c94a9d4bc82f231a3412ce84d2c4212373460 Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 09:22:29 +0800 Subject: [PATCH 01/11] ble_mesh: stack: Introduce a new header file mesh_config.h --- .../mesh_common/include/mesh_buf.h | 2 +- .../mesh_common/include/mesh_config.h | 30 +++++++++++++++++++ .../mesh_common/include/mesh_kernel.h | 2 +- .../mesh_core/include/mesh_access.h | 2 +- .../mesh_core/include/mesh_bearer_adapt.h | 2 +- 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h index 4a47b1c0c6..5b77c3d398 100644 --- a/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h @@ -11,7 +11,7 @@ #ifndef _BLE_MESH_BUF_H_ #define _BLE_MESH_BUF_H_ -#include "sdkconfig.h" +#include "mesh_config.h" #include "mesh_slist.h" #include "mesh_compiler.h" diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h new file mode 100644 index 0000000000..9aefe420cd --- /dev/null +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h @@ -0,0 +1,30 @@ +// Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _BLE_MESH_CONFIG_H_ +#define _BLE_MESH_CONFIG_H_ + +#include "sdkconfig.h" + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif /* _BLE_MESH_CONFIG_H_ */ \ No newline at end of file diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_kernel.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_kernel.h index 84ab518353..48c40d2595 100644 --- a/components/bt/esp_ble_mesh/mesh_common/include/mesh_kernel.h +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_kernel.h @@ -13,7 +13,7 @@ #include "freertos/queue.h" #include "freertos/semphr.h" -#include "sdkconfig.h" +#include "mesh_config.h" #include "mesh_types.h" #ifdef __cplusplus diff --git a/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h b/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h index 31a8bbfb56..0ee1859e30 100644 --- a/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h +++ b/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h @@ -11,7 +11,7 @@ #ifndef _BLE_MESH_ACCESS_H_ #define _BLE_MESH_ACCESS_H_ -#include "sdkconfig.h" +#include "mesh_config.h" #include "mesh_buf.h" #include "mesh_timer.h" diff --git a/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h b/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h index 4dc18f07ff..396c862396 100644 --- a/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h +++ b/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h @@ -10,7 +10,7 @@ #define _BLE_MESH_BEARER_ADAPT_H_ #include -#include "sdkconfig.h" +#include "mesh_config.h" #include "mesh_types.h" #include "mesh_util.h" #include "mesh_uuid.h" From 051f02ee80681149e535433e549367ecbc50e761 Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 10:19:31 +0800 Subject: [PATCH 02/11] ble_mesh: stack: Add a Kconfig option to make deinit optional --- components/bt/esp_ble_mesh/Kconfig.in | 7 ++++ .../api/core/esp_ble_mesh_common_api.c | 3 +- .../api/core/esp_ble_mesh_networking_api.c | 2 + .../bt/esp_ble_mesh/api/esp_ble_mesh_defs.h | 2 + .../bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c | 4 ++ .../bt/esp_ble_mesh/mesh_common/mesh_mutex.c | 42 ++++++++++--------- .../bt/esp_ble_mesh/mesh_common/mesh_timer.c | 2 + components/bt/esp_ble_mesh/mesh_core/access.c | 34 ++++++++------- components/bt/esp_ble_mesh/mesh_core/adv.c | 6 +++ components/bt/esp_ble_mesh/mesh_core/beacon.c | 2 + .../bluedroid_host/mesh_bearer_adapt.c | 2 + .../bt/esp_ble_mesh/mesh_core/cfg_cli.c | 6 +++ .../bt/esp_ble_mesh/mesh_core/cfg_srv.c | 4 ++ components/bt/esp_ble_mesh/mesh_core/friend.c | 2 + .../bt/esp_ble_mesh/mesh_core/health_cli.c | 6 +++ .../bt/esp_ble_mesh/mesh_core/health_srv.c | 4 ++ .../mesh_core/include/mesh_access.h | 2 + components/bt/esp_ble_mesh/mesh_core/lpn.c | 2 + components/bt/esp_ble_mesh/mesh_core/main.c | 2 + components/bt/esp_ble_mesh/mesh_core/net.c | 2 + .../mesh_core/nimble_host/mesh_bearer_adapt.c | 2 + components/bt/esp_ble_mesh/mesh_core/prov.c | 4 ++ .../esp_ble_mesh/mesh_core/provisioner_main.c | 4 ++ .../esp_ble_mesh/mesh_core/provisioner_prov.c | 8 ++++ .../bt/esp_ble_mesh/mesh_core/proxy_client.c | 2 + .../bt/esp_ble_mesh/mesh_core/proxy_server.c | 2 + .../bt/esp_ble_mesh/mesh_core/settings.c | 18 ++++---- .../mesh_core/storage/settings_nvs.c | 6 +++ .../bt/esp_ble_mesh/mesh_core/transport.c | 6 +++ .../mesh_models/client/client_common.c | 4 ++ .../mesh_models/client/generic_client.c | 6 +++ .../mesh_models/client/lighting_client.c | 6 +++ .../mesh_models/client/sensor_client.c | 6 +++ .../mesh_models/client/time_scene_client.c | 6 +++ .../mesh_models/server/generic_server.c | 32 ++++++++++++++ .../mesh_models/server/lighting_server.c | 30 +++++++++++++ .../mesh_models/server/sensor_server.c | 6 +++ .../mesh_models/server/server_common.c | 2 + .../mesh_models/server/time_scene_server.c | 16 +++++++ 39 files changed, 258 insertions(+), 44 deletions(-) diff --git a/components/bt/esp_ble_mesh/Kconfig.in b/components/bt/esp_ble_mesh/Kconfig.in index edb3b66cfd..97c4c876b6 100644 --- a/components/bt/esp_ble_mesh/Kconfig.in +++ b/components/bt/esp_ble_mesh/Kconfig.in @@ -95,6 +95,13 @@ if BLE_MESH endchoice # BLE_MESH_FREERTOS_STATIC_ALLOC_MODE + config BLE_MESH_DEINIT + bool "Support de-initialize BLE Mesh stack" + default y + help + If enabled, users can use the function esp_ble_mesh_deinit() to de-initialize + the whole BLE Mesh stack. + config BLE_MESH_FAST_PROV bool "Enable BLE Mesh Fast Provisioning" select BLE_MESH_NODE diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c index 09e453a2a3..b8f1c3c8b9 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_common_api.c @@ -69,6 +69,7 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp 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}; @@ -89,4 +90,4 @@ esp_err_t esp_ble_mesh_deinit(esp_ble_mesh_deinit_param_t *param) return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } - +#endif /* CONFIG_BLE_MESH_DEINIT */ diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c index f614798ca4..5e850a7436 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c @@ -164,6 +164,7 @@ esp_err_t esp_ble_mesh_client_model_init(esp_ble_mesh_model_t *model) 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) { @@ -174,6 +175,7 @@ esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model) 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, diff --git a/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h b/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h index e96068d5d7..c858070bc3 100644 --- a/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h +++ b/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h @@ -468,8 +468,10 @@ 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. diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c index 6bd6016651..636ff92222 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c @@ -962,10 +962,12 @@ int btc_ble_mesh_client_model_init(esp_ble_mesh_model_t *model) return bt_mesh_client_init((struct bt_mesh_model *)model); } +#if CONFIG_BLE_MESH_DEINIT int btc_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model) { return bt_mesh_client_deinit((struct bt_mesh_model *)model); } +#endif /* CONFIG_BLE_MESH_DEINIT */ int32_t btc_ble_mesh_model_pub_period_get(esp_ble_mesh_model_t *mod) { @@ -2027,10 +2029,12 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg) arg->model_unsub_group_addr.model_id, arg->model_unsub_group_addr.group_addr); break; +#if CONFIG_BLE_MESH_DEINIT case BTC_BLE_MESH_ACT_DEINIT_MESH: act = ESP_BLE_MESH_DEINIT_MESH_COMP_EVT; param.deinit_mesh_comp.err_code = bt_mesh_deinit((struct bt_mesh_deinit_param *)&arg->mesh_deinit.param); break; +#endif /* CONFIG_BLE_MESH_DEINIT */ default: BT_WARN("%s, Unknown act %d", __func__, msg->act); return; diff --git a/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c b/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c index 5cee41e4f7..d8b3496622 100644 --- a/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c +++ b/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c @@ -89,11 +89,6 @@ static void bt_mesh_alarm_mutex_new(void) } } -static void bt_mesh_alarm_mutex_free(void) -{ - bt_mesh_mutex_free(&alarm_lock); -} - void bt_mesh_alarm_lock(void) { bt_mesh_mutex_lock(&alarm_lock); @@ -111,11 +106,6 @@ static void bt_mesh_list_mutex_new(void) } } -static void bt_mesh_list_mutex_free(void) -{ - bt_mesh_mutex_free(&list_lock); -} - void bt_mesh_list_lock(void) { bt_mesh_mutex_lock(&list_lock); @@ -133,11 +123,6 @@ static void bt_mesh_buf_mutex_new(void) } } -static void bt_mesh_buf_mutex_free(void) -{ - bt_mesh_mutex_free(&buf_lock); -} - void bt_mesh_buf_lock(void) { bt_mesh_mutex_lock(&buf_lock); @@ -155,11 +140,6 @@ static void bt_mesh_atomic_mutex_new(void) } } -static void bt_mesh_atomic_mutex_free(void) -{ - bt_mesh_mutex_free(&atomic_lock); -} - void bt_mesh_atomic_lock(void) { bt_mesh_mutex_lock(&atomic_lock); @@ -178,6 +158,27 @@ void bt_mesh_mutex_init(void) bt_mesh_atomic_mutex_new(); } +#if CONFIG_BLE_MESH_DEINIT +static void bt_mesh_alarm_mutex_free(void) +{ + bt_mesh_mutex_free(&alarm_lock); +} + +static void bt_mesh_list_mutex_free(void) +{ + bt_mesh_mutex_free(&list_lock); +} + +static void bt_mesh_buf_mutex_free(void) +{ + bt_mesh_mutex_free(&buf_lock); +} + +static void bt_mesh_atomic_mutex_free(void) +{ + bt_mesh_mutex_free(&atomic_lock); +} + void bt_mesh_mutex_deinit(void) { bt_mesh_alarm_mutex_free(); @@ -185,3 +186,4 @@ void bt_mesh_mutex_deinit(void) bt_mesh_buf_mutex_free(); bt_mesh_atomic_mutex_free(); } +#endif diff --git a/components/bt/esp_ble_mesh/mesh_common/mesh_timer.c b/components/bt/esp_ble_mesh/mesh_common/mesh_timer.c index 0f7bcfe193..e1a88d0612 100644 --- a/components/bt/esp_ble_mesh/mesh_common/mesh_timer.c +++ b/components/bt/esp_ble_mesh/mesh_common/mesh_timer.c @@ -51,6 +51,7 @@ void bt_mesh_timer_init(void) __ASSERT(bm_alarm_hash_map, "Failed to create hash map"); } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_timer_deinit(void) { if (bm_alarm_hash_map) { @@ -58,6 +59,7 @@ void bt_mesh_timer_deinit(void) bm_alarm_hash_map = NULL; } } +#endif /* CONFIG_BLE_MESH_DEINIT */ int k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler) { diff --git a/components/bt/esp_ble_mesh/mesh_core/access.c b/components/bt/esp_ble_mesh/mesh_core/access.c index 2f6fe91402..7c67a81979 100644 --- a/components/bt/esp_ble_mesh/mesh_core/access.c +++ b/components/bt/esp_ble_mesh/mesh_core/access.c @@ -364,6 +364,23 @@ static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem, } } +int bt_mesh_comp_register(const struct bt_mesh_comp *comp) +{ + int err = 0; + + /* There must be at least one element */ + if (!comp->elem_count) { + return -EINVAL; + } + + dev_comp = comp; + + bt_mesh_model_foreach(mod_init, &err); + + return err; +} + +#if CONFIG_BLE_MESH_DEINIT static void mod_deinit(struct bt_mesh_model *mod, struct bt_mesh_elem *elem, bool vnd, bool primary, void *user_data) { @@ -404,22 +421,6 @@ static void mod_deinit(struct bt_mesh_model *mod, struct bt_mesh_elem *elem, } } -int bt_mesh_comp_register(const struct bt_mesh_comp *comp) -{ - int err = 0; - - /* There must be at least one element */ - if (!comp->elem_count) { - return -EINVAL; - } - - dev_comp = comp; - - bt_mesh_model_foreach(mod_init, &err); - - return err; -} - int bt_mesh_comp_deregister(void) { int err = 0; @@ -434,6 +435,7 @@ int bt_mesh_comp_deregister(void) return err; } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_comp_provision(u16_t addr) { diff --git a/components/bt/esp_ble_mesh/mesh_core/adv.c b/components/bt/esp_ble_mesh/mesh_core/adv.c index 60e1ea664c..388f256be6 100644 --- a/components/bt/esp_ble_mesh/mesh_core/adv.c +++ b/components/bt/esp_ble_mesh/mesh_core/adv.c @@ -110,7 +110,9 @@ static struct ble_adv_tx { #define SEND_BLE_ADV_INFINITE 0xFFFF +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_ble_adv_deinit(void); +#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */ struct bt_mesh_adv_task { @@ -857,6 +859,7 @@ void bt_mesh_adv_init(void) #endif /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL && CONFIG_SPIRAM_CACHE_WORKAROUND && CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY */ } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_adv_deinit(void) { if (adv_queue.handle == NULL) { @@ -910,6 +913,7 @@ void bt_mesh_adv_deinit(void) bt_mesh_ble_adv_deinit(); #endif } +#endif /* CONFIG_BLE_MESH_DEINIT */ int bt_mesh_scan_enable(void) { @@ -1225,6 +1229,7 @@ int bt_mesh_stop_ble_advertising(u8_t index) return 0; } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_ble_adv_deinit(void) { for (int i = 0; i < ARRAY_SIZE(ble_adv_tx); i++) { @@ -1234,4 +1239,5 @@ static void bt_mesh_ble_adv_deinit(void) bt_mesh_unref_buf_from_pool(&ble_adv_buf_pool); memset(ble_adv_pool, 0, sizeof(ble_adv_pool)); } +#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_SUPPORT_BLE_ADV */ diff --git a/components/bt/esp_ble_mesh/mesh_core/beacon.c b/components/bt/esp_ble_mesh/mesh_core/beacon.c index 1ae51acdf2..03776de7d0 100644 --- a/components/bt/esp_ble_mesh/mesh_core/beacon.c +++ b/components/bt/esp_ble_mesh/mesh_core/beacon.c @@ -447,10 +447,12 @@ void bt_mesh_beacon_init(void) k_delayed_work_init(&beacon_timer, beacon_send); } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_beacon_deinit(void) { k_delayed_work_free(&beacon_timer); } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_beacon_ivu_initiator(bool enable) { diff --git a/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c b/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c index 7e9241a3fb..af3e7f4630 100644 --- a/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c +++ b/components/bt/esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c @@ -1749,6 +1749,7 @@ void bt_mesh_gatt_init(void) #endif } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_gatt_deinit(void) { #if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \ @@ -1778,6 +1779,7 @@ void bt_mesh_gatt_deinit(void) } #endif } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_adapt_init(void) { diff --git a/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c b/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c index 16c2f6d909..83e74d0c45 100644 --- a/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c +++ b/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c @@ -79,10 +79,12 @@ static void bt_mesh_cfg_client_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_cfg_client_mutex_free(void) { bt_mesh_mutex_free(&cfg_client_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_cfg_client_lock(void) { @@ -1286,6 +1288,7 @@ static int cfg_cli_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int cfg_cli_deinit(struct bt_mesh_model *model) { bt_mesh_config_client_t *client = NULL; @@ -1319,8 +1322,11 @@ static int cfg_cli_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_cfg_cli_cb = { .init = cfg_cli_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = cfg_cli_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c index 0f6429cd69..cb07f8c10e 100644 --- a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c +++ b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c @@ -3397,6 +3397,7 @@ static int cfg_srv_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int cfg_srv_deinit(struct bt_mesh_model *model) { struct bt_mesh_cfg_srv *cfg = model->user_data; @@ -3423,10 +3424,13 @@ static int cfg_srv_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_cfg_srv_cb = { .init = cfg_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = cfg_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; static void mod_reset(struct bt_mesh_model *mod, struct bt_mesh_elem *elem, diff --git a/components/bt/esp_ble_mesh/mesh_core/friend.c b/components/bt/esp_ble_mesh/mesh_core/friend.c index b9955709a8..ba46c6bd5b 100644 --- a/components/bt/esp_ble_mesh/mesh_core/friend.c +++ b/components/bt/esp_ble_mesh/mesh_core/friend.c @@ -1277,6 +1277,7 @@ int bt_mesh_friend_init(void) return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_friend_deinit(void) { int i; @@ -1304,6 +1305,7 @@ int bt_mesh_friend_deinit(void) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ static bool is_segack(struct net_buf *buf, const u64_t *seqauth, u16_t src) { diff --git a/components/bt/esp_ble_mesh/mesh_core/health_cli.c b/components/bt/esp_ble_mesh/mesh_core/health_cli.c index 07c0c0cc34..be4bf8b122 100644 --- a/components/bt/esp_ble_mesh/mesh_core/health_cli.c +++ b/components/bt/esp_ble_mesh/mesh_core/health_cli.c @@ -37,10 +37,12 @@ static void bt_mesh_health_client_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_health_client_mutex_free(void) { bt_mesh_mutex_free(&health_client_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_health_client_lock(void) { @@ -343,6 +345,7 @@ static int health_cli_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int health_cli_deinit(struct bt_mesh_model *model) { bt_mesh_health_client_t *client = NULL; @@ -373,8 +376,11 @@ static int health_cli_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_health_cli_cb = { .init = health_cli_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = health_cli_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_core/health_srv.c b/components/bt/esp_ble_mesh/mesh_core/health_srv.c index e37ff6943f..4d6088fb44 100644 --- a/components/bt/esp_ble_mesh/mesh_core/health_srv.c +++ b/components/bt/esp_ble_mesh/mesh_core/health_srv.c @@ -469,6 +469,7 @@ static int health_srv_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int health_srv_deinit(struct bt_mesh_model *model) { struct bt_mesh_health_srv *srv = model->user_data; @@ -499,10 +500,13 @@ static int health_srv_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_health_srv_cb = { .init = health_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = health_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; void bt_mesh_attention(struct bt_mesh_model *model, u8_t time) diff --git a/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h b/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h index 0ee1859e30..d02f965787 100644 --- a/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h +++ b/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h @@ -439,6 +439,7 @@ struct bt_mesh_model_cb { */ int (*const init)(struct bt_mesh_model *model); +#if CONFIG_BLE_MESH_DEINIT /** @brief Model deinit callback. * * Called on every model instance during mesh deinitialization. @@ -451,6 +452,7 @@ struct bt_mesh_model_cb { * @param model Model to be de-initialized. */ int (*const deinit)(struct bt_mesh_model *model); +#endif /* CONFIG_BLE_MESH_DEINIT */ }; /** Abstraction that describes a Mesh Model instance */ diff --git a/components/bt/esp_ble_mesh/mesh_core/lpn.c b/components/bt/esp_ble_mesh/mesh_core/lpn.c index 7ba704573a..0562c059bb 100644 --- a/components/bt/esp_ble_mesh/mesh_core/lpn.c +++ b/components/bt/esp_ble_mesh/mesh_core/lpn.c @@ -1090,6 +1090,7 @@ int bt_mesh_lpn_init(void) return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_lpn_deinit(void) { struct bt_mesh_lpn *lpn = &bt_mesh.lpn; @@ -1100,5 +1101,6 @@ int bt_mesh_lpn_deinit(void) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_LOW_POWER */ diff --git a/components/bt/esp_ble_mesh/mesh_core/main.c b/components/bt/esp_ble_mesh/mesh_core/main.c index 341fc8dd6f..f2bbd63714 100644 --- a/components/bt/esp_ble_mesh/mesh_core/main.c +++ b/components/bt/esp_ble_mesh/mesh_core/main.c @@ -426,6 +426,7 @@ int bt_mesh_init(const struct bt_mesh_prov *prov, return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_deinit(struct bt_mesh_deinit_param *param) { int err = 0; @@ -541,6 +542,7 @@ int bt_mesh_deinit(struct bt_mesh_deinit_param *param) mesh_init = false; return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ #if defined(CONFIG_BLE_MESH_PROVISIONER) int bt_mesh_provisioner_enable(bt_mesh_prov_bearer_t bearers) diff --git a/components/bt/esp_ble_mesh/mesh_core/net.c b/components/bt/esp_ble_mesh/mesh_core/net.c index ab6867833e..eb83b9e802 100644 --- a/components/bt/esp_ble_mesh/mesh_core/net.c +++ b/components/bt/esp_ble_mesh/mesh_core/net.c @@ -1572,6 +1572,7 @@ void bt_mesh_net_init(void) k_work_init(&bt_mesh.local_work, bt_mesh_net_local); } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_net_deinit(void) { k_delayed_work_free(&bt_mesh.ivu_timer); @@ -1595,3 +1596,4 @@ void bt_mesh_net_deinit(void) bt_mesh.iv_index = 0U; bt_mesh.seq = 0U; } +#endif /* CONFIG_BLE_MESH_DEINIT */ diff --git a/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c b/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c index 6d1e06c6aa..b337fdc935 100644 --- a/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c +++ b/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c @@ -1716,6 +1716,7 @@ void bt_mesh_gatt_init(void) #endif } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_gatt_deinit(void) { #if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \ @@ -1739,6 +1740,7 @@ void bt_mesh_gatt_deinit(void) } #endif } +#endif /* CONFIG_BLE_MESH_DEINIT */ void ble_sm_alg_ecc_init(void); diff --git a/components/bt/esp_ble_mesh/mesh_core/prov.c b/components/bt/esp_ble_mesh/mesh_core/prov.c index 268f83d606..f560a911b5 100644 --- a/components/bt/esp_ble_mesh/mesh_core/prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/prov.c @@ -203,10 +203,12 @@ static void bt_mesh_pb_buf_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_pb_buf_mutex_free(void) { bt_mesh_mutex_free(&pb_buf_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_pb_buf_lock(void) { @@ -1776,6 +1778,7 @@ int bt_mesh_prov_init(const struct bt_mesh_prov *prov_info) return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_prov_deinit(void) { if (prov == NULL) { @@ -1805,6 +1808,7 @@ int bt_mesh_prov_deinit(void) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_prov_complete(u16_t net_idx, const u8_t net_key[16], u16_t addr, u8_t flags, u32_t iv_index) diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c b/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c index fd6008a8ea..6f52902cea 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c @@ -43,10 +43,12 @@ static void bt_mesh_provisioner_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_provisioner_mutex_free(void) { bt_mesh_mutex_free(&provisioner_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_provisioner_lock(void) { @@ -159,6 +161,7 @@ done: return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_provisioner_deinit(bool erase) { int i; @@ -194,6 +197,7 @@ int bt_mesh_provisioner_deinit(bool erase) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ bool bt_mesh_provisioner_check_is_addr_dup(u16_t addr, u8_t elem_num, bool comp_with_own) { diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c index e9fcd12782..454833569b 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c @@ -363,10 +363,12 @@ static void bt_mesh_pb_adv_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_pb_adv_mutex_free(void) { bt_mesh_mutex_free(&prov_ctx.pb_adv_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_pb_adv_lock(void) { @@ -385,10 +387,12 @@ static void bt_mesh_pb_buf_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_pb_buf_mutex_free(void) { bt_mesh_mutex_free(&prov_ctx.pb_buf_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_pb_buf_lock(void) { @@ -409,10 +413,12 @@ static void bt_mesh_pb_gatt_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_pb_gatt_mutex_free(void) { bt_mesh_mutex_free(&prov_ctx.pb_gatt_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_pb_gatt_lock(void) { @@ -3348,6 +3354,7 @@ int bt_mesh_provisioner_prov_init(const struct bt_mesh_prov *prov_info) return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_provisioner_prov_deinit(bool erase) { int i; @@ -3398,6 +3405,7 @@ int bt_mesh_provisioner_prov_deinit(bool erase) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ static bool is_unprov_dev_info_callback_to_app(bt_mesh_prov_bearer_t bearer, const u8_t uuid[16], const bt_mesh_addr_t *addr, u16_t oob_info, s8_t rssi) diff --git a/components/bt/esp_ble_mesh/mesh_core/proxy_client.c b/components/bt/esp_ble_mesh/mesh_core/proxy_client.c index c9072ba872..334e078aaf 100644 --- a/components/bt/esp_ble_mesh/mesh_core/proxy_client.c +++ b/components/bt/esp_ble_mesh/mesh_core/proxy_client.c @@ -998,6 +998,7 @@ int bt_mesh_proxy_client_init(void) return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_proxy_client_deinit(void) { int i; @@ -1015,5 +1016,6 @@ int bt_mesh_proxy_client_deinit(void) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_CLIENT */ diff --git a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c index 0ae040e73e..1480e44a04 100644 --- a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c +++ b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c @@ -1444,6 +1444,7 @@ int bt_mesh_proxy_server_init(void) return bt_mesh_gatts_set_local_device_name(device_name); } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_proxy_server_deinit(void) { int i; @@ -1474,5 +1475,6 @@ int bt_mesh_proxy_server_deinit(void) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_SERVER */ diff --git a/components/bt/esp_ble_mesh/mesh_core/settings.c b/components/bt/esp_ble_mesh/mesh_core/settings.c index ccd1bdaa1f..59aebd94aa 100644 --- a/components/bt/esp_ble_mesh/mesh_core/settings.c +++ b/components/bt/esp_ble_mesh/mesh_core/settings.c @@ -178,10 +178,12 @@ static void bt_mesh_settings_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_settings_mutex_free(void) { bt_mesh_mutex_free(&settings_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_settings_lock(void) { @@ -2627,6 +2629,14 @@ int settings_core_init(void) return 0; } +int bt_mesh_settings_init(void) +{ + bt_mesh_settings_mutex_new(); + bt_mesh_settings_init_foreach(); + return 0; +} + +#if CONFIG_BLE_MESH_DEINIT int settings_core_deinit(void) { k_delayed_work_free(&pending_store); @@ -2646,18 +2656,12 @@ int settings_core_erase(void) return 0; } -int bt_mesh_settings_init(void) -{ - bt_mesh_settings_mutex_new(); - bt_mesh_settings_init_foreach(); - return 0; -} - int bt_mesh_settings_deinit(bool erase) { bt_mesh_settings_deinit_foreach(erase); bt_mesh_settings_mutex_free(); return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_SETTINGS */ diff --git a/components/bt/esp_ble_mesh/mesh_core/storage/settings_nvs.c b/components/bt/esp_ble_mesh/mesh_core/storage/settings_nvs.c index af84ab4d7e..8786598722 100644 --- a/components/bt/esp_ble_mesh/mesh_core/storage/settings_nvs.c +++ b/components/bt/esp_ble_mesh/mesh_core/storage/settings_nvs.c @@ -32,8 +32,10 @@ struct settings_context { int (*settings_init)(void); int (*settings_load)(void); int (*settings_commit)(void); +#if CONFIG_BLE_MESH_DEINIT int (*settings_deinit)(void); int (*settings_erase)(void); +#endif /* CONFIG_BLE_MESH_DEINIT */ }; static struct settings_context settings_ctx[] = { @@ -42,8 +44,10 @@ static struct settings_context settings_ctx[] = { .settings_init = settings_core_init, .settings_load = settings_core_load, .settings_commit = settings_core_commit, +#if CONFIG_BLE_MESH_DEINIT .settings_deinit = settings_core_deinit, .settings_erase = settings_core_erase, +#endif /* CONFIG_BLE_MESH_DEINIT */ }, }; @@ -92,6 +96,7 @@ void bt_mesh_settings_init_foreach(void) } } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_settings_deinit_foreach(bool erase) { int i; @@ -116,6 +121,7 @@ void bt_mesh_settings_deinit_foreach(bool erase) nvs_flash_deinit_partition(CONFIG_BLE_MESH_PARTITION_NAME); #endif } +#endif /* CONFIG_BLE_MESH_DEINIT */ /* API used to get BLE Mesh related nvs handle */ diff --git a/components/bt/esp_ble_mesh/mesh_core/transport.c b/components/bt/esp_ble_mesh/mesh_core/transport.c index 40ca3eb9d0..176250ea04 100644 --- a/components/bt/esp_ble_mesh/mesh_core/transport.c +++ b/components/bt/esp_ble_mesh/mesh_core/transport.c @@ -123,10 +123,12 @@ static void bt_mesh_tx_seg_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_tx_seg_mutex_free(void) { bt_mesh_mutex_free(&tx_seg_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_tx_seg_lock(void) { @@ -145,10 +147,12 @@ static void bt_mesh_rx_seg_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_rx_seg_mutex_free(void) { bt_mesh_mutex_free(&rx_seg_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_rx_seg_lock(void) { @@ -1859,6 +1863,7 @@ void bt_mesh_trans_init(void) bt_mesh_rx_seg_mutex_new(); } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_trans_deinit(bool erase) { int i; @@ -1877,6 +1882,7 @@ void bt_mesh_trans_deinit(bool erase) bt_mesh_tx_seg_mutex_free(); bt_mesh_rx_seg_mutex_free(); } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_heartbeat_send(void) { diff --git a/components/bt/esp_ble_mesh/mesh_models/client/client_common.c b/components/bt/esp_ble_mesh/mesh_models/client/client_common.c index b61c5579c0..6064e92e5e 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/client_common.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/client_common.c @@ -363,10 +363,12 @@ static void bt_mesh_client_model_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_client_model_mutex_free(void) { bt_mesh_mutex_free(&client_model_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_client_model_lock(void) { @@ -415,6 +417,7 @@ int bt_mesh_client_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT int bt_mesh_client_deinit(struct bt_mesh_model *model) { bt_mesh_client_user_data_t *client = NULL; @@ -443,6 +446,7 @@ int bt_mesh_client_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ int bt_mesh_client_free_node(bt_mesh_client_node_t *node) { diff --git a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c index 91542536ca..432d81137f 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c @@ -118,10 +118,12 @@ static void bt_mesh_generic_client_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_generic_client_mutex_free(void) { bt_mesh_mutex_free(&generic_client_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_generic_client_lock(void) { @@ -1172,6 +1174,7 @@ static int generic_client_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int generic_client_deinit(struct bt_mesh_model *model) { bt_mesh_generic_client_t *client = NULL; @@ -1200,8 +1203,11 @@ static int generic_client_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_generic_client_cb = { .init = generic_client_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = generic_client_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c index eaf96b01aa..3371f1ab06 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c @@ -127,10 +127,12 @@ static void bt_mesh_light_client_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_light_client_mutex_free(void) { bt_mesh_mutex_free(&light_client_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_light_client_lock(void) { @@ -1362,6 +1364,7 @@ static int lighting_client_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int lighting_client_deinit(struct bt_mesh_model *model) { bt_mesh_light_client_t *client = NULL; @@ -1390,8 +1393,11 @@ static int lighting_client_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_lighting_client_cb = { .init = lighting_client_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = lighting_client_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c index 47ee42e2c0..52731ff585 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c @@ -56,10 +56,12 @@ static void bt_mesh_sensor_client_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_sensor_client_mutex_free(void) { bt_mesh_mutex_free(&sensor_client_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_sensor_client_lock(void) { @@ -612,6 +614,7 @@ static int sensor_client_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int sensor_client_deinit(struct bt_mesh_model *model) { bt_mesh_sensor_client_t *client = NULL; @@ -640,8 +643,11 @@ static int sensor_client_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_sensor_client_cb = { .init = sensor_client_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = sensor_client_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c index d99a685fc4..9308ecf2e9 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c @@ -72,10 +72,12 @@ static void bt_mesh_time_scene_client_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_time_scene_client_mutex_free(void) { bt_mesh_mutex_free(&time_scene_client_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ static void bt_mesh_time_scene_client_lock(void) { @@ -668,6 +670,7 @@ static int time_scene_client_init(struct bt_mesh_model *model) return 0; } +#if CONFIG_BLE_MESH_DEINIT static int time_scene_client_deinit(struct bt_mesh_model *model) { bt_mesh_time_scene_client_t *client = NULL; @@ -696,8 +699,11 @@ static int time_scene_client_deinit(struct bt_mesh_model *model) return 0; } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb = { .init = time_scene_client_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = time_scene_client_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c b/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c index 3de3a15454..cf78cd3541 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c @@ -25,10 +25,12 @@ static void bt_mesh_generic_server_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_generic_server_mutex_free(void) { bt_mesh_mutex_free(&generic_server_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_generic_server_lock(void) { @@ -2624,6 +2626,7 @@ static int gen_client_prop_srv_init(struct bt_mesh_model *model) return generic_server_init(model); } +#if CONFIG_BLE_MESH_DEINIT static int generic_server_deinit(struct bt_mesh_model *model) { if (model->user_data == NULL) { @@ -2794,73 +2797,102 @@ static int gen_client_prop_srv_deinit(struct bt_mesh_model *model) return generic_server_deinit(model); } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_gen_onoff_srv_cb = { .init = gen_onoff_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_onoff_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_level_srv_cb = { .init = gen_level_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_level_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_def_trans_time_srv_cb = { .init = gen_def_trans_time_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_def_trans_time_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_power_onoff_srv_cb = { .init = gen_power_onoff_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_power_onoff_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_power_onoff_setup_srv_cb = { .init = gen_power_onoff_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_power_onoff_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_power_level_srv_cb = { .init = gen_power_level_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_power_level_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_power_level_setup_srv_cb = { .init = gen_power_level_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_power_level_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_battery_srv_cb = { .init = gen_battery_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_battery_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_location_srv_cb = { .init = gen_location_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_location_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_location_setup_srv_cb = { .init = gen_location_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_location_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_user_prop_srv_cb = { .init = gen_user_prop_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_user_prop_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_admin_prop_srv_cb = { .init = gen_admin_prop_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_admin_prop_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_manu_prop_srv_cb = { .init = gen_manu_prop_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_manu_prop_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_gen_client_prop_srv_cb = { .init = gen_client_prop_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = gen_client_prop_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c b/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c index a974c244d8..f11178c0a5 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c @@ -25,10 +25,12 @@ static void bt_mesh_light_server_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_light_server_mutex_free(void) { bt_mesh_mutex_free(&light_server_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_light_server_lock(void) { @@ -3326,6 +3328,7 @@ static int light_lc_setup_srv_init(struct bt_mesh_model *model) return light_server_init(model); } +#if CONFIG_BLE_MESH_DEINIT static int light_server_deinit(struct bt_mesh_model *model) { if (model->user_data == NULL) { @@ -3551,68 +3554,95 @@ static int light_lc_setup_srv_deinit(struct bt_mesh_model *model) return light_server_deinit(model); } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_light_lightness_srv_cb = { .init = light_lightness_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_lightness_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_lightness_setup_srv_cb = { .init = light_lightness_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_lightness_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_ctl_srv_cb = { .init = light_ctl_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_ctl_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_ctl_setup_srv_cb = { .init = light_ctl_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_ctl_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_ctl_temp_srv_cb = { .init = light_ctl_temp_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_ctl_temp_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_hsl_srv_cb = { .init = light_hsl_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_hsl_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_hsl_setup_srv_cb = { .init = light_hsl_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_hsl_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_hsl_hue_srv_cb = { .init = light_hsl_hue_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_hsl_hue_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_hsl_sat_srv_cb = { .init = light_hsl_sat_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_hsl_sat_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_xyl_srv_cb = { .init = light_xyl_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_xyl_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_xyl_setup_srv_cb = { .init = light_xyl_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_xyl_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_lc_srv_cb = { .init = light_lc_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_lc_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_light_lc_setup_srv_cb = { .init = light_lc_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = light_lc_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c b/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c index 2cdccb8cab..d01aa2e2aa 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c @@ -1127,6 +1127,7 @@ static int sensor_setup_srv_init(struct bt_mesh_model *model) return sensor_server_init(model); } +#if CONFIG_BLE_MESH_DEINIT static int sensor_server_deinit(struct bt_mesh_model *model) { if (model->user_data == NULL) { @@ -1156,13 +1157,18 @@ static int sensor_setup_srv_deinit(struct bt_mesh_model *model) return sensor_server_deinit(model); } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_sensor_srv_cb = { .init = sensor_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = sensor_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_sensor_setup_srv_cb = { .init = sensor_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = sensor_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; diff --git a/components/bt/esp_ble_mesh/mesh_models/server/server_common.c b/components/bt/esp_ble_mesh/mesh_models/server/server_common.c index b1efe926f1..236e9e53b3 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/server_common.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/server_common.c @@ -190,6 +190,7 @@ void bt_mesh_server_alloc_ctx(struct k_work *work) } } +#if CONFIG_BLE_MESH_DEINIT void bt_mesh_server_free_ctx(struct k_work *work) { __ASSERT(work, "Invalid parameter"); @@ -198,6 +199,7 @@ void bt_mesh_server_free_ctx(struct k_work *work) work->_reserved = NULL; } } +#endif /* CONFIG_BLE_MESH_DEINIT */ bool bt_mesh_is_server_recv_last_msg(struct bt_mesh_last_msg_info *last, u8_t tid, u16_t src, u16_t dst, s64_t *now) diff --git a/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c b/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c index ad382b7cb3..d0bd7a1244 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c @@ -30,10 +30,12 @@ static void bt_mesh_time_scene_server_mutex_new(void) } } +#if CONFIG_BLE_MESH_DEINIT static void bt_mesh_time_scene_server_mutex_free(void) { bt_mesh_mutex_free(&time_scene_server_lock); } +#endif /* CONFIG_BLE_MESH_DEINIT */ void bt_mesh_time_scene_server_lock(void) { @@ -1417,6 +1419,7 @@ static int scheduler_setup_srv_init(struct bt_mesh_model *model) return time_scene_server_init(model); } +#if CONFIG_BLE_MESH_DEINIT static int time_scene_server_deinit(struct bt_mesh_model *model) { if (model->user_data == NULL) { @@ -1499,33 +1502,46 @@ static int scheduler_setup_srv_deinit(struct bt_mesh_model *model) { return time_scene_server_deinit(model); } +#endif /* CONFIG_BLE_MESH_DEINIT */ const struct bt_mesh_model_cb bt_mesh_time_srv_cb = { .init = time_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = time_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_time_setup_srv_cb = { .init = time_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = time_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_scene_srv_cb = { .init = scene_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = scene_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_scene_setup_srv_cb = { .init = scene_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = scene_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_scheduler_srv_cb = { .init = scheduler_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = scheduler_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; const struct bt_mesh_model_cb bt_mesh_scheduler_setup_srv_cb = { .init = scheduler_setup_srv_init, +#if CONFIG_BLE_MESH_DEINIT .deinit = scheduler_setup_srv_deinit, +#endif /* CONFIG_BLE_MESH_DEINIT */ }; From b0f5e4b4ee5afbbbacf663adb5d409baadff4f7a Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 10:29:42 +0800 Subject: [PATCH 03/11] ble_mesh: ci: Add disabling mesh deinit sdkconfig test files --- .../sdkconfig.ci.bluedroid_deinit | 16 ++++++++++++++++ .../sdkconfig.ci.nimble_deinit | 16 ++++++++++++++++ .../sdkconfig.ci.bluedroid_deinit | 16 ++++++++++++++++ .../sdkconfig.ci.nimble_deinit | 15 +++++++++++++++ .../onoff_client/sdkconfig.ci.bluedroid_deinit | 18 ++++++++++++++++++ .../onoff_client/sdkconfig.ci.nimble_deinit | 15 +++++++++++++++ .../onoff_server/sdkconfig.ci.bluedroid_deinit | 16 ++++++++++++++++ .../onoff_server/sdkconfig.ci.nimble_deinit | 15 +++++++++++++++ .../sdkconfig.ci.bluedroid_deinit | 18 ++++++++++++++++++ .../sdkconfig.ci.nimble_deinit | 16 ++++++++++++++++ .../sdkconfig.ci.bluedroid_deinit | 16 ++++++++++++++++ .../sensor_client/sdkconfig.ci.nimble_deinit | 16 ++++++++++++++++ .../sdkconfig.ci.bluedroid_deinit | 15 +++++++++++++++ .../sensor_server/sdkconfig.ci.nimble_deinit | 14 ++++++++++++++ .../sdkconfig.ci.bluedroid_deinit | 15 +++++++++++++++ .../vendor_client/sdkconfig.ci.nimble_deinit | 15 +++++++++++++++ .../sdkconfig.ci.bluedroid_deinit | 15 +++++++++++++++ .../vendor_server/sdkconfig.ci.nimble_deinit | 14 ++++++++++++++ .../sdkconfig.ci.bluedroid_deinit | 18 ++++++++++++++++++ .../sdkconfig.ci.nimble_deinit | 17 +++++++++++++++++ 20 files changed, 316 insertions(+) create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.nimble_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.bluedroid_deinit create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.nimble_deinit diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..6a144edd5d --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,16 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..dd4ae0fe97 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.nimble_deinit @@ -0,0 +1,16 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..ac6f0a4b5f --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,16 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_FAST_PROV=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..75ed66cd5f --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.nimble_deinit @@ -0,0 +1,15 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_FAST_PROV=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..d62e047a6c --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,18 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +#| Proxy | PB-GATT | Proxy Server | Proxy Client | +#| Enable | Enable | Enable | Disable | +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..0107e1cef8 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.nimble_deinit @@ -0,0 +1,15 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..250d86888c --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,16 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_FRIEND=y +CONFIG_BLE_MESH_SETTINGS=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..7d9666431d --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.nimble_deinit @@ -0,0 +1,15 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_LOW_POWER=y +CONFIG_BLE_MESH_SETTINGS=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..1ce5d78982 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,18 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +#| Proxy | PB-GATT | Proxy Client | +#| Enable | Enable | Disable | +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..dd4ae0fe97 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.nimble_deinit @@ -0,0 +1,16 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..f9d04ff677 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,16 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_SENSOR_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..f1bea8c53f --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.nimble_deinit @@ -0,0 +1,16 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_SENSOR_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..30a9573c7e --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,15 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..c6da4726ab --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.nimble_deinit @@ -0,0 +1,14 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..9e56f97028 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,15 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..702ddae8ba --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.nimble_deinit @@ -0,0 +1,15 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..30a9573c7e --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,15 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..c6da4726ab --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.nimble_deinit @@ -0,0 +1,14 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.bluedroid_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.bluedroid_deinit new file mode 100644 index 0000000000..6d36b7b5aa --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.bluedroid_deinit @@ -0,0 +1,18 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_FAST_PROV=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_CFG_CLI=y + +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.nimble_deinit b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.nimble_deinit new file mode 100644 index 0000000000..8640ba3344 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.nimble_deinit @@ -0,0 +1,17 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_NIMBLE_ENABLED=y + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_DEINIT=n +CONFIG_BLE_MESH_FAST_PROV=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_CFG_CLI=y + +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y From d13e0635a8244973b724b3a467e24c7ed8708db0 Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 11:50:39 +0800 Subject: [PATCH 04/11] ble_mesh: stack: Make some internal static functions inline --- .../mesh_common/include/mesh_buf.h | 14 +++++------ .../mesh_common/include/mesh_dlist.h | 10 ++++---- .../mesh_common/include/mesh_slist.h | 6 ++--- .../bt/esp_ble_mesh/mesh_common/mesh_buf.c | 10 ++++---- .../bt/esp_ble_mesh/mesh_common/mesh_mutex.c | 18 +++++++------- .../bt/esp_ble_mesh/mesh_core/cfg_cli.c | 8 +++---- .../bt/esp_ble_mesh/mesh_core/health_cli.c | 8 +++---- .../mesh_core/include/mesh_bearer_adapt.h | 2 +- components/bt/esp_ble_mesh/mesh_core/prov.c | 8 +++---- .../esp_ble_mesh/mesh_core/provisioner_main.c | 8 +++---- .../esp_ble_mesh/mesh_core/provisioner_prov.c | 24 +++++++++---------- .../bt/esp_ble_mesh/mesh_core/settings.c | 4 ++-- .../bt/esp_ble_mesh/mesh_core/transport.c | 16 ++++++------- .../mesh_models/client/client_common.c | 4 ++-- .../mesh_models/client/generic_client.c | 8 +++---- .../mesh_models/client/sensor_client.c | 8 +++---- .../mesh_models/client/time_scene_client.c | 8 +++---- .../mesh_models/server/generic_server.c | 4 ++-- .../mesh_models/server/lighting_server.c | 4 ++-- .../mesh_models/server/time_scene_server.c | 4 ++-- 20 files changed, 89 insertions(+), 87 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h index 5b77c3d398..901aade955 100644 --- a/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_buf.h @@ -717,7 +717,7 @@ static inline void net_buf_simple_save(struct net_buf_simple *buf, * @param state Stored state. */ static inline void net_buf_simple_restore(struct net_buf_simple *buf, - struct net_buf_simple_state *state) + struct net_buf_simple_state *state) { buf->data = buf->__buf + state->offset; buf->len = state->len; @@ -963,7 +963,7 @@ int net_buf_id(struct net_buf *buf); */ #if defined(CONFIG_BLE_MESH_NET_BUF_LOG) struct net_buf *net_buf_alloc_fixed_debug(struct net_buf_pool *pool, s32_t timeout, - const char *func, int line); + const char *func, int line); #define net_buf_alloc_fixed(_pool, _timeout) \ net_buf_alloc_fixed_debug(_pool, _timeout, __func__, __LINE__) #else @@ -1631,8 +1631,8 @@ struct net_buf *net_buf_frag_add(struct net_buf *head, struct net_buf *frag); */ #if defined(CONFIG_BLE_MESH_NET_BUF_LOG) struct net_buf *net_buf_frag_del_debug(struct net_buf *parent, - struct net_buf *frag, - const char *func, int line); + struct net_buf *frag, + const char *func, int line); #define net_buf_frag_del(_parent, _frag) \ net_buf_frag_del_debug(_parent, _frag, __func__, __LINE__) #else @@ -1655,7 +1655,7 @@ struct net_buf *net_buf_frag_del(struct net_buf *parent, struct net_buf *frag); * @return number of bytes actually copied */ size_t net_buf_linearize(void *dst, size_t dst_len, - struct net_buf *src, size_t offset, size_t len); + struct net_buf *src, size_t offset, size_t len); /** * @typedef net_buf_allocator_cb @@ -1694,8 +1694,8 @@ typedef struct net_buf *(*net_buf_allocator_cb)(s32_t timeout, void *user_data); * were no free fragments in a pool to accommodate all data. */ size_t net_buf_append_bytes(struct net_buf *buf, size_t len, - const void *value, s32_t timeout, - net_buf_allocator_cb allocate_cb, void *user_data); + const void *value, s32_t timeout, + net_buf_allocator_cb allocate_cb, void *user_data); /** * @brief Skip N number of bytes in a net_buf diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_dlist.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_dlist.h index 31eef746ec..5ea69d5e6d 100644 --- a/components/bt/esp_ble_mesh/mesh_common/include/mesh_dlist.h +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_dlist.h @@ -291,7 +291,7 @@ static inline sys_dnode_t *sys_dlist_peek_head_not_empty(sys_dlist_t *list) */ static inline sys_dnode_t *sys_dlist_peek_next_no_check(sys_dlist_t *list, - sys_dnode_t *node) + sys_dnode_t *node) { return (node == list->tail) ? NULL : node->next; } @@ -307,7 +307,7 @@ static inline sys_dnode_t *sys_dlist_peek_next_no_check(sys_dlist_t *list, */ static inline sys_dnode_t *sys_dlist_peek_next(sys_dlist_t *list, - sys_dnode_t *node) + sys_dnode_t *node) { return node ? sys_dlist_peek_next_no_check(list, node) : NULL; } @@ -379,7 +379,8 @@ static inline void sys_dlist_prepend(sys_dlist_t *list, sys_dnode_t *node) */ static inline void sys_dlist_insert_after(sys_dlist_t *list, - sys_dnode_t *insert_point, sys_dnode_t *node) + sys_dnode_t *insert_point, + sys_dnode_t *node) { if (!insert_point) { sys_dlist_prepend(list, node); @@ -405,7 +406,8 @@ static inline void sys_dlist_insert_after(sys_dlist_t *list, */ static inline void sys_dlist_insert_before(sys_dlist_t *list, - sys_dnode_t *insert_point, sys_dnode_t *node) + sys_dnode_t *insert_point, + sys_dnode_t *node) { if (!insert_point) { sys_dlist_append(list, node); diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_slist.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_slist.h index 4ddf427e6a..fce4237fca 100644 --- a/components/bt/esp_ble_mesh/mesh_common/include/mesh_slist.h +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_slist.h @@ -312,7 +312,7 @@ static inline void sys_slist_append(sys_slist_t *list, * @param tail A pointer to the last element of the list to append */ static inline void sys_slist_append_list(sys_slist_t *list, - void *head, void *tail) + void *head, void *tail) { if (!list->tail) { list->head = (sys_snode_t *)head; @@ -333,7 +333,7 @@ static inline void sys_slist_append_list(sys_slist_t *list, * @param list_to_append A pointer to the list to append. */ static inline void sys_slist_merge_slist(sys_slist_t *list, - sys_slist_t *list_to_append) + sys_slist_t *list_to_append) { sys_slist_append_list(list, list_to_append->head, list_to_append->tail); @@ -443,7 +443,7 @@ static inline void sys_slist_remove(sys_slist_t *list, * @return true if node was removed */ static inline bool sys_slist_find_and_remove(sys_slist_t *list, - sys_snode_t *node) + sys_snode_t *node) { sys_snode_t *prev = NULL; sys_snode_t *test; diff --git a/components/bt/esp_ble_mesh/mesh_common/mesh_buf.c b/components/bt/esp_ble_mesh/mesh_common/mesh_buf.c index 21f3394d1d..1d7a711de8 100644 --- a/components/bt/esp_ble_mesh/mesh_common/mesh_buf.c +++ b/components/bt/esp_ble_mesh/mesh_common/mesh_buf.c @@ -16,7 +16,7 @@ int net_buf_id(struct net_buf *buf) } static inline struct net_buf *pool_get_uninit(struct net_buf_pool *pool, - u16_t uninit_count) + u16_t uninit_count) { struct net_buf *buf = NULL; @@ -604,8 +604,8 @@ success: #if defined(CONFIG_BLE_MESH_NET_BUF_LOG) struct net_buf *net_buf_alloc_fixed_debug(struct net_buf_pool *pool, - s32_t timeout, const char *func, - int line) + s32_t timeout, const char *func, + int line) { const struct net_buf_pool_fixed *fixed = pool->alloc->alloc_data; @@ -728,8 +728,8 @@ size_t net_buf_linearize(void *dst, size_t dst_len, struct net_buf *src, * the buffer. It assumes that the buffer has at least one fragment. */ size_t net_buf_append_bytes(struct net_buf *buf, size_t len, - const void *value, s32_t timeout, - net_buf_allocator_cb allocate_cb, void *user_data) + const void *value, s32_t timeout, + net_buf_allocator_cb allocate_cb, void *user_data) { struct net_buf *frag = net_buf_frag_last(buf); size_t added_len = 0U; diff --git a/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c b/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c index d8b3496622..99fdf72a46 100644 --- a/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c +++ b/components/bt/esp_ble_mesh/mesh_common/mesh_mutex.c @@ -82,7 +82,7 @@ void bt_mesh_mutex_unlock(bt_mesh_mutex_t *mutex) } } -static void bt_mesh_alarm_mutex_new(void) +static inline void bt_mesh_alarm_mutex_new(void) { if (!alarm_lock.mutex) { bt_mesh_mutex_create(&alarm_lock); @@ -99,7 +99,7 @@ void bt_mesh_alarm_unlock(void) bt_mesh_mutex_unlock(&alarm_lock); } -static void bt_mesh_list_mutex_new(void) +static inline void bt_mesh_list_mutex_new(void) { if (!list_lock.mutex) { bt_mesh_mutex_create(&list_lock); @@ -116,7 +116,7 @@ void bt_mesh_list_unlock(void) bt_mesh_mutex_unlock(&list_lock); } -static void bt_mesh_buf_mutex_new(void) +static inline void bt_mesh_buf_mutex_new(void) { if (!buf_lock.mutex) { bt_mesh_mutex_create(&buf_lock); @@ -133,7 +133,7 @@ void bt_mesh_buf_unlock(void) bt_mesh_mutex_unlock(&buf_lock); } -static void bt_mesh_atomic_mutex_new(void) +static inline void bt_mesh_atomic_mutex_new(void) { if (!atomic_lock.mutex) { bt_mesh_mutex_create(&atomic_lock); @@ -159,22 +159,22 @@ void bt_mesh_mutex_init(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_alarm_mutex_free(void) +static inline void bt_mesh_alarm_mutex_free(void) { bt_mesh_mutex_free(&alarm_lock); } -static void bt_mesh_list_mutex_free(void) +static inline void bt_mesh_list_mutex_free(void) { bt_mesh_mutex_free(&list_lock); } -static void bt_mesh_buf_mutex_free(void) +static inline void bt_mesh_buf_mutex_free(void) { bt_mesh_mutex_free(&buf_lock); } -static void bt_mesh_atomic_mutex_free(void) +static inline void bt_mesh_atomic_mutex_free(void) { bt_mesh_mutex_free(&atomic_lock); } @@ -186,4 +186,4 @@ void bt_mesh_mutex_deinit(void) bt_mesh_buf_mutex_free(); bt_mesh_atomic_mutex_free(); } -#endif +#endif /* CONFIG_BLE_MESH_DEINIT */ diff --git a/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c b/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c index 83e74d0c45..15dcf773b0 100644 --- a/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c +++ b/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c @@ -72,7 +72,7 @@ static const bt_mesh_client_op_pair_t cfg_op_pair[] = { static bt_mesh_mutex_t cfg_client_lock; -static void bt_mesh_cfg_client_mutex_new(void) +static inline void bt_mesh_cfg_client_mutex_new(void) { if (!cfg_client_lock.mutex) { bt_mesh_mutex_create(&cfg_client_lock); @@ -80,18 +80,18 @@ static void bt_mesh_cfg_client_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_cfg_client_mutex_free(void) +static inline void bt_mesh_cfg_client_mutex_free(void) { bt_mesh_mutex_free(&cfg_client_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_cfg_client_lock(void) +static inline void bt_mesh_cfg_client_lock(void) { bt_mesh_mutex_lock(&cfg_client_lock); } -static void bt_mesh_cfg_client_unlock(void) +static inline void bt_mesh_cfg_client_unlock(void) { bt_mesh_mutex_unlock(&cfg_client_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_core/health_cli.c b/components/bt/esp_ble_mesh/mesh_core/health_cli.c index be4bf8b122..eb27e4617b 100644 --- a/components/bt/esp_ble_mesh/mesh_core/health_cli.c +++ b/components/bt/esp_ble_mesh/mesh_core/health_cli.c @@ -30,7 +30,7 @@ static const bt_mesh_client_op_pair_t health_op_pair[] = { static bt_mesh_mutex_t health_client_lock; -static void bt_mesh_health_client_mutex_new(void) +static inline void bt_mesh_health_client_mutex_new(void) { if (!health_client_lock.mutex) { bt_mesh_mutex_create(&health_client_lock); @@ -38,18 +38,18 @@ static void bt_mesh_health_client_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_health_client_mutex_free(void) +static inline void bt_mesh_health_client_mutex_free(void) { bt_mesh_mutex_free(&health_client_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_health_client_lock(void) +static inline void bt_mesh_health_client_lock(void) { bt_mesh_mutex_lock(&health_client_lock); } -static void bt_mesh_health_client_unlock(void) +static inline void bt_mesh_health_client_unlock(void) { bt_mesh_mutex_unlock(&health_client_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h b/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h index 396c862396..1000290748 100644 --- a/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h +++ b/components/bt/esp_ble_mesh/mesh_core/include/mesh_bearer_adapt.h @@ -474,7 +474,7 @@ typedef void (*bt_mesh_dh_key_cb_t)(const u8_t key[32], const u8_t idx); * or BLE_MESH_GATT_ITER_STOP to stop. */ typedef u8_t (*bt_mesh_gatt_attr_func_t)(const struct bt_mesh_gatt_attr *attr, - void *user_data); + void *user_data); /** @brief Connection callback structure. * diff --git a/components/bt/esp_ble_mesh/mesh_core/prov.c b/components/bt/esp_ble_mesh/mesh_core/prov.c index f560a911b5..9ef3082f30 100644 --- a/components/bt/esp_ble_mesh/mesh_core/prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/prov.c @@ -196,7 +196,7 @@ static const struct bt_mesh_prov *prov; #if defined(CONFIG_BLE_MESH_PB_ADV) static bt_mesh_mutex_t pb_buf_lock; -static void bt_mesh_pb_buf_mutex_new(void) +static inline void bt_mesh_pb_buf_mutex_new(void) { if (!pb_buf_lock.mutex) { bt_mesh_mutex_create(&pb_buf_lock); @@ -204,18 +204,18 @@ static void bt_mesh_pb_buf_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_pb_buf_mutex_free(void) +static inline void bt_mesh_pb_buf_mutex_free(void) { bt_mesh_mutex_free(&pb_buf_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_pb_buf_lock(void) +static inline void bt_mesh_pb_buf_lock(void) { bt_mesh_mutex_lock(&pb_buf_lock); } -static void bt_mesh_pb_buf_unlock(void) +static inline void bt_mesh_pb_buf_unlock(void) { bt_mesh_mutex_unlock(&pb_buf_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c b/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c index 6f52902cea..28e771d786 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_main.c @@ -36,7 +36,7 @@ static u16_t node_count; static int provisioner_remove_node(u16_t index, bool erase); -static void bt_mesh_provisioner_mutex_new(void) +static inline void bt_mesh_provisioner_mutex_new(void) { if (!provisioner_lock.mutex) { bt_mesh_mutex_create(&provisioner_lock); @@ -44,18 +44,18 @@ static void bt_mesh_provisioner_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_provisioner_mutex_free(void) +static inline void bt_mesh_provisioner_mutex_free(void) { bt_mesh_mutex_free(&provisioner_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_provisioner_lock(void) +static inline void bt_mesh_provisioner_lock(void) { bt_mesh_mutex_lock(&provisioner_lock); } -static void bt_mesh_provisioner_unlock(void) +static inline void bt_mesh_provisioner_unlock(void) { bt_mesh_mutex_unlock(&provisioner_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c index 454833569b..c483e9128b 100644 --- a/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c +++ b/components/bt/esp_ble_mesh/mesh_core/provisioner_prov.c @@ -356,7 +356,7 @@ static u8_t adv_buf_data[ADV_BUF_SIZE * CONFIG_BLE_MESH_PBA_SAME_TIME]; } #if defined(CONFIG_BLE_MESH_PB_ADV) -static void bt_mesh_pb_adv_mutex_new(void) +static inline void bt_mesh_pb_adv_mutex_new(void) { if (!prov_ctx.pb_adv_lock.mutex) { bt_mesh_mutex_create(&prov_ctx.pb_adv_lock); @@ -364,23 +364,23 @@ static void bt_mesh_pb_adv_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_pb_adv_mutex_free(void) +static inline void bt_mesh_pb_adv_mutex_free(void) { bt_mesh_mutex_free(&prov_ctx.pb_adv_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_pb_adv_lock(void) +static inline void bt_mesh_pb_adv_lock(void) { bt_mesh_mutex_lock(&prov_ctx.pb_adv_lock); } -static void bt_mesh_pb_adv_unlock(void) +static inline void bt_mesh_pb_adv_unlock(void) { bt_mesh_mutex_unlock(&prov_ctx.pb_adv_lock); } -static void bt_mesh_pb_buf_mutex_new(void) +static inline void bt_mesh_pb_buf_mutex_new(void) { if (!prov_ctx.pb_buf_lock.mutex) { bt_mesh_mutex_create(&prov_ctx.pb_buf_lock); @@ -388,25 +388,25 @@ static void bt_mesh_pb_buf_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_pb_buf_mutex_free(void) +static inline void bt_mesh_pb_buf_mutex_free(void) { bt_mesh_mutex_free(&prov_ctx.pb_buf_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_pb_buf_lock(void) +static inline void bt_mesh_pb_buf_lock(void) { bt_mesh_mutex_lock(&prov_ctx.pb_buf_lock); } -static void bt_mesh_pb_buf_unlock(void) +static inline void bt_mesh_pb_buf_unlock(void) { bt_mesh_mutex_unlock(&prov_ctx.pb_buf_lock); } #endif /* CONFIG_BLE_MESH_PB_ADV */ #if defined(CONFIG_BLE_MESH_PB_GATT) -static void bt_mesh_pb_gatt_mutex_new(void) +static inline void bt_mesh_pb_gatt_mutex_new(void) { if (!prov_ctx.pb_gatt_lock.mutex) { bt_mesh_mutex_create(&prov_ctx.pb_gatt_lock); @@ -414,18 +414,18 @@ static void bt_mesh_pb_gatt_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_pb_gatt_mutex_free(void) +static inline void bt_mesh_pb_gatt_mutex_free(void) { bt_mesh_mutex_free(&prov_ctx.pb_gatt_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_pb_gatt_lock(void) +static inline void bt_mesh_pb_gatt_lock(void) { bt_mesh_mutex_lock(&prov_ctx.pb_gatt_lock); } -static void bt_mesh_pb_gatt_unlock(void) +static inline void bt_mesh_pb_gatt_unlock(void) { bt_mesh_mutex_unlock(&prov_ctx.pb_gatt_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_core/settings.c b/components/bt/esp_ble_mesh/mesh_core/settings.c index 59aebd94aa..5a9e11ba7e 100644 --- a/components/bt/esp_ble_mesh/mesh_core/settings.c +++ b/components/bt/esp_ble_mesh/mesh_core/settings.c @@ -171,7 +171,7 @@ struct node_info { static bt_mesh_mutex_t settings_lock; -static void bt_mesh_settings_mutex_new(void) +static inline void bt_mesh_settings_mutex_new(void) { if (settings_lock.mutex == NULL) { bt_mesh_mutex_create(&settings_lock); @@ -179,7 +179,7 @@ static void bt_mesh_settings_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_settings_mutex_free(void) +static inline void bt_mesh_settings_mutex_free(void) { bt_mesh_mutex_free(&settings_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_core/transport.c b/components/bt/esp_ble_mesh/mesh_core/transport.c index 176250ea04..c75cee2d34 100644 --- a/components/bt/esp_ble_mesh/mesh_core/transport.c +++ b/components/bt/esp_ble_mesh/mesh_core/transport.c @@ -116,7 +116,7 @@ static u16_t hb_sub_dst = BLE_MESH_ADDR_UNASSIGNED; static bt_mesh_mutex_t tx_seg_lock; static bt_mesh_mutex_t rx_seg_lock; -static void bt_mesh_tx_seg_mutex_new(void) +static inline void bt_mesh_tx_seg_mutex_new(void) { if (!tx_seg_lock.mutex) { bt_mesh_mutex_create(&tx_seg_lock); @@ -124,23 +124,23 @@ static void bt_mesh_tx_seg_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_tx_seg_mutex_free(void) +static inline void bt_mesh_tx_seg_mutex_free(void) { bt_mesh_mutex_free(&tx_seg_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_tx_seg_lock(void) +static inline void bt_mesh_tx_seg_lock(void) { bt_mesh_mutex_lock(&tx_seg_lock); } -static void bt_mesh_tx_seg_unlock(void) +static inline void bt_mesh_tx_seg_unlock(void) { bt_mesh_mutex_unlock(&tx_seg_lock); } -static void bt_mesh_rx_seg_mutex_new(void) +static inline void bt_mesh_rx_seg_mutex_new(void) { if (!rx_seg_lock.mutex) { bt_mesh_mutex_create(&rx_seg_lock); @@ -148,18 +148,18 @@ static void bt_mesh_rx_seg_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_rx_seg_mutex_free(void) +static inline void bt_mesh_rx_seg_mutex_free(void) { bt_mesh_mutex_free(&rx_seg_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_rx_seg_lock(void) +static inline void bt_mesh_rx_seg_lock(void) { bt_mesh_mutex_lock(&rx_seg_lock); } -static void bt_mesh_rx_seg_unlock(void) +static inline void bt_mesh_rx_seg_unlock(void) { bt_mesh_mutex_unlock(&rx_seg_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_models/client/client_common.c b/components/bt/esp_ble_mesh/mesh_models/client/client_common.c index 6064e92e5e..a12c66bcab 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/client_common.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/client_common.c @@ -356,7 +356,7 @@ int bt_mesh_client_send_msg(bt_mesh_client_common_param_t *param, static bt_mesh_mutex_t client_model_lock; -static void bt_mesh_client_model_mutex_new(void) +static inline void bt_mesh_client_model_mutex_new(void) { if (!client_model_lock.mutex) { bt_mesh_mutex_create(&client_model_lock); @@ -364,7 +364,7 @@ static void bt_mesh_client_model_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_client_model_mutex_free(void) +static inline void bt_mesh_client_model_mutex_free(void) { bt_mesh_mutex_free(&client_model_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c index 432d81137f..18d3e56933 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c @@ -111,7 +111,7 @@ static const bt_mesh_client_op_pair_t gen_op_pair[] = { static bt_mesh_mutex_t generic_client_lock; -static void bt_mesh_generic_client_mutex_new(void) +static inline void bt_mesh_generic_client_mutex_new(void) { if (!generic_client_lock.mutex) { bt_mesh_mutex_create(&generic_client_lock); @@ -119,18 +119,18 @@ static void bt_mesh_generic_client_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_generic_client_mutex_free(void) +static inline void bt_mesh_generic_client_mutex_free(void) { bt_mesh_mutex_free(&generic_client_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_generic_client_lock(void) +static inline void bt_mesh_generic_client_lock(void) { bt_mesh_mutex_lock(&generic_client_lock); } -static void bt_mesh_generic_client_unlock(void) +static inline void bt_mesh_generic_client_unlock(void) { bt_mesh_mutex_unlock(&generic_client_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c index 52731ff585..b94c5ae883 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c @@ -49,7 +49,7 @@ static const bt_mesh_client_op_pair_t sensor_op_pair[] = { static bt_mesh_mutex_t sensor_client_lock; -static void bt_mesh_sensor_client_mutex_new(void) +static inline void bt_mesh_sensor_client_mutex_new(void) { if (!sensor_client_lock.mutex) { bt_mesh_mutex_create(&sensor_client_lock); @@ -57,18 +57,18 @@ static void bt_mesh_sensor_client_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_sensor_client_mutex_free(void) +static inline void bt_mesh_sensor_client_mutex_free(void) { bt_mesh_mutex_free(&sensor_client_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_sensor_client_lock(void) +static inline void bt_mesh_sensor_client_lock(void) { bt_mesh_mutex_lock(&sensor_client_lock); } -static void bt_mesh_sensor_client_unlock(void) +static inline void bt_mesh_sensor_client_unlock(void) { bt_mesh_mutex_unlock(&sensor_client_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c index 9308ecf2e9..b889bc4f36 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c @@ -65,7 +65,7 @@ static const bt_mesh_client_op_pair_t time_scene_op_pair[] = { static bt_mesh_mutex_t time_scene_client_lock; -static void bt_mesh_time_scene_client_mutex_new(void) +static inline void bt_mesh_time_scene_client_mutex_new(void) { if (!time_scene_client_lock.mutex) { bt_mesh_mutex_create(&time_scene_client_lock); @@ -73,18 +73,18 @@ static void bt_mesh_time_scene_client_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_time_scene_client_mutex_free(void) +static inline void bt_mesh_time_scene_client_mutex_free(void) { bt_mesh_mutex_free(&time_scene_client_lock); } #endif /* CONFIG_BLE_MESH_DEINIT */ -static void bt_mesh_time_scene_client_lock(void) +static inline void bt_mesh_time_scene_client_lock(void) { bt_mesh_mutex_lock(&time_scene_client_lock); } -static void bt_mesh_time_scene_client_unlock(void) +static inline void bt_mesh_time_scene_client_unlock(void) { bt_mesh_mutex_unlock(&time_scene_client_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c b/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c index cf78cd3541..486ca9ba98 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c @@ -18,7 +18,7 @@ static bt_mesh_mutex_t generic_server_lock; -static void bt_mesh_generic_server_mutex_new(void) +static inline void bt_mesh_generic_server_mutex_new(void) { if (!generic_server_lock.mutex) { bt_mesh_mutex_create(&generic_server_lock); @@ -26,7 +26,7 @@ static void bt_mesh_generic_server_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_generic_server_mutex_free(void) +static inline void bt_mesh_generic_server_mutex_free(void) { bt_mesh_mutex_free(&generic_server_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c b/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c index f11178c0a5..fc6dfc8cfe 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c @@ -18,7 +18,7 @@ static bt_mesh_mutex_t light_server_lock; -static void bt_mesh_light_server_mutex_new(void) +static inline void bt_mesh_light_server_mutex_new(void) { if (!light_server_lock.mutex) { bt_mesh_mutex_create(&light_server_lock); @@ -26,7 +26,7 @@ static void bt_mesh_light_server_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_light_server_mutex_free(void) +static inline void bt_mesh_light_server_mutex_free(void) { bt_mesh_mutex_free(&light_server_lock); } diff --git a/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c b/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c index d0bd7a1244..2a86c1fcbd 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c @@ -23,7 +23,7 @@ static bt_mesh_mutex_t time_scene_server_lock; -static void bt_mesh_time_scene_server_mutex_new(void) +static inline void bt_mesh_time_scene_server_mutex_new(void) { if (!time_scene_server_lock.mutex) { bt_mesh_mutex_create(&time_scene_server_lock); @@ -31,7 +31,7 @@ static void bt_mesh_time_scene_server_mutex_new(void) } #if CONFIG_BLE_MESH_DEINIT -static void bt_mesh_time_scene_server_mutex_free(void) +static inline void bt_mesh_time_scene_server_mutex_free(void) { bt_mesh_mutex_free(&time_scene_server_lock); } From a1f1a6b48481ac22e4d841cdf2c3eda668cbe23f Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 15:15:18 +0800 Subject: [PATCH 05/11] ble_mesh: stack: Use Kconfig option to make client models optional --- components/bt/common/btc/core/btc_task.c | 12 ++++++ .../bt/esp_ble_mesh/api/esp_ble_mesh_defs.h | 1 + .../models/esp_ble_mesh_config_model_api.c | 16 ++++---- .../models/esp_ble_mesh_generic_model_api.c | 2 + .../models/esp_ble_mesh_health_model_api.c | 16 ++++---- .../models/esp_ble_mesh_lighting_model_api.c | 2 + .../models/esp_ble_mesh_sensor_model_api.c | 4 +- .../esp_ble_mesh_time_scene_model_api.c | 2 + .../btc/btc_ble_mesh_config_model.c | 3 ++ .../btc/btc_ble_mesh_generic_model.c | 3 ++ .../btc/btc_ble_mesh_health_model.c | 3 ++ .../btc/btc_ble_mesh_lighting_model.c | 3 ++ .../bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c | 37 ++++++++++++++++++- .../btc/btc_ble_mesh_sensor_model.c | 3 ++ .../btc/btc_ble_mesh_time_scene_model.c | 3 ++ .../btc/include/btc_ble_mesh_prov.h | 1 + .../mesh_common/include/mesh_config.h | 17 +++++++++ .../bt/esp_ble_mesh/mesh_core/cfg_cli.c | 5 +++ .../bt/esp_ble_mesh/mesh_core/health_cli.c | 5 +++ .../mesh_models/client/generic_client.c | 5 +++ .../mesh_models/client/lighting_client.c | 5 +++ .../mesh_models/client/sensor_client.c | 5 +++ .../mesh_models/client/time_scene_client.c | 5 +++ 23 files changed, 140 insertions(+), 18 deletions(-) diff --git a/components/bt/common/btc/core/btc_task.c b/components/bt/common/btc/core/btc_task.c index aee251ad1f..d830e83db1 100644 --- a/components/bt/common/btc/core/btc_task.c +++ b/components/bt/common/btc/core/btc_task.c @@ -124,14 +124,26 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = { #if CONFIG_BLE_MESH [BTC_PID_PROV] = {btc_ble_mesh_prov_call_handler, btc_ble_mesh_prov_cb_handler }, [BTC_PID_MODEL] = {btc_ble_mesh_model_call_handler, btc_ble_mesh_model_cb_handler }, +#if CONFIG_BLE_MESH_HEALTH_CLI [BTC_PID_HEALTH_CLIENT] = {btc_ble_mesh_health_client_call_handler, btc_ble_mesh_health_client_cb_handler }, +#endif /* CONFIG_BLE_MESH_HEALTH_CLI */ [BTC_PID_HEALTH_SERVER] = {btc_ble_mesh_health_server_call_handler, btc_ble_mesh_health_server_cb_handler }, +#if CONFIG_BLE_MESH_CFG_CLI [BTC_PID_CONFIG_CLIENT] = {btc_ble_mesh_config_client_call_handler, btc_ble_mesh_config_client_cb_handler }, +#endif /* CONFIG_BLE_MESH_CFG_CLI */ [BTC_PID_CONFIG_SERVER] = {NULL, btc_ble_mesh_config_server_cb_handler }, +#if BLE_MESH_GENERIC_CLIENT_ENABLE [BTC_PID_GENERIC_CLIENT] = {btc_ble_mesh_generic_client_call_handler, btc_ble_mesh_generic_client_cb_handler }, +#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ +#if BLE_MESH_LIGHTING_CLIENT_ENABLE [BTC_PID_LIGHTING_CLIENT] = {btc_ble_mesh_lighting_client_call_handler, btc_ble_mesh_lighting_client_cb_handler }, +#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ +#if CONFIG_BLE_MESH_SENSOR_CLI [BTC_PID_SENSOR_CLIENT] = {btc_ble_mesh_sensor_client_call_handler, btc_ble_mesh_sensor_client_cb_handler }, +#endif /* CONFIG_BLE_MESH_SENSOR_CLI */ +#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE [BTC_PID_TIME_SCENE_CLIENT] = {btc_ble_mesh_time_scene_client_call_handler, btc_ble_mesh_time_scene_client_cb_handler}, +#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ [BTC_PID_GENERIC_SERVER] = {NULL, btc_ble_mesh_generic_server_cb_handler }, [BTC_PID_LIGHTING_SERVER] = {NULL, btc_ble_mesh_lighting_server_cb_handler }, [BTC_PID_SENSOR_SERVER] = {NULL, btc_ble_mesh_sensor_server_cb_handler }, diff --git a/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h b/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h index c858070bc3..330f82096d 100644 --- a/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h +++ b/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h @@ -17,6 +17,7 @@ #include +#include "mesh_config.h" #include "mesh_common.h" #include "proxy_server.h" #include "provisioner_main.h" diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c index e0807815c2..52b712c399 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c @@ -19,6 +19,7 @@ #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); @@ -26,13 +27,6 @@ esp_err_t esp_ble_mesh_register_config_client_callback(esp_ble_mesh_cfg_client_c return (btc_profile_cb_set(BTC_PID_CONFIG_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL); } -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); -} - static bool config_client_get_need_param(esp_ble_mesh_opcode_t opcode) { switch (opcode) { @@ -101,3 +95,11 @@ esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_config_client_args_t), btc_ble_mesh_config_client_arg_deep_copy) == 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/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c index 27a55cbb87..5bbfbe6684 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c @@ -19,6 +19,7 @@ #include "btc_ble_mesh_generic_model.h" #include "esp_ble_mesh_generic_model_api.h" +#if BLE_MESH_GENERIC_CLIENT_ENABLE 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); @@ -89,6 +90,7 @@ esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } +#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ esp_err_t esp_ble_mesh_register_generic_server_callback(esp_ble_mesh_generic_server_cb_t callback) { diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c index dd6029411b..217bbc15af 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c @@ -19,6 +19,7 @@ #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); @@ -26,13 +27,6 @@ esp_err_t esp_ble_mesh_register_health_client_callback(esp_ble_mesh_health_clien return (btc_profile_cb_set(BTC_PID_HEALTH_CLIENT, callback) == 0 ? ESP_OK : ESP_FAIL); } -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_client_get_state(esp_ble_mesh_client_common_param_t *params, esp_ble_mesh_health_client_get_state_t *get_state) { @@ -83,6 +77,14 @@ esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_client_args_t), btc_ble_mesh_health_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } +#endif /* CONFIG_BLE_MESH_HEALTH_CLI */ + +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) { diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c index 02262f8cf3..9aa21ba06d 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c @@ -19,6 +19,7 @@ #include "btc_ble_mesh_lighting_model.h" #include "esp_ble_mesh_lighting_model_api.h" +#if BLE_MESH_LIGHTING_CLIENT_ENABLE 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); @@ -76,6 +77,7 @@ esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } +#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ esp_err_t esp_ble_mesh_register_lighting_server_callback(esp_ble_mesh_lighting_server_cb_t callback) { diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c index 45ee3863d1..602ebdfc35 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c @@ -19,6 +19,7 @@ #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); @@ -75,6 +76,7 @@ esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_ return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_sensor_client_args_t), btc_ble_mesh_sensor_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } +#endif /* CONFIG_BLE_MESH_SENSOR_CLI */ esp_err_t esp_ble_mesh_register_sensor_server_callback(esp_ble_mesh_sensor_server_cb_t callback) { @@ -82,5 +84,3 @@ esp_err_t esp_ble_mesh_register_sensor_server_callback(esp_ble_mesh_sensor_serve return (btc_profile_cb_set(BTC_PID_SENSOR_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL); } - - diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c index 5df12d965c..4dae28105b 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c @@ -19,6 +19,7 @@ #include "btc_ble_mesh_time_scene_model.h" #include "esp_ble_mesh_time_scene_model_api.h" +#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE 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); @@ -76,6 +77,7 @@ esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_pa return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } +#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ esp_err_t esp_ble_mesh_register_time_scene_server_callback(esp_ble_mesh_time_scene_server_cb_t callback) { diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c index 170ed4ff18..e4258912b8 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c @@ -20,6 +20,8 @@ #include "cfg_cli.h" #include "esp_ble_mesh_config_model_api.h" +#if CONFIG_BLE_MESH_CFG_CLI + /* Configuration Client Model related functions */ static inline void btc_ble_mesh_config_client_cb_to_app(esp_ble_mesh_cfg_client_cb_event_t event, @@ -678,6 +680,7 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_config_client_free_req_data(msg); return; } +#endif /* CONFIG_BLE_MESH_CFG_CLI */ /* Configuration Server Model related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c index 15b729a5a4..3cc7e2cee7 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c @@ -19,6 +19,8 @@ #include "generic_client.h" #include "esp_ble_mesh_generic_model_api.h" +#if BLE_MESH_GENERIC_CLIENT_ENABLE + /* Generic Client Models related functions */ static inline void btc_ble_mesh_generic_client_cb_to_app(esp_ble_mesh_generic_client_cb_event_t event, @@ -529,6 +531,7 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_generic_client_free_req_data(msg); return; } +#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ /* Generic Server Models related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c index 9e401446c8..13ad1f06bf 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c @@ -21,6 +21,8 @@ #include "health_cli.h" #include "esp_ble_mesh_health_model_api.h" +#if CONFIG_BLE_MESH_HEALTH_CLI + /* Health Client Model related functions */ static inline void btc_ble_mesh_health_client_cb_to_app(esp_ble_mesh_health_client_cb_event_t event, @@ -456,6 +458,7 @@ void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_health_client_free_req_data(msg); return; } +#endif /* CONFIG_BLE_MESH_HEALTH_CLI */ /* Health Server Model related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c index bd34808050..81abeb6ca0 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c @@ -19,6 +19,8 @@ #include "lighting_client.h" #include "esp_ble_mesh_lighting_model_api.h" +#if BLE_MESH_LIGHTING_CLIENT_ENABLE + /* Lighting Client Models related functions */ static inline void btc_ble_mesh_lighting_client_cb_to_app(esp_ble_mesh_light_client_cb_event_t event, @@ -373,6 +375,7 @@ void btc_ble_mesh_lighting_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_lighting_client_free_req_data(msg); return; } +#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ /* Lighting Server Models related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c index 636ff92222..6fb559d60d 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c @@ -1012,15 +1012,22 @@ const esp_ble_mesh_comp_t *btc_ble_mesh_comp_get(void) /* Configuration Models */ extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[]; -extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_cfg_srv_cb; +#if CONFIG_BLE_MESH_CFG_CLI +extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_cfg_cli_cb; +#endif /* CONFIG_BLE_MESH_CFG_CLI */ + /* Health Models */ extern const struct bt_mesh_model_op bt_mesh_health_srv_op[]; -extern const struct bt_mesh_model_op bt_mesh_health_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_health_srv_cb; +#if CONFIG_BLE_MESH_HEALTH_CLI +extern const struct bt_mesh_model_op bt_mesh_health_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_health_cli_cb; +#endif /* CONFIG_BLE_MESH_HEALTH_CLI */ + /* Generic Client Models */ +#if BLE_MESH_GENERIC_CLIENT_ENABLE extern const struct bt_mesh_model_op bt_mesh_gen_onoff_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_level_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_def_trans_time_cli_op[]; @@ -1030,21 +1037,32 @@ extern const struct bt_mesh_model_op bt_mesh_gen_battery_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_location_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_property_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_generic_client_cb; +#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ + /* Lighting Client Models */ +#if BLE_MESH_LIGHTING_CLIENT_ENABLE extern const struct bt_mesh_model_op bt_mesh_light_lightness_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_ctl_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_hsl_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_xyl_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_lc_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_lighting_client_cb; +#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ + /* Sensor Client Models */ +#if CONFIG_BLE_MESH_SENSOR_CLI extern const struct bt_mesh_model_op bt_mesh_sensor_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_sensor_client_cb; +#endif /* CONFIG_BLE_MESH_SENSOR_CLI */ + /* Time and Scenes Client Models */ +#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE extern const struct bt_mesh_model_op bt_mesh_time_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_scene_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_scheduler_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb; +#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ + /* Generic Server Models */ extern const struct bt_mesh_model_op bt_mesh_gen_onoff_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_level_srv_op[]; @@ -1074,6 +1092,7 @@ extern const struct bt_mesh_model_cb bt_mesh_gen_user_prop_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_gen_admin_prop_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_gen_manu_prop_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_gen_client_prop_srv_cb; + /* Lighting Server Models */ extern const struct bt_mesh_model_op bt_mesh_light_lightness_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_light_lightness_setup_srv_op[]; @@ -1101,6 +1120,7 @@ extern const struct bt_mesh_model_cb bt_mesh_light_xyl_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_xyl_setup_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_lc_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_lc_setup_srv_cb; + /* Time and Scenes Server Models */ extern const struct bt_mesh_model_op bt_mesh_time_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_time_setup_srv_op[]; @@ -1114,6 +1134,7 @@ extern const struct bt_mesh_model_cb bt_mesh_scene_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_scene_setup_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_scheduler_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_scheduler_setup_srv_cb; + /* Sensor Server Models */ extern const struct bt_mesh_model_op bt_mesh_sensor_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_sensor_setup_srv_op[]; @@ -1144,6 +1165,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#if CONFIG_BLE_MESH_CFG_CLI case BLE_MESH_MODEL_ID_CFG_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_cfg_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_cfg_cli_cb; @@ -1153,6 +1175,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#endif /* CONFIG_BLE_MESH_CFG_CLI */ case BLE_MESH_MODEL_ID_HEALTH_SRV: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_health_srv_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_health_srv_cb; @@ -1165,6 +1188,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#if CONFIG_BLE_MESH_HEALTH_CLI case BLE_MESH_MODEL_ID_HEALTH_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_health_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_health_cli_cb; @@ -1174,6 +1198,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#endif /* CONFIG_BLE_MESH_HEALTH_CLI */ +#if BLE_MESH_GENERIC_CLIENT_ENABLE case BLE_MESH_MODEL_ID_GEN_ONOFF_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_gen_onoff_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_generic_client_cb; @@ -1246,6 +1272,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ +#if BLE_MESH_LIGHTING_CLIENT_ENABLE case BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_light_lightness_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_lighting_client_cb; @@ -1291,6 +1319,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ +#if CONFIG_BLE_MESH_SENSOR_CLI case BLE_MESH_MODEL_ID_SENSOR_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_sensor_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_sensor_client_cb; @@ -1300,6 +1330,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#endif /* CONFIG_BLE_MESH_SENSOR_CLI */ +#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE case BLE_MESH_MODEL_ID_TIME_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_time_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_time_scene_client_cb; @@ -1327,6 +1359,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ case BLE_MESH_MODEL_ID_GEN_ONOFF_SRV: model->op = (esp_ble_mesh_model_op_t *)bt_mesh_gen_onoff_srv_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_gen_onoff_srv_cb; diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c index 048d9ddb6c..a217f09762 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c @@ -19,6 +19,8 @@ #include "sensor_client.h" #include "esp_ble_mesh_sensor_model_api.h" +#if CONFIG_BLE_MESH_SENSOR_CLI + /* Sensor Client Models related functions */ static inline void btc_ble_mesh_sensor_client_cb_to_app(esp_ble_mesh_sensor_client_cb_event_t event, @@ -611,6 +613,7 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_sensor_client_free_req_data(msg); return; } +#endif /* CONFIG_BLE_MESH_SENSOR_CLI */ /* Sensor Server Models related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c index 8fd1b4810c..7663684f48 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c @@ -19,6 +19,8 @@ #include "time_scene_client.h" #include "esp_ble_mesh_time_scene_model_api.h" +#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE + /* Time and Scenes Client Models related functions */ static inline void btc_ble_mesh_time_scene_client_cb_to_app(esp_ble_mesh_time_scene_client_cb_event_t event, @@ -375,6 +377,7 @@ void btc_ble_mesh_time_scene_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_time_scene_client_free_req_data(msg); return; } +#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ /* Time and Scenes Server Models related functions */ diff --git a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h index dffba81dea..eeb3782f5b 100644 --- a/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h +++ b/components/bt/esp_ble_mesh/btc/include/btc_ble_mesh_prov.h @@ -17,6 +17,7 @@ #include "btc/btc_manage.h" #include "mesh_byteorder.h" +#include "mesh_config.h" #include "mesh_main.h" #include "fast_prov.h" #include "provisioner_prov.h" diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h index 9aefe420cd..e370aa19aa 100644 --- a/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h @@ -21,7 +21,24 @@ extern "C" { #endif +#define BLE_MESH_GENERIC_CLIENT_ENABLE (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI | \ + CONFIG_BLE_MESH_GENERIC_LEVEL_CLI | \ + CONFIG_BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI | \ + CONFIG_BLE_MESH_GENERIC_POWER_ONOFF_CLI | \ + CONFIG_BLE_MESH_GENERIC_POWER_LEVEL_CLI | \ + CONFIG_BLE_MESH_GENERIC_BATTERY_CLI | \ + CONFIG_BLE_MESH_GENERIC_LOCATION_CLI | \ + CONFIG_BLE_MESH_GENERIC_PROPERTY_CLI) +#define BLE_MESH_TIME_SCENE_CLIENT_ENABLE (CONFIG_BLE_MESH_TIME_CLI | \ + CONFIG_BLE_MESH_SCENE_CLI | \ + CONFIG_BLE_MESH_SCHEDULER_CLI) + +#define BLE_MESH_LIGHTING_CLIENT_ENABLE (CONFIG_BLE_MESH_LIGHT_LIGHTNESS_CLI | \ + CONFIG_BLE_MESH_LIGHT_CTL_CLI | \ + CONFIG_BLE_MESH_LIGHT_HSL_CLI | \ + CONFIG_BLE_MESH_LIGHT_XYL_CLI | \ + CONFIG_BLE_MESH_LIGHT_LC_CLI) #ifdef __cplusplus } diff --git a/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c b/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c index 15dcf773b0..2c14767808 100644 --- a/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c +++ b/components/bt/esp_ble_mesh/mesh_core/cfg_cli.c @@ -16,10 +16,13 @@ #include "btc_ble_mesh_config_model.h" #include "mesh.h" +#include "mesh_config.h" #include "foundation.h" #include "mesh_common.h" #include "cfg_cli.h" +#if CONFIG_BLE_MESH_CFG_CLI + static const bt_mesh_client_op_pair_t cfg_op_pair[] = { { OP_BEACON_GET, OP_BEACON_STATUS }, { OP_BEACON_SET, OP_BEACON_STATUS }, @@ -1330,3 +1333,5 @@ const struct bt_mesh_model_cb bt_mesh_cfg_cli_cb = { .deinit = cfg_cli_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* CONFIG_BLE_MESH_CFG_CLI */ diff --git a/components/bt/esp_ble_mesh/mesh_core/health_cli.c b/components/bt/esp_ble_mesh/mesh_core/health_cli.c index eb27e4617b..c94dc95fc3 100644 --- a/components/bt/esp_ble_mesh/mesh_core/health_cli.c +++ b/components/bt/esp_ble_mesh/mesh_core/health_cli.c @@ -14,10 +14,13 @@ #include "btc_ble_mesh_health_model.h" +#include "mesh_config.h" #include "foundation.h" #include "mesh_common.h" #include "health_cli.h" +#if CONFIG_BLE_MESH_HEALTH_CLI + static const bt_mesh_client_op_pair_t health_op_pair[] = { { OP_HEALTH_FAULT_GET, OP_HEALTH_FAULT_STATUS }, { OP_HEALTH_FAULT_CLEAR, OP_HEALTH_FAULT_STATUS }, @@ -384,3 +387,5 @@ const struct bt_mesh_model_cb bt_mesh_health_cli_cb = { .deinit = health_cli_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* CONFIG_BLE_MESH_HEALTH_CLI */ diff --git a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c index 18d3e56933..deac6e3cd6 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c @@ -17,9 +17,12 @@ #include "btc_ble_mesh_generic_model.h" +#include "mesh_config.h" #include "model_opcode.h" #include "generic_client.h" +#if BLE_MESH_GENERIC_CLIENT_ENABLE + /* The followings are the macro definitions of Generic client * model message length, and a message is composed of 3 parts: * Opcode + Payload + MIC @@ -1211,3 +1214,5 @@ const struct bt_mesh_model_cb bt_mesh_generic_client_cb = { .deinit = generic_client_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ diff --git a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c index 3371f1ab06..99be8ae3db 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c @@ -17,9 +17,12 @@ #include "btc_ble_mesh_lighting_model.h" +#include "mesh_config.h" #include "model_opcode.h" #include "lighting_client.h" +#if BLE_MESH_LIGHTING_CLIENT_ENABLE + /* The followings are the macro definitions of Lighting client * model message length, and a message is composed of 3 parts: * Opcode + Payload + MIC @@ -1401,3 +1404,5 @@ const struct bt_mesh_model_cb bt_mesh_lighting_client_cb = { .deinit = lighting_client_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ diff --git a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c index b94c5ae883..857f7d30eb 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c @@ -17,9 +17,12 @@ #include "btc_ble_mesh_sensor_model.h" +#include "mesh_config.h" #include "model_opcode.h" #include "sensor_client.h" +#if CONFIG_BLE_MESH_SENSOR_CLI + /* The followings are the macro definitions of Sensor client * model message length, and a message is composed of 3 parts: * Opcode + Payload + MIC @@ -651,3 +654,5 @@ const struct bt_mesh_model_cb bt_mesh_sensor_client_cb = { .deinit = sensor_client_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* CONFIG_BLE_MESH_SENSOR_CLI */ diff --git a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c index b889bc4f36..1eb5628f25 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c @@ -17,9 +17,12 @@ #include "btc_ble_mesh_time_scene_model.h" +#include "mesh_config.h" #include "model_opcode.h" #include "time_scene_client.h" +#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE + /* The followings are the macro definitions of Time Scene client * model message length, and a message is composed of 3 parts: * Opcode + Payload + MIC @@ -707,3 +710,5 @@ const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb = { .deinit = time_scene_client_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ From 9176fe996ced78783ba19a36cf2b298d0099340f Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 16:10:28 +0800 Subject: [PATCH 06/11] ble_mesh: stack: Add Kconfig options to make server models optional --- components/bt/common/btc/core/btc_task.c | 20 ++-- components/bt/esp_ble_mesh/Kconfig.in | 102 +++++++++++------- .../api/core/esp_ble_mesh_networking_api.c | 2 + .../models/esp_ble_mesh_generic_model_api.c | 6 +- .../models/esp_ble_mesh_lighting_model_api.c | 6 +- .../models/esp_ble_mesh_sensor_model_api.c | 2 + .../esp_ble_mesh_time_scene_model_api.c | 7 +- .../btc/btc_ble_mesh_config_model.c | 1 + .../btc/btc_ble_mesh_generic_model.c | 9 +- .../btc/btc_ble_mesh_health_model.c | 1 + .../btc/btc_ble_mesh_lighting_model.c | 11 +- .../bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c | 48 ++++++--- .../btc/btc_ble_mesh_sensor_model.c | 5 + .../btc/btc_ble_mesh_time_scene_model.c | 8 +- .../mesh_common/include/mesh_config.h | 11 +- .../mesh_models/client/generic_client.c | 4 +- .../mesh_models/client/lighting_client.c | 4 +- .../mesh_models/client/time_scene_client.c | 4 +- .../mesh_models/server/generic_server.c | 5 + .../mesh_models/server/lighting_server.c | 5 + .../mesh_models/server/sensor_server.c | 5 + .../mesh_models/server/server_common.c | 7 +- .../mesh_models/server/state_binding.c | 8 ++ .../mesh_models/server/state_transition.c | 48 ++++++--- .../mesh_models/server/time_scene_server.c | 5 + 25 files changed, 238 insertions(+), 96 deletions(-) diff --git a/components/bt/common/btc/core/btc_task.c b/components/bt/common/btc/core/btc_task.c index d830e83db1..ad89811f6d 100644 --- a/components/bt/common/btc/core/btc_task.c +++ b/components/bt/common/btc/core/btc_task.c @@ -132,22 +132,30 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = { [BTC_PID_CONFIG_CLIENT] = {btc_ble_mesh_config_client_call_handler, btc_ble_mesh_config_client_cb_handler }, #endif /* CONFIG_BLE_MESH_CFG_CLI */ [BTC_PID_CONFIG_SERVER] = {NULL, btc_ble_mesh_config_server_cb_handler }, -#if BLE_MESH_GENERIC_CLIENT_ENABLE +#if CONFIG_BLE_MESH_GENERIC_CLIENT [BTC_PID_GENERIC_CLIENT] = {btc_ble_mesh_generic_client_call_handler, btc_ble_mesh_generic_client_cb_handler }, -#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ -#if BLE_MESH_LIGHTING_CLIENT_ENABLE +#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */ +#if CONFIG_BLE_MESH_LIGHTING_CLIENT [BTC_PID_LIGHTING_CLIENT] = {btc_ble_mesh_lighting_client_call_handler, btc_ble_mesh_lighting_client_cb_handler }, -#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */ #if CONFIG_BLE_MESH_SENSOR_CLI [BTC_PID_SENSOR_CLIENT] = {btc_ble_mesh_sensor_client_call_handler, btc_ble_mesh_sensor_client_cb_handler }, #endif /* CONFIG_BLE_MESH_SENSOR_CLI */ -#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE +#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT [BTC_PID_TIME_SCENE_CLIENT] = {btc_ble_mesh_time_scene_client_call_handler, btc_ble_mesh_time_scene_client_cb_handler}, -#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */ +#if CONFIG_BLE_MESH_GENERIC_SERVER [BTC_PID_GENERIC_SERVER] = {NULL, btc_ble_mesh_generic_server_cb_handler }, +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ +#if CONFIG_BLE_MESH_LIGHTING_SERVER [BTC_PID_LIGHTING_SERVER] = {NULL, btc_ble_mesh_lighting_server_cb_handler }, +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ +#if CONFIG_BLE_MESH_SENSOR_SERVER [BTC_PID_SENSOR_SERVER] = {NULL, btc_ble_mesh_sensor_server_cb_handler }, +#endif /* CONFIG_BLE_MESH_SENSOR_SERVER */ +#if CONFIG_BLE_MESH_TIME_SCENE_SERVER [BTC_PID_TIME_SCENE_SERVER] = {NULL, btc_ble_mesh_time_scene_server_cb_handler}, +#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */ #endif /* #if CONFIG_BLE_MESH */ }; diff --git a/components/bt/esp_ble_mesh/Kconfig.in b/components/bt/esp_ble_mesh/Kconfig.in index 97c4c876b6..26bf5a1273 100644 --- a/components/bt/esp_ble_mesh/Kconfig.in +++ b/components/bt/esp_ble_mesh/Kconfig.in @@ -878,102 +878,126 @@ if BLE_MESH uses 0 as the timeout value when sending acknowledged messages, then the default value will be used which is four seconds. - menu "Support for BLE Mesh Client Models" + menu "Support for BLE Mesh client/server models" config BLE_MESH_CFG_CLI - bool "Configuration Client Model" + bool "Configuration Client model" help - Enable support for Configuration client model. + Enable support for Configuration Client model. config BLE_MESH_HEALTH_CLI - bool "Health Client Model" + bool "Health Client model" help - Enable support for Health client model. + Enable support for Health Client model. config BLE_MESH_GENERIC_ONOFF_CLI - bool "Generic OnOff Client Model" + bool "Generic OnOff Client model" help - Enable support for Generic OnOff client model. + Enable support for Generic OnOff Client model. config BLE_MESH_GENERIC_LEVEL_CLI - bool "Generic Level Client Model" + bool "Generic Level Client model" help - Enable support for Generic Level client model. + Enable support for Generic Level Client model. config BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI - bool "Generic Default Transition Time Client Model" + bool "Generic Default Transition Time Client model" help - Enable support for Generic Default Transition Time client model. + Enable support for Generic Default Transition Time Client model. config BLE_MESH_GENERIC_POWER_ONOFF_CLI - bool "Generic Power OnOff Client Model" + bool "Generic Power OnOff Client model" help - Enable support for Generic Power OnOff client model. + Enable support for Generic Power OnOff Client model. config BLE_MESH_GENERIC_POWER_LEVEL_CLI - bool "Generic Power Level Client Model" + bool "Generic Power Level Client model" help - Enable support for Generic Power Level client model. + Enable support for Generic Power Level Client model. config BLE_MESH_GENERIC_BATTERY_CLI - bool "Generic Battery Client Model" + bool "Generic Battery Client model" help - Enable support for Generic Battery client model. + Enable support for Generic Battery Client model. config BLE_MESH_GENERIC_LOCATION_CLI - bool "Generic Location Client Model" + bool "Generic Location Client model" help - Enable support for Generic Location client model. + Enable support for Generic Location Client model. config BLE_MESH_GENERIC_PROPERTY_CLI - bool "Generic Property Client Model" + bool "Generic Property Client model" help - Enable support for Generic Property client model. + Enable support for Generic Property Client model. config BLE_MESH_SENSOR_CLI - bool "Sensor Client Model" + bool "Sensor Client model" help - Enable support for Sensor client model. + Enable support for Sensor Client model. config BLE_MESH_TIME_CLI - bool "Time Client Model" + bool "Time Client model" help - Enable support for Time client model. + Enable support for Time Client model. config BLE_MESH_SCENE_CLI - bool "Scene Client Model" + bool "Scene Client model" help - Enable support for Scene client model. + Enable support for Scene Client model. config BLE_MESH_SCHEDULER_CLI - bool "Scheduler Client Model" + bool "Scheduler Client model" help - Enable support for Scheduler client model. + Enable support for Scheduler Client model. config BLE_MESH_LIGHT_LIGHTNESS_CLI - bool "Light Lightness Client Model" + bool "Light Lightness Client model" help - Enable support for Light Lightness client model. + Enable support for Light Lightness Client model. config BLE_MESH_LIGHT_CTL_CLI - bool "Light CTL Client Model" + bool "Light CTL Client model" help - Enable support for Light CTL client model. + Enable support for Light CTL Client model. config BLE_MESH_LIGHT_HSL_CLI - bool "Light HSL Client Model" + bool "Light HSL Client model" help - Enable support for Light HSL client model. + Enable support for Light HSL Client model. config BLE_MESH_LIGHT_XYL_CLI - bool "Light XYL Client Model" + bool "Light XYL Client model" help - Enable support for Light XYL client model. + Enable support for Light XYL Client model. config BLE_MESH_LIGHT_LC_CLI - bool "Light LC Client Model" + bool "Light LC Client model" help - Enable support for Light LC client model. + Enable support for Light LC Client model. + + config BLE_MESH_GENERIC_SERVER + bool "Generic server models" + default y + help + Enable support for Generic server models. + + config BLE_MESH_SENSOR_SERVER + bool "Sensor server models" + default y + help + Enable support for Sensor server models. + + config BLE_MESH_TIME_SCENE_SERVER + bool "Time and Scenes server models" + default y + help + Enable support for Time and Scenes server models. + + config BLE_MESH_LIGHTING_SERVER + bool "Lighting server models" + default y + help + Enable support for Lighting server models. endmenu diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c index 5e850a7436..011c77a620 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c @@ -222,6 +222,7 @@ esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcod 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) @@ -246,6 +247,7 @@ esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model, return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_model_args_t), btc_ble_mesh_model_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } +#endif /* CONFIG_BLE_MESH_SERVER_MODEL */ esp_err_t esp_ble_mesh_node_local_reset(void) { diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c index 5bbfbe6684..184b28afa2 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c @@ -19,7 +19,7 @@ #include "btc_ble_mesh_generic_model.h" #include "esp_ble_mesh_generic_model_api.h" -#if BLE_MESH_GENERIC_CLIENT_ENABLE +#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); @@ -90,11 +90,13 @@ esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_generic_client_args_t), btc_ble_mesh_generic_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } -#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ +#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/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c index 9aa21ba06d..93f7964c90 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c @@ -19,7 +19,7 @@ #include "btc_ble_mesh_lighting_model.h" #include "esp_ble_mesh_lighting_model_api.h" -#if BLE_MESH_LIGHTING_CLIENT_ENABLE +#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); @@ -77,11 +77,13 @@ esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_lighting_client_args_t), btc_ble_mesh_lighting_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } -#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ +#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/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c index 602ebdfc35..bb24ad903e 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c @@ -78,9 +78,11 @@ esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_ } #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/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c index 4dae28105b..b5d4c3edf6 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c @@ -19,7 +19,7 @@ #include "btc_ble_mesh_time_scene_model.h" #include "esp_ble_mesh_time_scene_model_api.h" -#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE +#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); @@ -77,12 +77,13 @@ esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_pa return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_time_scene_client_args_t), btc_ble_mesh_time_scene_client_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } -#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ +#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/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c index e4258912b8..775d378b1c 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c @@ -680,6 +680,7 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_config_client_free_req_data(msg); return; } + #endif /* CONFIG_BLE_MESH_CFG_CLI */ /* Configuration Server Model related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c index 3cc7e2cee7..8de11ca4b8 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c @@ -19,7 +19,7 @@ #include "generic_client.h" #include "esp_ble_mesh_generic_model_api.h" -#if BLE_MESH_GENERIC_CLIENT_ENABLE +#if CONFIG_BLE_MESH_GENERIC_CLIENT /* Generic Client Models related functions */ @@ -531,7 +531,10 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_generic_client_free_req_data(msg); return; } -#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ + +#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */ + +#if CONFIG_BLE_MESH_GENERIC_SERVER /* Generic Server Models related functions */ @@ -759,3 +762,5 @@ void btc_ble_mesh_generic_server_cb_handler(btc_msg_t *msg) btc_ble_mesh_generic_server_free_req_data(msg); return; } + +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c index 13ad1f06bf..36c0150352 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c @@ -458,6 +458,7 @@ void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_health_client_free_req_data(msg); return; } + #endif /* CONFIG_BLE_MESH_HEALTH_CLI */ /* Health Server Model related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c index 81abeb6ca0..f173031b56 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c @@ -19,7 +19,7 @@ #include "lighting_client.h" #include "esp_ble_mesh_lighting_model_api.h" -#if BLE_MESH_LIGHTING_CLIENT_ENABLE +#if CONFIG_BLE_MESH_LIGHTING_CLIENT /* Lighting Client Models related functions */ @@ -375,7 +375,10 @@ void btc_ble_mesh_lighting_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_lighting_client_free_req_data(msg); return; } -#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ + +#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */ + +#if CONFIG_BLE_MESH_LIGHTING_SERVER /* Lighting Server Models related functions */ @@ -573,4 +576,6 @@ void btc_ble_mesh_lighting_server_cb_handler(btc_msg_t *msg) btc_ble_mesh_lighting_server_free_req_data(msg); return; -} \ No newline at end of file +} + +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c index 6fb559d60d..41eb421ae3 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c @@ -489,6 +489,7 @@ static int btc_ble_mesh_model_publish_update(struct bt_mesh_model *mod) return (ret == BT_STATUS_SUCCESS) ? 0 : -1; } +#if CONFIG_BLE_MESH_SERVER_MODEL static void btc_ble_mesh_server_model_update_state_comp_cb(esp_ble_mesh_model_t *model, esp_ble_mesh_server_state_type_t type, int err) @@ -502,6 +503,7 @@ static void btc_ble_mesh_server_model_update_state_comp_cb(esp_ble_mesh_model_t btc_ble_mesh_model_callback(&mesh_param, ESP_BLE_MESH_SERVER_MODEL_UPDATE_STATE_COMP_EVT); return; } +#endif /* CONFIG_BLE_MESH_SERVER_MODEL */ static bt_status_t btc_ble_mesh_prov_callback(esp_ble_mesh_prov_cb_param_t *param, uint8_t act) { @@ -1027,7 +1029,7 @@ extern const struct bt_mesh_model_cb bt_mesh_health_cli_cb; #endif /* CONFIG_BLE_MESH_HEALTH_CLI */ /* Generic Client Models */ -#if BLE_MESH_GENERIC_CLIENT_ENABLE +#if CONFIG_BLE_MESH_GENERIC_CLIENT extern const struct bt_mesh_model_op bt_mesh_gen_onoff_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_level_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_def_trans_time_cli_op[]; @@ -1037,17 +1039,17 @@ extern const struct bt_mesh_model_op bt_mesh_gen_battery_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_location_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_property_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_generic_client_cb; -#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */ /* Lighting Client Models */ -#if BLE_MESH_LIGHTING_CLIENT_ENABLE +#if CONFIG_BLE_MESH_LIGHTING_CLIENT extern const struct bt_mesh_model_op bt_mesh_light_lightness_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_ctl_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_hsl_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_xyl_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_light_lc_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_lighting_client_cb; -#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */ /* Sensor Client Models */ #if CONFIG_BLE_MESH_SENSOR_CLI @@ -1056,14 +1058,15 @@ extern const struct bt_mesh_model_cb bt_mesh_sensor_client_cb; #endif /* CONFIG_BLE_MESH_SENSOR_CLI */ /* Time and Scenes Client Models */ -#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE +#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT extern const struct bt_mesh_model_op bt_mesh_time_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_scene_cli_op[]; extern const struct bt_mesh_model_op bt_mesh_scheduler_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb; -#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */ /* Generic Server Models */ +#if CONFIG_BLE_MESH_GENERIC_SERVER extern const struct bt_mesh_model_op bt_mesh_gen_onoff_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_level_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_gen_def_trans_time_srv_op[]; @@ -1092,8 +1095,10 @@ extern const struct bt_mesh_model_cb bt_mesh_gen_user_prop_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_gen_admin_prop_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_gen_manu_prop_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_gen_client_prop_srv_cb; +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ /* Lighting Server Models */ +#if CONFIG_BLE_MESH_LIGHTING_SERVER extern const struct bt_mesh_model_op bt_mesh_light_lightness_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_light_lightness_setup_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_light_ctl_srv_op[]; @@ -1105,8 +1110,6 @@ extern const struct bt_mesh_model_op bt_mesh_light_hsl_sat_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_light_hsl_setup_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_light_xyl_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_light_xyl_setup_srv_op[]; -extern const struct bt_mesh_model_op bt_mesh_light_lc_srv_op[]; -extern const struct bt_mesh_model_op bt_mesh_light_lc_setup_srv_op[]; extern const struct bt_mesh_model_cb bt_mesh_light_lightness_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_lightness_setup_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_ctl_srv_cb; @@ -1118,10 +1121,14 @@ extern const struct bt_mesh_model_cb bt_mesh_light_hsl_sat_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_hsl_setup_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_xyl_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_xyl_setup_srv_cb; +extern const struct bt_mesh_model_op bt_mesh_light_lc_srv_op[]; +extern const struct bt_mesh_model_op bt_mesh_light_lc_setup_srv_op[]; extern const struct bt_mesh_model_cb bt_mesh_light_lc_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_lc_setup_srv_cb; +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ /* Time and Scenes Server Models */ +#if CONFIG_BLE_MESH_TIME_SCENE_SERVER extern const struct bt_mesh_model_op bt_mesh_time_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_time_setup_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_scene_srv_op[]; @@ -1134,12 +1141,15 @@ extern const struct bt_mesh_model_cb bt_mesh_scene_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_scene_setup_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_scheduler_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_scheduler_setup_srv_cb; +#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */ /* Sensor Server Models */ +#if CONFIG_BLE_MESH_SENSOR_SERVER extern const struct bt_mesh_model_op bt_mesh_sensor_srv_op[]; extern const struct bt_mesh_model_op bt_mesh_sensor_setup_srv_op[]; extern const struct bt_mesh_model_cb bt_mesh_sensor_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_sensor_setup_srv_cb; +#endif /* CONFIG_BLE_MESH_SENSOR_SERVER */ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) { @@ -1199,7 +1209,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) break; } #endif /* CONFIG_BLE_MESH_HEALTH_CLI */ -#if BLE_MESH_GENERIC_CLIENT_ENABLE +#if CONFIG_BLE_MESH_GENERIC_CLIENT case BLE_MESH_MODEL_ID_GEN_ONOFF_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_gen_onoff_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_generic_client_cb; @@ -1272,8 +1282,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } -#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ -#if BLE_MESH_LIGHTING_CLIENT_ENABLE +#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */ +#if CONFIG_BLE_MESH_LIGHTING_CLIENT case BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_light_lightness_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_lighting_client_cb; @@ -1319,7 +1329,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } -#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */ #if CONFIG_BLE_MESH_SENSOR_CLI case BLE_MESH_MODEL_ID_SENSOR_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_sensor_cli_op; @@ -1331,7 +1341,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) break; } #endif /* CONFIG_BLE_MESH_SENSOR_CLI */ -#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE +#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT case BLE_MESH_MODEL_ID_TIME_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_time_cli_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_time_scene_client_cb; @@ -1359,7 +1369,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } -#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */ +#if CONFIG_BLE_MESH_GENERIC_SERVER case BLE_MESH_MODEL_ID_GEN_ONOFF_SRV: model->op = (esp_ble_mesh_model_op_t *)bt_mesh_gen_onoff_srv_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_gen_onoff_srv_cb; @@ -1458,6 +1469,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) model->pub->update = (esp_ble_mesh_cb_t)btc_ble_mesh_model_publish_update; } break; +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ +#if CONFIG_BLE_MESH_LIGHTING_SERVER case BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV: model->op = (esp_ble_mesh_model_op_t *)bt_mesh_light_lightness_srv_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_light_lightness_srv_cb; @@ -1549,6 +1562,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) model->pub->update = (esp_ble_mesh_cb_t)btc_ble_mesh_model_publish_update; } break; +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ +#if CONFIG_BLE_MESH_TIME_SCENE_SERVER case BLE_MESH_MODEL_ID_TIME_SRV: model->op = (esp_ble_mesh_model_op_t *)bt_mesh_time_srv_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_time_srv_cb; @@ -1593,6 +1608,8 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) model->pub->update = (esp_ble_mesh_cb_t)btc_ble_mesh_model_publish_update; } break; +#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */ +#if CONFIG_BLE_MESH_SENSOR_SERVER case BLE_MESH_MODEL_ID_SENSOR_SRV: model->op = (esp_ble_mesh_model_op_t *)bt_mesh_sensor_srv_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_sensor_srv_cb; @@ -1607,6 +1624,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) model->pub->update = (esp_ble_mesh_cb_t)btc_ble_mesh_model_publish_update; } break; +#endif /* CONFIG_BLE_MESH_SENSOR_SERVER */ default: goto set_vnd_op; } @@ -2179,6 +2197,7 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg) arg->model_send.opcode, err); break; } +#if CONFIG_BLE_MESH_SERVER_MODEL case BTC_BLE_MESH_ACT_SERVER_MODEL_UPDATE_STATE: err = bt_mesh_update_binding_state( (struct bt_mesh_model *)arg->model_update_state.model, arg->model_update_state.type, @@ -2186,6 +2205,7 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg) btc_ble_mesh_server_model_update_state_comp_cb(arg->model_update_state.model, arg->model_update_state.type, err); break; +#endif /* CONFIG_BLE_MESH_SERVER_MODEL */ default: BT_WARN("%s, Unknown act %d", __func__, msg->act); break; diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c index a217f09762..3a9de041b2 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c @@ -613,8 +613,11 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_sensor_client_free_req_data(msg); return; } + #endif /* CONFIG_BLE_MESH_SENSOR_CLI */ +#if CONFIG_BLE_MESH_SENSOR_SERVER + /* Sensor Server Models related functions */ static inline void btc_ble_mesh_sensor_server_cb_to_app(esp_ble_mesh_sensor_server_cb_event_t event, @@ -891,3 +894,5 @@ void btc_ble_mesh_sensor_server_cb_handler(btc_msg_t *msg) btc_ble_mesh_sensor_server_free_req_data(msg); return; } + +#endif /* CONFIG_BLE_MESH_SENSOR_SERVER */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c index 7663684f48..58ae40558c 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c @@ -19,7 +19,7 @@ #include "time_scene_client.h" #include "esp_ble_mesh_time_scene_model_api.h" -#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE +#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT /* Time and Scenes Client Models related functions */ @@ -377,7 +377,10 @@ void btc_ble_mesh_time_scene_client_cb_handler(btc_msg_t *msg) btc_ble_mesh_time_scene_client_free_req_data(msg); return; } -#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ + +#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */ + +#if CONFIG_BLE_MESH_TIME_SCENE_SERVER /* Time and Scenes Server Models related functions */ @@ -477,3 +480,4 @@ void btc_ble_mesh_time_scene_server_cb_handler(btc_msg_t *msg) return; } +#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */ diff --git a/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h b/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h index e370aa19aa..f019104383 100644 --- a/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h +++ b/components/bt/esp_ble_mesh/mesh_common/include/mesh_config.h @@ -21,7 +21,7 @@ extern "C" { #endif -#define BLE_MESH_GENERIC_CLIENT_ENABLE (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI | \ +#define CONFIG_BLE_MESH_GENERIC_CLIENT (CONFIG_BLE_MESH_GENERIC_ONOFF_CLI | \ CONFIG_BLE_MESH_GENERIC_LEVEL_CLI | \ CONFIG_BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI | \ CONFIG_BLE_MESH_GENERIC_POWER_ONOFF_CLI | \ @@ -30,16 +30,21 @@ extern "C" { CONFIG_BLE_MESH_GENERIC_LOCATION_CLI | \ CONFIG_BLE_MESH_GENERIC_PROPERTY_CLI) -#define BLE_MESH_TIME_SCENE_CLIENT_ENABLE (CONFIG_BLE_MESH_TIME_CLI | \ +#define CONFIG_BLE_MESH_TIME_SCENE_CLIENT (CONFIG_BLE_MESH_TIME_CLI | \ CONFIG_BLE_MESH_SCENE_CLI | \ CONFIG_BLE_MESH_SCHEDULER_CLI) -#define BLE_MESH_LIGHTING_CLIENT_ENABLE (CONFIG_BLE_MESH_LIGHT_LIGHTNESS_CLI | \ +#define CONFIG_BLE_MESH_LIGHTING_CLIENT (CONFIG_BLE_MESH_LIGHT_LIGHTNESS_CLI | \ CONFIG_BLE_MESH_LIGHT_CTL_CLI | \ CONFIG_BLE_MESH_LIGHT_HSL_CLI | \ CONFIG_BLE_MESH_LIGHT_XYL_CLI | \ CONFIG_BLE_MESH_LIGHT_LC_CLI) +#define CONFIG_BLE_MESH_SERVER_MODEL (CONFIG_BLE_MESH_GENERIC_SERVER | \ + CONFIG_BLE_MESH_SENSOR_SERVER | \ + CONFIG_BLE_MESH_TIME_SCENE_SERVER | \ + CONFIG_BLE_MESH_LIGHTING_SERVER) + #ifdef __cplusplus } #endif diff --git a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c index deac6e3cd6..d284ee0eee 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c @@ -21,7 +21,7 @@ #include "model_opcode.h" #include "generic_client.h" -#if BLE_MESH_GENERIC_CLIENT_ENABLE +#if CONFIG_BLE_MESH_GENERIC_CLIENT /* The followings are the macro definitions of Generic client * model message length, and a message is composed of 3 parts: @@ -1215,4 +1215,4 @@ const struct bt_mesh_model_cb bt_mesh_generic_client_cb = { #endif /* CONFIG_BLE_MESH_DEINIT */ }; -#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */ diff --git a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c index 99be8ae3db..c291da5cb1 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c @@ -21,7 +21,7 @@ #include "model_opcode.h" #include "lighting_client.h" -#if BLE_MESH_LIGHTING_CLIENT_ENABLE +#if CONFIG_BLE_MESH_LIGHTING_CLIENT /* The followings are the macro definitions of Lighting client * model message length, and a message is composed of 3 parts: @@ -1405,4 +1405,4 @@ const struct bt_mesh_model_cb bt_mesh_lighting_client_cb = { #endif /* CONFIG_BLE_MESH_DEINIT */ }; -#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */ diff --git a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c index 1eb5628f25..d328e4ac77 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c @@ -21,7 +21,7 @@ #include "model_opcode.h" #include "time_scene_client.h" -#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE +#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT /* The followings are the macro definitions of Time Scene client * model message length, and a message is composed of 3 parts: @@ -711,4 +711,4 @@ const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb = { #endif /* CONFIG_BLE_MESH_DEINIT */ }; -#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */ +#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */ diff --git a/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c b/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c index 486ca9ba98..69472dbba7 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/generic_server.c @@ -10,12 +10,15 @@ #include "btc_ble_mesh_generic_model.h" +#include "mesh_config.h" #include "access.h" #include "transport.h" #include "model_opcode.h" #include "state_transition.h" #include "device_property.h" +#if CONFIG_BLE_MESH_GENERIC_SERVER + static bt_mesh_mutex_t generic_server_lock; static inline void bt_mesh_generic_server_mutex_new(void) @@ -2896,3 +2899,5 @@ const struct bt_mesh_model_cb bt_mesh_gen_client_prop_srv_cb = { .deinit = gen_client_prop_srv_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ diff --git a/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c b/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c index fc6dfc8cfe..c994b969b2 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c @@ -10,12 +10,15 @@ #include "btc_ble_mesh_lighting_model.h" +#include "mesh_config.h" #include "access.h" #include "transport.h" #include "model_opcode.h" #include "state_transition.h" #include "device_property.h" +#if CONFIG_BLE_MESH_LIGHTING_SERVER + static bt_mesh_mutex_t light_server_lock; static inline void bt_mesh_light_server_mutex_new(void) @@ -3646,3 +3649,5 @@ const struct bt_mesh_model_cb bt_mesh_light_lc_setup_srv_cb = { .deinit = light_lc_setup_srv_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ diff --git a/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c b/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c index d01aa2e2aa..aa07242781 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c @@ -16,12 +16,15 @@ #include "btc_ble_mesh_sensor_model.h" +#include "mesh_config.h" #include "access.h" #include "transport.h" #include "model_opcode.h" #include "state_transition.h" #include "device_property.h" +#if CONFIG_BLE_MESH_SENSOR_SERVER + static void update_sensor_periodic_pub(struct bt_mesh_model *model, u16_t prop_id); /* message handlers (Start) */ @@ -1172,3 +1175,5 @@ const struct bt_mesh_model_cb bt_mesh_sensor_setup_srv_cb = { .deinit = sensor_setup_srv_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* CONFIG_BLE_MESH_SENSOR_SERVER */ diff --git a/components/bt/esp_ble_mesh/mesh_models/server/server_common.c b/components/bt/esp_ble_mesh/mesh_models/server/server_common.c index 236e9e53b3..f33b0f7513 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/server_common.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/server_common.c @@ -15,11 +15,14 @@ #include #include "mesh.h" +#include "mesh_config.h" #include "access.h" #include "mesh_common.h" #include "generic_server.h" #include "lighting_server.h" +#if CONFIG_BLE_MESH_SERVER_MODEL + /** * According to Mesh Model Spec: * If the Transition Time field is not present and the Generic Default Transition @@ -257,4 +260,6 @@ struct net_buf_simple *bt_mesh_server_get_pub_msg(struct bt_mesh_model *model, u } return buf; -} \ No newline at end of file +} + +#endif /* CONFIG_BLE_MESH_SERVER_MODEL */ diff --git a/components/bt/esp_ble_mesh/mesh_models/server/state_binding.c b/components/bt/esp_ble_mesh/mesh_models/server/state_binding.c index f54fcf3e79..0e00d892ec 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/state_binding.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/state_binding.c @@ -8,11 +8,14 @@ #include +#include "mesh_config.h" #include "mesh_common.h" #include "model_opcode.h" #include "state_binding.h" #include "state_transition.h" +#if CONFIG_BLE_MESH_SERVER_MODEL + #define MINDIFF (2.25e-308) static float bt_mesh_sqrt(float square) @@ -102,6 +105,7 @@ int bt_mesh_update_binding_state(struct bt_mesh_model *model, } switch (type) { +#if CONFIG_BLE_MESH_GENERIC_SERVER case GENERIC_ONOFF_STATE: { if (model->id != BLE_MESH_MODEL_ID_GEN_ONOFF_SRV) { BT_ERR("Invalid Generic OnOff Server, model id 0x%04x", model->id); @@ -168,6 +172,8 @@ int bt_mesh_update_binding_state(struct bt_mesh_model *model, gen_power_level_publish(model, BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS); break; } +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ +#if CONFIG_BLE_MESH_LIGHTING_SERVER case LIGHT_LIGHTNESS_ACTUAL_STATE: { if (model->id != BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV) { BT_ERR("Invalid Light Lightness Server, model id 0x%04x", model->id); @@ -331,6 +337,7 @@ int bt_mesh_update_binding_state(struct bt_mesh_model *model, light_lc_publish(model, BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS); break; } +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ default: BT_WARN("Unknown binding state type 0x%02x", type); return -EINVAL; @@ -339,3 +346,4 @@ int bt_mesh_update_binding_state(struct bt_mesh_model *model, return 0; } +#endif /* CONFIG_BLE_MESH_SERVER_MODEL */ diff --git a/components/bt/esp_ble_mesh/mesh_models/server/state_transition.c b/components/bt/esp_ble_mesh/mesh_models/server/state_transition.c index 56871faa8f..775ccf831a 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/state_transition.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/state_transition.c @@ -11,9 +11,14 @@ #include "btc_ble_mesh_time_scene_model.h" #include "btc_ble_mesh_sensor_model.h" +#include "mesh_config.h" #include "model_opcode.h" #include "state_transition.h" +#if (CONFIG_BLE_MESH_GENERIC_SERVER | \ + CONFIG_BLE_MESH_TIME_SCENE_SERVER | \ + CONFIG_BLE_MESH_LIGHTING_SERVER) + /* Function to calculate Remaining Time (Start) */ void bt_mesh_server_calc_remain_time(struct bt_mesh_state_transition *transition) @@ -98,6 +103,20 @@ static void transition_time_values(struct bt_mesh_state_transition *transition, transition->quo_tt = transition->total_duration / transition->counter; } +static void transition_timer_start(struct bt_mesh_state_transition *transition) +{ + transition->start_timestamp = k_uptime_get(); + k_delayed_work_submit_periodic(&transition->timer, K_MSEC(transition->quo_tt)); + bt_mesh_atomic_set_bit(transition->flag, BLE_MESH_TRANS_TIMER_START); +} + +static void transition_timer_stop(struct bt_mesh_state_transition *transition) +{ + k_delayed_work_cancel(&transition->timer); + bt_mesh_atomic_clear_bit(transition->flag, BLE_MESH_TRANS_TIMER_START); +} + +#if CONFIG_BLE_MESH_GENERIC_SERVER void generic_onoff_tt_values(struct bt_mesh_gen_onoff_srv *srv, u8_t trans_time, u8_t delay) { @@ -119,7 +138,9 @@ void generic_power_level_tt_values(struct bt_mesh_gen_power_level_srv *srv, srv->tt_delta_level = ((float) (srv->state->power_actual - srv->state->target_power_actual) / srv->transition.counter); } +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ +#if CONFIG_BLE_MESH_LIGHTING_SERVER void light_lightness_actual_tt_values(struct bt_mesh_light_lightness_srv *srv, u8_t trans_time, u8_t delay) { @@ -203,26 +224,18 @@ void light_lc_tt_values(struct bt_mesh_light_lc_srv *srv, { transition_time_values(&srv->transition, trans_time, delay); } +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ +#if CONFIG_BLE_MESH_TIME_SCENE_SERVER void scene_tt_values(struct bt_mesh_scene_srv *srv, u8_t trans_time, u8_t delay) { transition_time_values(&srv->transition, trans_time, delay); } - -static void transition_timer_start(struct bt_mesh_state_transition *transition) -{ - transition->start_timestamp = k_uptime_get(); - k_delayed_work_submit_periodic(&transition->timer, K_MSEC(transition->quo_tt)); - bt_mesh_atomic_set_bit(transition->flag, BLE_MESH_TRANS_TIMER_START); -} - -static void transition_timer_stop(struct bt_mesh_state_transition *transition) -{ - k_delayed_work_cancel(&transition->timer); - bt_mesh_atomic_clear_bit(transition->flag, BLE_MESH_TRANS_TIMER_START); -} +#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */ /* Timers related handlers & threads (Start) */ + +#if CONFIG_BLE_MESH_GENERIC_SERVER void generic_onoff_work_handler(struct k_work *work) { struct bt_mesh_gen_onoff_srv *srv = @@ -424,7 +437,9 @@ void generic_power_level_work_handler(struct k_work *work) bt_mesh_generic_server_unlock(); return; } +#endif /* CONFIG_BLE_MESH_GENERIC_SERVER */ +#if CONFIG_BLE_MESH_LIGHTING_SERVER void light_lightness_actual_work_handler(struct k_work *work) { struct bt_mesh_light_lightness_srv *srv = @@ -943,7 +958,9 @@ void light_lc_work_handler(struct k_work *work) bt_mesh_light_server_unlock(); return; } +#endif /* CONFIG_BLE_MESH_LIGHTING_SERVER */ +#if CONFIG_BLE_MESH_TIME_SCENE_SERVER void scene_recall_work_handler(struct k_work *work) { struct bt_mesh_scene_srv *srv = @@ -996,6 +1013,7 @@ void scene_recall_work_handler(struct k_work *work) bt_mesh_time_scene_server_unlock(); return; } +#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */ /* Timers related handlers & threads (End) */ @@ -1018,3 +1036,7 @@ void bt_mesh_server_start_transition(struct bt_mesh_state_transition *transition } /* Messages handlers (End) */ + +#endif /* (CONFIG_BLE_MESH_GENERIC_SERVER | \ + CONFIG_BLE_MESH_TIME_SCENE_SERVER | \ + CONFIG_BLE_MESH_LIGHTING_SERVER) */ diff --git a/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c b/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c index 2a86c1fcbd..5b2d878e2a 100644 --- a/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c +++ b/components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c @@ -16,11 +16,14 @@ #include "btc_ble_mesh_time_scene_model.h" +#include "mesh_config.h" #include "access.h" #include "transport.h" #include "model_opcode.h" #include "state_transition.h" +#if CONFIG_BLE_MESH_TIME_SCENE_SERVER + static bt_mesh_mutex_t time_scene_server_lock; static inline void bt_mesh_time_scene_server_mutex_new(void) @@ -1545,3 +1548,5 @@ const struct bt_mesh_model_cb bt_mesh_scheduler_setup_srv_cb = { .deinit = scheduler_setup_srv_deinit, #endif /* CONFIG_BLE_MESH_DEINIT */ }; + +#endif /* CONFIG_BLE_MESH_TIME_SCENE_SERVER */ From d268e0fdb13fb4ffadf5afce5747c4eca17223af Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 16:19:20 +0800 Subject: [PATCH 07/11] ble_mesh: ci: Add disabling mesh model sdkconfig test files --- .../fast_prov_client/sdkconfig.ci.model | 19 +++++++++++++++++ .../fast_prov_server/sdkconfig.ci.model | 18 ++++++++++++++++ .../onoff_client/sdkconfig.ci.model | 21 +++++++++++++++++++ .../onoff_server/sdkconfig.ci.model | 18 ++++++++++++++++ .../ble_mesh_provisioner/sdkconfig.ci.model | 21 +++++++++++++++++++ .../sensor_client/sdkconfig.ci.model | 19 +++++++++++++++++ .../sensor_server/sdkconfig.ci.model | 17 +++++++++++++++ .../vendor_client/sdkconfig.ci.model | 18 ++++++++++++++++ .../vendor_server/sdkconfig.ci.model | 18 ++++++++++++++++ .../ble_mesh_wifi_coexist/sdkconfig.ci.model | 20 ++++++++++++++++++ 10 files changed, 189 insertions(+) create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model create mode 100644 examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model new file mode 100644 index 0000000000..0cacb756e6 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model @@ -0,0 +1,19 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y +CONFIG_BLE_MESH_GENERIC_SERVER=n +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model new file mode 100644 index 0000000000..a9effe3561 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model @@ -0,0 +1,18 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_FAST_PROV=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model new file mode 100644 index 0000000000..1326de2c09 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model @@ -0,0 +1,21 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +#| Proxy | PB-GATT | Proxy Server | Proxy Client | +#| Enable | Enable | Enable | Disable | +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y +CONFIG_BLE_MESH_GENERIC_SERVER=n +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model new file mode 100644 index 0000000000..5807a67113 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model @@ -0,0 +1,18 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_FRIEND=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model new file mode 100644 index 0000000000..f8292db6f4 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model @@ -0,0 +1,21 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +#| Proxy | PB-GATT | Proxy Client | +#| Enable | Enable | Disable | +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y +CONFIG_BLE_MESH_GENERIC_SERVER=n +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model new file mode 100644 index 0000000000..ccd2e1275d --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model @@ -0,0 +1,19 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_SENSOR_CLI=y +CONFIG_BLE_MESH_GENERIC_SERVER=n +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model new file mode 100644 index 0000000000..0ddcb0810d --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model @@ -0,0 +1,17 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_GENERIC_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model new file mode 100644 index 0000000000..48e224288a --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model @@ -0,0 +1,18 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_PROVISIONER=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_GENERIC_SERVER=n +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model new file mode 100644 index 0000000000..1e3ac61ca6 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model @@ -0,0 +1,18 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_NODE=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_GENERIC_SERVER=n +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model new file mode 100644 index 0000000000..c77c88a235 --- /dev/null +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model @@ -0,0 +1,20 @@ +CONFIG_BT_ENABLED=y +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n +CONFIG_BTDM_CTRL_MODE_BTDM=n +CONFIG_BTDM_MODEM_SLEEP=n +CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE=y +CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN=y +CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y +CONFIG_BT_BTU_TASK_STACK_SIZE=4512 + +CONFIG_BLE_MESH=y +CONFIG_BLE_MESH_FAST_PROV=y +CONFIG_BLE_MESH_PB_GATT=y +CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_SENSOR_SERVER=n +CONFIG_BLE_MESH_TIME_SCENE_SERVER=n +CONFIG_BLE_MESH_LIGHTING_SERVER=n + +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y From 72d96c4e81e62e5e1e637f156b18ef8bfaaa7944 Mon Sep 17 00:00:00 2001 From: lly Date: Fri, 16 Oct 2020 18:52:32 +0800 Subject: [PATCH 08/11] ble_mesh: example: Fix fast provisioning compile error --- .../fast_provisioning/ble_mesh_fast_prov_client_model.c | 4 ++++ .../fast_provisioning/ble_mesh_fast_prov_operation.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.c b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.c index b04f5becd1..677c2425a6 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.c +++ b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_client_model.c @@ -33,8 +33,10 @@ static struct k_delayed_work get_all_node_addr_timer; #endif +#if !defined(CONFIG_BLE_MESH_FAST_PROV) /* Unicast address of the Primary Provisioner */ static uint16_t prim_prov_addr; +#endif /* Note: these variables are used by ble_mesh_fast_prov_server demo */ @@ -370,6 +372,7 @@ esp_err_t example_fast_prov_client_recv_status(esp_ble_mesh_model_t *model, } case ESP_BLE_MESH_VND_MODEL_OP_FAST_PROV_NODE_ADDR_STATUS: { ESP_LOG_BUFFER_HEX("Node address", data, len); +#if CONFIG_BLE_MESH_GENERIC_ONOFF_CLI esp_ble_mesh_model_t *cli_model = NULL; example_node_info_t *node = NULL; esp_err_t err; @@ -396,6 +399,7 @@ esp_err_t example_fast_prov_client_recv_status(esp_ble_mesh_model_t *model, ESP_LOGE(TAG, "%s: Failed to send Generic OnOff Set Unack message", __func__); return ESP_FAIL; } +#endif /* CONFIG_BLE_MESH_GENERIC_ONOFF_CLI */ break; } default: diff --git a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.c b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.c index 5f1f0a89b5..726b561750 100644 --- a/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.c +++ b/examples/bluetooth/esp_ble_mesh/common_components/fast_provisioning/ble_mesh_fast_prov_operation.c @@ -387,6 +387,7 @@ esp_err_t example_send_generic_onoff_get(esp_ble_mesh_model_t *model, return esp_ble_mesh_generic_client_get_state(&common, &get); } +#if CONFIG_BLE_MESH_GENERIC_ONOFF_CLI esp_err_t example_send_generic_onoff_set(esp_ble_mesh_model_t *model, example_msg_common_info_t *info, uint8_t onoff, uint8_t tid, bool need_ack) @@ -418,6 +419,7 @@ esp_err_t example_send_generic_onoff_set(esp_ble_mesh_model_t *model, return esp_ble_mesh_generic_client_set_state(&common, &set); } +#endif /* CONFIG_BLE_MESH_GENERIC_ONOFF_CLI */ esp_err_t example_send_fast_prov_info_set(esp_ble_mesh_model_t *model, example_msg_common_info_t *info, From 9620a1a5681fff747360077043e5f710dd8cd77a Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 19 Oct 2020 20:45:34 +0800 Subject: [PATCH 09/11] ble_mesh: stack: Split model Kconfig menu into foundation and others --- components/bt/esp_ble_mesh/Kconfig.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/bt/esp_ble_mesh/Kconfig.in b/components/bt/esp_ble_mesh/Kconfig.in index 26bf5a1273..b62e72bfc2 100644 --- a/components/bt/esp_ble_mesh/Kconfig.in +++ b/components/bt/esp_ble_mesh/Kconfig.in @@ -878,7 +878,7 @@ if BLE_MESH uses 0 as the timeout value when sending acknowledged messages, then the default value will be used which is four seconds. - menu "Support for BLE Mesh client/server models" + menu "Support for BLE Mesh Foundation models" config BLE_MESH_CFG_CLI bool "Configuration Client model" @@ -890,6 +890,10 @@ if BLE_MESH help Enable support for Health Client model. + endmenu #Support for BLE Mesh Foundation models + + menu "Support for BLE Mesh Client/Server models" + config BLE_MESH_GENERIC_ONOFF_CLI bool "Generic OnOff Client model" help @@ -999,7 +1003,7 @@ if BLE_MESH help Enable support for Lighting server models. - endmenu + endmenu #Support for BLE Mesh Client/Server models config BLE_MESH_IV_UPDATE_TEST bool "Test the IV Update Procedure" From fc071c10a6974f4f19af9849143c7d6a7dced083 Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 19 Oct 2020 21:12:17 +0800 Subject: [PATCH 10/11] ble_mesh: stack: Add a Kconfig option to make Health Server model optional --- components/bt/common/btc/core/btc_task.c | 2 ++ components/bt/esp_ble_mesh/Kconfig.in | 6 ++++++ .../api/models/esp_ble_mesh_health_model_api.c | 2 ++ .../btc/btc_ble_mesh_config_model.c | 2 +- .../btc/btc_ble_mesh_generic_model.c | 2 +- .../btc/btc_ble_mesh_health_model.c | 7 +++++-- .../btc/btc_ble_mesh_lighting_model.c | 2 +- .../bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c | 18 ++++++++++++++++++ .../btc/btc_ble_mesh_sensor_model.c | 2 +- .../btc/btc_ble_mesh_time_scene_model.c | 2 +- .../bt/esp_ble_mesh/mesh_core/health_cli.c | 2 +- .../bt/esp_ble_mesh/mesh_core/health_srv.c | 8 ++++++++ .../mesh_models/client/generic_client.c | 2 +- .../mesh_models/client/lighting_client.c | 2 +- .../mesh_models/client/sensor_client.c | 2 +- .../mesh_models/client/time_scene_client.c | 2 +- 16 files changed, 51 insertions(+), 12 deletions(-) diff --git a/components/bt/common/btc/core/btc_task.c b/components/bt/common/btc/core/btc_task.c index ad89811f6d..add92c0838 100644 --- a/components/bt/common/btc/core/btc_task.c +++ b/components/bt/common/btc/core/btc_task.c @@ -127,7 +127,9 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = { #if CONFIG_BLE_MESH_HEALTH_CLI [BTC_PID_HEALTH_CLIENT] = {btc_ble_mesh_health_client_call_handler, btc_ble_mesh_health_client_cb_handler }, #endif /* CONFIG_BLE_MESH_HEALTH_CLI */ +#if CONFIG_BLE_MESH_HEALTH_SRV [BTC_PID_HEALTH_SERVER] = {btc_ble_mesh_health_server_call_handler, btc_ble_mesh_health_server_cb_handler }, +#endif /* CONFIG_BLE_MESH_HEALTH_SRV */ #if CONFIG_BLE_MESH_CFG_CLI [BTC_PID_CONFIG_CLIENT] = {btc_ble_mesh_config_client_call_handler, btc_ble_mesh_config_client_cb_handler }, #endif /* CONFIG_BLE_MESH_CFG_CLI */ diff --git a/components/bt/esp_ble_mesh/Kconfig.in b/components/bt/esp_ble_mesh/Kconfig.in index b62e72bfc2..c335a2995a 100644 --- a/components/bt/esp_ble_mesh/Kconfig.in +++ b/components/bt/esp_ble_mesh/Kconfig.in @@ -890,6 +890,12 @@ if BLE_MESH help Enable support for Health Client model. + config BLE_MESH_HEALTH_SRV + bool "Health Server model" + default y + help + Enable support for Health Server model. + endmenu #Support for BLE Mesh Foundation models menu "Support for BLE Mesh Client/Server models" diff --git a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c index 217bbc15af..95c7536b4d 100644 --- a/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c +++ b/components/bt/esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c @@ -79,6 +79,7 @@ esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_ } #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); @@ -105,3 +106,4 @@ esp_err_t esp_ble_mesh_health_server_fault_update(esp_ble_mesh_elem_t *element) return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_server_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } +#endif /* CONFIG_BLE_MESH_HEALTH_SRV */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c index 775d378b1c..637252f6f3 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c @@ -17,10 +17,10 @@ #include "btc_ble_mesh_config_model.h" #include "foundation.h" -#include "cfg_cli.h" #include "esp_ble_mesh_config_model_api.h" #if CONFIG_BLE_MESH_CFG_CLI +#include "cfg_cli.h" /* Configuration Client Model related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c index 8de11ca4b8..6f588ab078 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c @@ -16,10 +16,10 @@ #include #include "btc_ble_mesh_generic_model.h" -#include "generic_client.h" #include "esp_ble_mesh_generic_model_api.h" #if CONFIG_BLE_MESH_GENERIC_CLIENT +#include "generic_client.h" /* Generic Client Models related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c index 36c0150352..39a5b295a0 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c @@ -17,11 +17,10 @@ #include "btc_ble_mesh_health_model.h" #include "foundation.h" -#include "health_srv.h" -#include "health_cli.h" #include "esp_ble_mesh_health_model_api.h" #if CONFIG_BLE_MESH_HEALTH_CLI +#include "health_cli.h" /* Health Client Model related functions */ @@ -461,6 +460,9 @@ void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg) #endif /* CONFIG_BLE_MESH_HEALTH_CLI */ +#if CONFIG_BLE_MESH_HEALTH_SRV +#include "health_srv.h" + /* Health Server Model related functions */ static inline void btc_ble_mesh_health_server_cb_to_app(esp_ble_mesh_health_server_cb_event_t event, @@ -640,3 +642,4 @@ void btc_ble_mesh_health_server_attention_off(struct bt_mesh_model *model) btc_ble_mesh_health_server_callback(¶m, ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_OFF_EVT); } +#endif /* CONFIG_BLE_MESH_HEALTH_SRV */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c index f173031b56..b6dce6cec5 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c @@ -16,10 +16,10 @@ #include #include "btc_ble_mesh_lighting_model.h" -#include "lighting_client.h" #include "esp_ble_mesh_lighting_model_api.h" #if CONFIG_BLE_MESH_LIGHTING_CLIENT +#include "lighting_client.h" /* Lighting Client Models related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c index 41eb421ae3..1365aeced0 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c @@ -34,14 +34,28 @@ #include "provisioner_prov.h" #include "provisioner_main.h" +#if CONFIG_BLE_MESH_CFG_CLI #include "cfg_cli.h" +#endif /* CONFIG_BLE_MESH_CFG_CLI */ +#if CONFIG_BLE_MESH_HEALTH_CLI #include "health_cli.h" +#endif /* CONFIG_BLE_MESH_HEALTH_CLI */ #include "cfg_srv.h" +#if CONFIG_BLE_MESH_HEALTH_SRV #include "health_srv.h" +#endif /* CONFIG_BLE_MESH_HEALTH_SRV */ +#if CONFIG_BLE_MESH_GENERIC_CLIENT #include "generic_client.h" +#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */ +#if CONFIG_BLE_MESH_LIGHTING_CLIENT #include "lighting_client.h" +#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */ +#if CONFIG_BLE_MESH_SENSOR_CLI #include "sensor_client.h" +#endif /* CONFIG_BLE_MESH_SENSOR_CLI */ +#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT #include "time_scene_client.h" +#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */ #include "client_common.h" #include "state_binding.h" #include "local_operation.h" @@ -1021,8 +1035,10 @@ extern const struct bt_mesh_model_cb bt_mesh_cfg_cli_cb; #endif /* CONFIG_BLE_MESH_CFG_CLI */ /* Health Models */ +#if CONFIG_BLE_MESH_HEALTH_SRV extern const struct bt_mesh_model_op bt_mesh_health_srv_op[]; extern const struct bt_mesh_model_cb bt_mesh_health_srv_cb; +#endif /* CONFIG_BLE_MESH_HEALTH_SRV */ #if CONFIG_BLE_MESH_HEALTH_CLI extern const struct bt_mesh_model_op bt_mesh_health_cli_op[]; extern const struct bt_mesh_model_cb bt_mesh_health_cli_cb; @@ -1186,6 +1202,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) break; } #endif /* CONFIG_BLE_MESH_CFG_CLI */ +#if CONFIG_BLE_MESH_HEALTH_SRV case BLE_MESH_MODEL_ID_HEALTH_SRV: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_health_srv_op; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_health_srv_cb; @@ -1198,6 +1215,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model) } break; } +#endif /* CONFIG_BLE_MESH_HEALTH_SRV */ #if CONFIG_BLE_MESH_HEALTH_CLI case BLE_MESH_MODEL_ID_HEALTH_CLI: { model->op = (esp_ble_mesh_model_op_t *)bt_mesh_health_cli_op; diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c index 3a9de041b2..65ddec0d02 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c @@ -16,10 +16,10 @@ #include #include "btc_ble_mesh_sensor_model.h" -#include "sensor_client.h" #include "esp_ble_mesh_sensor_model_api.h" #if CONFIG_BLE_MESH_SENSOR_CLI +#include "sensor_client.h" /* Sensor Client Models related functions */ diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c index 58ae40558c..937f8fd0bb 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c @@ -16,10 +16,10 @@ #include #include "btc_ble_mesh_time_scene_model.h" -#include "time_scene_client.h" #include "esp_ble_mesh_time_scene_model_api.h" #if CONFIG_BLE_MESH_TIME_SCENE_CLIENT +#include "time_scene_client.h" /* Time and Scenes Client Models related functions */ diff --git a/components/bt/esp_ble_mesh/mesh_core/health_cli.c b/components/bt/esp_ble_mesh/mesh_core/health_cli.c index c94dc95fc3..e0d644da7b 100644 --- a/components/bt/esp_ble_mesh/mesh_core/health_cli.c +++ b/components/bt/esp_ble_mesh/mesh_core/health_cli.c @@ -17,9 +17,9 @@ #include "mesh_config.h" #include "foundation.h" #include "mesh_common.h" -#include "health_cli.h" #if CONFIG_BLE_MESH_HEALTH_CLI +#include "health_cli.h" static const bt_mesh_client_op_pair_t health_op_pair[] = { { OP_HEALTH_FAULT_GET, OP_HEALTH_FAULT_STATUS }, diff --git a/components/bt/esp_ble_mesh/mesh_core/health_srv.c b/components/bt/esp_ble_mesh/mesh_core/health_srv.c index 4d6088fb44..4d13b6a0b1 100644 --- a/components/bt/esp_ble_mesh/mesh_core/health_srv.c +++ b/components/bt/esp_ble_mesh/mesh_core/health_srv.c @@ -17,6 +17,8 @@ #include "access.h" #include "foundation.h" #include "mesh_common.h" + +#if CONFIG_BLE_MESH_HEALTH_SRV #include "health_srv.h" #define HEALTH_TEST_STANDARD 0x00 @@ -547,3 +549,9 @@ void bt_mesh_attention(struct bt_mesh_model *model, u8_t time) } } } +#else /* CONFIG_BLE_MESH_HEALTH_SRV */ +void bt_mesh_attention(struct bt_mesh_model *model, u8_t time) +{ + return; +} +#endif /* CONFIG_BLE_MESH_HEALTH_SRV */ diff --git a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c index d284ee0eee..64abe802f6 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/generic_client.c @@ -19,9 +19,9 @@ #include "mesh_config.h" #include "model_opcode.h" -#include "generic_client.h" #if CONFIG_BLE_MESH_GENERIC_CLIENT +#include "generic_client.h" /* The followings are the macro definitions of Generic client * model message length, and a message is composed of 3 parts: diff --git a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c index c291da5cb1..147ba73f58 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c @@ -19,9 +19,9 @@ #include "mesh_config.h" #include "model_opcode.h" -#include "lighting_client.h" #if CONFIG_BLE_MESH_LIGHTING_CLIENT +#include "lighting_client.h" /* The followings are the macro definitions of Lighting client * model message length, and a message is composed of 3 parts: diff --git a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c index 857f7d30eb..f97c5f606d 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c @@ -19,9 +19,9 @@ #include "mesh_config.h" #include "model_opcode.h" -#include "sensor_client.h" #if CONFIG_BLE_MESH_SENSOR_CLI +#include "sensor_client.h" /* The followings are the macro definitions of Sensor client * model message length, and a message is composed of 3 parts: diff --git a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c index d328e4ac77..c1a13665c2 100644 --- a/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c +++ b/components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c @@ -19,9 +19,9 @@ #include "mesh_config.h" #include "model_opcode.h" -#include "time_scene_client.h" #if CONFIG_BLE_MESH_TIME_SCENE_CLIENT +#include "time_scene_client.h" /* The followings are the macro definitions of Time Scene client * model message length, and a message is composed of 3 parts: From 73d22d8ed95d769d4ad66617e0679e266b9f4505 Mon Sep 17 00:00:00 2001 From: lly Date: Tue, 20 Oct 2020 12:00:15 +0800 Subject: [PATCH 11/11] ble_mesh: example: Update sdkconfig test files for disabling Health Server model --- .../ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model | 1 + .../ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model | 1 + .../esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model | 1 + .../esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model | 1 + .../esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model | 1 + .../ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model | 1 + .../ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model | 1 + .../ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model | 1 + .../ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model | 1 + .../esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model | 1 + 10 files changed, 10 insertions(+) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model index 0cacb756e6..786d1a1e49 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_client/sdkconfig.ci.model @@ -12,6 +12,7 @@ CONFIG_BLE_MESH_PROVISIONER=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y CONFIG_BLE_MESH_GENERIC_SERVER=n CONFIG_BLE_MESH_SENSOR_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model index a9effe3561..6da1736380 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/fast_prov_server/sdkconfig.ci.model @@ -13,6 +13,7 @@ CONFIG_BLE_MESH_FAST_PROV=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_SENSOR_SERVER=n CONFIG_BLE_MESH_TIME_SCENE_SERVER=n CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model index 1326de2c09..6c567c9f5b 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_client/sdkconfig.ci.model @@ -14,6 +14,7 @@ CONFIG_BLE_MESH=y CONFIG_BLE_MESH_NODE=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y CONFIG_BLE_MESH_GENERIC_SERVER=n CONFIG_BLE_MESH_SENSOR_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model index 5807a67113..c6112b0baf 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/onoff_server/sdkconfig.ci.model @@ -13,6 +13,7 @@ CONFIG_BLE_MESH_NODE=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_FRIEND=y CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_SENSOR_SERVER=n CONFIG_BLE_MESH_TIME_SCENE_SERVER=n CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model index f8292db6f4..93fa54a1f7 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/sdkconfig.ci.model @@ -14,6 +14,7 @@ CONFIG_BLE_MESH_PROVISIONER=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_GENERIC_ONOFF_CLI=y CONFIG_BLE_MESH_GENERIC_SERVER=n CONFIG_BLE_MESH_SENSOR_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model index ccd2e1275d..3dfaf0931d 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_client/sdkconfig.ci.model @@ -12,6 +12,7 @@ CONFIG_BLE_MESH_PROVISIONER=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_SENSOR_CLI=y CONFIG_BLE_MESH_GENERIC_SERVER=n CONFIG_BLE_MESH_SENSOR_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model index 0ddcb0810d..8465bd663b 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_sensor_model/sensor_server/sdkconfig.ci.model @@ -12,6 +12,7 @@ CONFIG_BLE_MESH=y CONFIG_BLE_MESH_NODE=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_GENERIC_SERVER=n CONFIG_BLE_MESH_TIME_SCENE_SERVER=n CONFIG_BLE_MESH_LIGHTING_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model index 48e224288a..b4d595feec 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_client/sdkconfig.ci.model @@ -12,6 +12,7 @@ CONFIG_BLE_MESH_PROVISIONER=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_GENERIC_SERVER=n CONFIG_BLE_MESH_SENSOR_SERVER=n CONFIG_BLE_MESH_TIME_SCENE_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model index 1e3ac61ca6..78bc92f941 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_model/vendor_server/sdkconfig.ci.model @@ -12,6 +12,7 @@ CONFIG_BLE_MESH=y CONFIG_BLE_MESH_NODE=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_SETTINGS=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_GENERIC_SERVER=n CONFIG_BLE_MESH_SENSOR_SERVER=n CONFIG_BLE_MESH_TIME_SCENE_SERVER=n diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model index c77c88a235..7f41999aa6 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/sdkconfig.ci.model @@ -12,6 +12,7 @@ CONFIG_BLE_MESH=y CONFIG_BLE_MESH_FAST_PROV=y CONFIG_BLE_MESH_PB_GATT=y CONFIG_BLE_MESH_CFG_CLI=y +CONFIG_BLE_MESH_HEALTH_SRV=n CONFIG_BLE_MESH_SENSOR_SERVER=n CONFIG_BLE_MESH_TIME_SCENE_SERVER=n CONFIG_BLE_MESH_LIGHTING_SERVER=n