mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ble_mesh: stack: Add a Kconfig option to make Health Server model optional
This commit is contained in:
parent
c94d7fe982
commit
230e8f5c92
@ -127,7 +127,9 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = {
|
|||||||
#if CONFIG_BLE_MESH_HEALTH_CLI
|
#if CONFIG_BLE_MESH_HEALTH_CLI
|
||||||
[BTC_PID_HEALTH_CLIENT] = {btc_ble_mesh_health_client_call_handler, btc_ble_mesh_health_client_cb_handler },
|
[BTC_PID_HEALTH_CLIENT] = {btc_ble_mesh_health_client_call_handler, btc_ble_mesh_health_client_cb_handler },
|
||||||
#endif /* CONFIG_BLE_MESH_HEALTH_CLI */
|
#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 },
|
[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
|
#if CONFIG_BLE_MESH_CFG_CLI
|
||||||
[BTC_PID_CONFIG_CLIENT] = {btc_ble_mesh_config_client_call_handler, btc_ble_mesh_config_client_cb_handler },
|
[BTC_PID_CONFIG_CLIENT] = {btc_ble_mesh_config_client_call_handler, btc_ble_mesh_config_client_cb_handler },
|
||||||
#endif /* CONFIG_BLE_MESH_CFG_CLI */
|
#endif /* CONFIG_BLE_MESH_CFG_CLI */
|
||||||
|
@ -873,6 +873,12 @@ if BLE_MESH
|
|||||||
help
|
help
|
||||||
Enable support for Health Client model.
|
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
|
endmenu #Support for BLE Mesh Foundation models
|
||||||
|
|
||||||
menu "Support for BLE Mesh Client/Server models"
|
menu "Support for BLE Mesh Client/Server models"
|
||||||
|
@ -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 */
|
#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_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);
|
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)
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_health_server_args_t), NULL)
|
||||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BLE_MESH_HEALTH_SRV */
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
#include "btc_ble_mesh_config_model.h"
|
#include "btc_ble_mesh_config_model.h"
|
||||||
#include "foundation.h"
|
#include "foundation.h"
|
||||||
#include "cfg_cli.h"
|
|
||||||
#include "esp_ble_mesh_config_model_api.h"
|
#include "esp_ble_mesh_config_model_api.h"
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_CFG_CLI
|
#if CONFIG_BLE_MESH_CFG_CLI
|
||||||
|
#include "cfg_cli.h"
|
||||||
|
|
||||||
/* Configuration Client Model related functions */
|
/* Configuration Client Model related functions */
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "btc_ble_mesh_generic_model.h"
|
#include "btc_ble_mesh_generic_model.h"
|
||||||
#include "generic_client.h"
|
|
||||||
#include "esp_ble_mesh_generic_model_api.h"
|
#include "esp_ble_mesh_generic_model_api.h"
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_GENERIC_CLIENT
|
#if CONFIG_BLE_MESH_GENERIC_CLIENT
|
||||||
|
#include "generic_client.h"
|
||||||
|
|
||||||
/* Generic Client Models related functions */
|
/* Generic Client Models related functions */
|
||||||
|
|
||||||
|
@ -17,11 +17,10 @@
|
|||||||
|
|
||||||
#include "btc_ble_mesh_health_model.h"
|
#include "btc_ble_mesh_health_model.h"
|
||||||
#include "foundation.h"
|
#include "foundation.h"
|
||||||
#include "health_srv.h"
|
|
||||||
#include "health_cli.h"
|
|
||||||
#include "esp_ble_mesh_health_model_api.h"
|
#include "esp_ble_mesh_health_model_api.h"
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_HEALTH_CLI
|
#if CONFIG_BLE_MESH_HEALTH_CLI
|
||||||
|
#include "health_cli.h"
|
||||||
|
|
||||||
/* Health Client Model related functions */
|
/* 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 */
|
#endif /* CONFIG_BLE_MESH_HEALTH_CLI */
|
||||||
|
|
||||||
|
#if CONFIG_BLE_MESH_HEALTH_SRV
|
||||||
|
#include "health_srv.h"
|
||||||
|
|
||||||
/* Health Server Model related functions */
|
/* 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,
|
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);
|
btc_ble_mesh_health_server_callback(¶m, ESP_BLE_MESH_HEALTH_SERVER_ATTENTION_OFF_EVT);
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BLE_MESH_HEALTH_SRV */
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "btc_ble_mesh_lighting_model.h"
|
#include "btc_ble_mesh_lighting_model.h"
|
||||||
#include "lighting_client.h"
|
|
||||||
#include "esp_ble_mesh_lighting_model_api.h"
|
#include "esp_ble_mesh_lighting_model_api.h"
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_LIGHTING_CLIENT
|
#if CONFIG_BLE_MESH_LIGHTING_CLIENT
|
||||||
|
#include "lighting_client.h"
|
||||||
|
|
||||||
/* Lighting Client Models related functions */
|
/* Lighting Client Models related functions */
|
||||||
|
|
||||||
|
@ -34,14 +34,28 @@
|
|||||||
#include "provisioner_prov.h"
|
#include "provisioner_prov.h"
|
||||||
#include "provisioner_main.h"
|
#include "provisioner_main.h"
|
||||||
|
|
||||||
|
#if CONFIG_BLE_MESH_CFG_CLI
|
||||||
#include "cfg_cli.h"
|
#include "cfg_cli.h"
|
||||||
|
#endif /* CONFIG_BLE_MESH_CFG_CLI */
|
||||||
|
#if CONFIG_BLE_MESH_HEALTH_CLI
|
||||||
#include "health_cli.h"
|
#include "health_cli.h"
|
||||||
|
#endif /* CONFIG_BLE_MESH_HEALTH_CLI */
|
||||||
#include "cfg_srv.h"
|
#include "cfg_srv.h"
|
||||||
|
#if CONFIG_BLE_MESH_HEALTH_SRV
|
||||||
#include "health_srv.h"
|
#include "health_srv.h"
|
||||||
|
#endif /* CONFIG_BLE_MESH_HEALTH_SRV */
|
||||||
|
#if CONFIG_BLE_MESH_GENERIC_CLIENT
|
||||||
#include "generic_client.h"
|
#include "generic_client.h"
|
||||||
|
#endif /* CONFIG_BLE_MESH_GENERIC_CLIENT */
|
||||||
|
#if CONFIG_BLE_MESH_LIGHTING_CLIENT
|
||||||
#include "lighting_client.h"
|
#include "lighting_client.h"
|
||||||
|
#endif /* CONFIG_BLE_MESH_LIGHTING_CLIENT */
|
||||||
|
#if CONFIG_BLE_MESH_SENSOR_CLI
|
||||||
#include "sensor_client.h"
|
#include "sensor_client.h"
|
||||||
|
#endif /* CONFIG_BLE_MESH_SENSOR_CLI */
|
||||||
|
#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT
|
||||||
#include "time_scene_client.h"
|
#include "time_scene_client.h"
|
||||||
|
#endif /* CONFIG_BLE_MESH_TIME_SCENE_CLIENT */
|
||||||
#include "client_common.h"
|
#include "client_common.h"
|
||||||
#include "state_binding.h"
|
#include "state_binding.h"
|
||||||
#include "local_operation.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 */
|
#endif /* CONFIG_BLE_MESH_CFG_CLI */
|
||||||
|
|
||||||
/* Health Models */
|
/* 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_op bt_mesh_health_srv_op[];
|
||||||
extern const struct bt_mesh_model_cb bt_mesh_health_srv_cb;
|
extern const struct bt_mesh_model_cb bt_mesh_health_srv_cb;
|
||||||
|
#endif /* CONFIG_BLE_MESH_HEALTH_SRV */
|
||||||
#if CONFIG_BLE_MESH_HEALTH_CLI
|
#if CONFIG_BLE_MESH_HEALTH_CLI
|
||||||
extern const struct bt_mesh_model_op bt_mesh_health_cli_op[];
|
extern const struct bt_mesh_model_op bt_mesh_health_cli_op[];
|
||||||
extern const struct bt_mesh_model_cb bt_mesh_health_cli_cb;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BLE_MESH_CFG_CLI */
|
#endif /* CONFIG_BLE_MESH_CFG_CLI */
|
||||||
|
#if CONFIG_BLE_MESH_HEALTH_SRV
|
||||||
case BLE_MESH_MODEL_ID_HEALTH_SRV: {
|
case BLE_MESH_MODEL_ID_HEALTH_SRV: {
|
||||||
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_health_srv_op;
|
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;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BLE_MESH_HEALTH_SRV */
|
||||||
#if CONFIG_BLE_MESH_HEALTH_CLI
|
#if CONFIG_BLE_MESH_HEALTH_CLI
|
||||||
case BLE_MESH_MODEL_ID_HEALTH_CLI: {
|
case BLE_MESH_MODEL_ID_HEALTH_CLI: {
|
||||||
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_health_cli_op;
|
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_health_cli_op;
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "btc_ble_mesh_sensor_model.h"
|
#include "btc_ble_mesh_sensor_model.h"
|
||||||
#include "sensor_client.h"
|
|
||||||
#include "esp_ble_mesh_sensor_model_api.h"
|
#include "esp_ble_mesh_sensor_model_api.h"
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_SENSOR_CLI
|
#if CONFIG_BLE_MESH_SENSOR_CLI
|
||||||
|
#include "sensor_client.h"
|
||||||
|
|
||||||
/* Sensor Client Models related functions */
|
/* Sensor Client Models related functions */
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "btc_ble_mesh_time_scene_model.h"
|
#include "btc_ble_mesh_time_scene_model.h"
|
||||||
#include "time_scene_client.h"
|
|
||||||
#include "esp_ble_mesh_time_scene_model_api.h"
|
#include "esp_ble_mesh_time_scene_model_api.h"
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT
|
#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT
|
||||||
|
#include "time_scene_client.h"
|
||||||
|
|
||||||
/* Time and Scenes Client Models related functions */
|
/* Time and Scenes Client Models related functions */
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
#include "mesh_config.h"
|
#include "mesh_config.h"
|
||||||
#include "foundation.h"
|
#include "foundation.h"
|
||||||
#include "mesh_common.h"
|
#include "mesh_common.h"
|
||||||
#include "health_cli.h"
|
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_HEALTH_CLI
|
#if CONFIG_BLE_MESH_HEALTH_CLI
|
||||||
|
#include "health_cli.h"
|
||||||
|
|
||||||
static const bt_mesh_client_op_pair_t health_op_pair[] = {
|
static const bt_mesh_client_op_pair_t health_op_pair[] = {
|
||||||
{ OP_HEALTH_FAULT_GET, OP_HEALTH_FAULT_STATUS },
|
{ OP_HEALTH_FAULT_GET, OP_HEALTH_FAULT_STATUS },
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#include "access.h"
|
#include "access.h"
|
||||||
#include "foundation.h"
|
#include "foundation.h"
|
||||||
#include "mesh_common.h"
|
#include "mesh_common.h"
|
||||||
|
|
||||||
|
#if CONFIG_BLE_MESH_HEALTH_SRV
|
||||||
#include "health_srv.h"
|
#include "health_srv.h"
|
||||||
|
|
||||||
#define HEALTH_TEST_STANDARD 0x00
|
#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 */
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
#include "mesh_config.h"
|
#include "mesh_config.h"
|
||||||
#include "model_opcode.h"
|
#include "model_opcode.h"
|
||||||
#include "generic_client.h"
|
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_GENERIC_CLIENT
|
#if CONFIG_BLE_MESH_GENERIC_CLIENT
|
||||||
|
#include "generic_client.h"
|
||||||
|
|
||||||
/* The followings are the macro definitions of Generic client
|
/* The followings are the macro definitions of Generic client
|
||||||
* model message length, and a message is composed of 3 parts:
|
* model message length, and a message is composed of 3 parts:
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
#include "mesh_config.h"
|
#include "mesh_config.h"
|
||||||
#include "model_opcode.h"
|
#include "model_opcode.h"
|
||||||
#include "lighting_client.h"
|
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_LIGHTING_CLIENT
|
#if CONFIG_BLE_MESH_LIGHTING_CLIENT
|
||||||
|
#include "lighting_client.h"
|
||||||
|
|
||||||
/* The followings are the macro definitions of Lighting client
|
/* The followings are the macro definitions of Lighting client
|
||||||
* model message length, and a message is composed of 3 parts:
|
* model message length, and a message is composed of 3 parts:
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
#include "mesh_config.h"
|
#include "mesh_config.h"
|
||||||
#include "model_opcode.h"
|
#include "model_opcode.h"
|
||||||
#include "sensor_client.h"
|
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_SENSOR_CLI
|
#if CONFIG_BLE_MESH_SENSOR_CLI
|
||||||
|
#include "sensor_client.h"
|
||||||
|
|
||||||
/* The followings are the macro definitions of Sensor client
|
/* The followings are the macro definitions of Sensor client
|
||||||
* model message length, and a message is composed of 3 parts:
|
* model message length, and a message is composed of 3 parts:
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
#include "mesh_config.h"
|
#include "mesh_config.h"
|
||||||
#include "model_opcode.h"
|
#include "model_opcode.h"
|
||||||
#include "time_scene_client.h"
|
|
||||||
|
|
||||||
#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT
|
#if CONFIG_BLE_MESH_TIME_SCENE_CLIENT
|
||||||
|
#include "time_scene_client.h"
|
||||||
|
|
||||||
/* The followings are the macro definitions of Time Scene client
|
/* The followings are the macro definitions of Time Scene client
|
||||||
* model message length, and a message is composed of 3 parts:
|
* model message length, and a message is composed of 3 parts:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user