diff --git a/components/bt/common/btc/core/btc_task.c b/components/bt/common/btc/core/btc_task.c index 7f767227c2c..0f816fb7d26 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 b62e72bfc2d..c335a2995a7 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 217bbc15af0..95c7536b4d9 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 775d378b1c8..637252f6f37 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 8de11ca4b8d..6f588ab0787 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 36c01503524..39a5b295a0e 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 f173031b568..b6dce6cec55 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 41eb421ae32..1365aeced05 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 3a9de041b2f..65ddec0d02c 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 58ae40558cc..937f8fd0bb4 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 c94dc95fc3c..e0d644da7b6 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 4d6088fb44d..4d13b6a0b17 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 d284ee0eee6..64abe802f6e 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 c291da5cb14..147ba73f581 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 857f7d30eb6..f97c5f606d2 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 d328e4ac778..c1a13665c2f 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: