ble_mesh: stack: Use Kconfig option to make client models optional

This commit is contained in:
lly
2020-10-16 15:15:18 +08:00
parent 4c7a021acd
commit c90def0992
23 changed files with 140 additions and 18 deletions

View File

@ -105,14 +105,26 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
#if CONFIG_BLE_MESH #if CONFIG_BLE_MESH
[BTC_PID_PROV] = {btc_ble_mesh_prov_call_handler, btc_ble_mesh_prov_cb_handler }, [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 }, [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 }, [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 }, [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 }, [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 }, [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 }, [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 }, [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 }, [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}, [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_GENERIC_SERVER] = {NULL, btc_ble_mesh_generic_server_cb_handler },
[BTC_PID_LIGHTING_SERVER] = {NULL, btc_ble_mesh_lighting_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 }, [BTC_PID_SENSOR_SERVER] = {NULL, btc_ble_mesh_sensor_server_cb_handler },

View File

@ -17,6 +17,7 @@
#include <stdint.h> #include <stdint.h>
#include "mesh_config.h"
#include "mesh_common.h" #include "mesh_common.h"
#include "proxy_server.h" #include "proxy_server.h"
#include "provisioner_main.h" #include "provisioner_main.h"

View File

@ -19,6 +19,7 @@
#include "btc_ble_mesh_config_model.h" #include "btc_ble_mesh_config_model.h"
#include "esp_ble_mesh_config_model_api.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_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); 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); 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) static bool config_client_get_need_param(esp_ble_mesh_opcode_t opcode)
{ {
switch (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) 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); == 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);
}

View File

@ -19,6 +19,7 @@
#include "btc_ble_mesh_generic_model.h" #include "btc_ble_mesh_generic_model.h"
#include "esp_ble_mesh_generic_model_api.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_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); 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) 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); == 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) esp_err_t esp_ble_mesh_register_generic_server_callback(esp_ble_mesh_generic_server_cb_t callback)
{ {

View File

@ -19,6 +19,7 @@
#include "btc_ble_mesh_health_model.h" #include "btc_ble_mesh_health_model.h"
#include "esp_ble_mesh_health_model_api.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_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); 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); 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_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) 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) 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); == 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) esp_err_t esp_ble_mesh_health_server_fault_update(esp_ble_mesh_elem_t *element)
{ {

View File

@ -19,6 +19,7 @@
#include "btc_ble_mesh_lighting_model.h" #include "btc_ble_mesh_lighting_model.h"
#include "esp_ble_mesh_lighting_model_api.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_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); 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) 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); == 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) esp_err_t esp_ble_mesh_register_lighting_server_callback(esp_ble_mesh_lighting_server_cb_t callback)
{ {

View File

@ -19,6 +19,7 @@
#include "btc_ble_mesh_sensor_model.h" #include "btc_ble_mesh_sensor_model.h"
#include "esp_ble_mesh_sensor_model_api.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_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); 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) 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); == 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) 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); return (btc_profile_cb_set(BTC_PID_SENSOR_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
} }

View File

@ -19,6 +19,7 @@
#include "btc_ble_mesh_time_scene_model.h" #include "btc_ble_mesh_time_scene_model.h"
#include "esp_ble_mesh_time_scene_model_api.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_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); 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) 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); == 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) esp_err_t esp_ble_mesh_register_time_scene_server_callback(esp_ble_mesh_time_scene_server_cb_t callback)
{ {

View File

@ -20,6 +20,8 @@
#include "cfg_cli.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
/* Configuration Client Model related functions */ /* 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, 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); btc_ble_mesh_config_client_free_req_data(msg);
return; return;
} }
#endif /* CONFIG_BLE_MESH_CFG_CLI */
/* Configuration Server Model related functions */ /* Configuration Server Model related functions */

View File

@ -19,6 +19,8 @@
#include "generic_client.h" #include "generic_client.h"
#include "esp_ble_mesh_generic_model_api.h" #include "esp_ble_mesh_generic_model_api.h"
#if BLE_MESH_GENERIC_CLIENT_ENABLE
/* Generic Client Models related functions */ /* 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, 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); btc_ble_mesh_generic_client_free_req_data(msg);
return; return;
} }
#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */
/* Generic Server Models related functions */ /* Generic Server Models related functions */

View File

@ -21,6 +21,8 @@
#include "health_cli.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
/* Health Client Model related functions */ /* 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, 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); btc_ble_mesh_health_client_free_req_data(msg);
return; return;
} }
#endif /* CONFIG_BLE_MESH_HEALTH_CLI */
/* Health Server Model related functions */ /* Health Server Model related functions */

View File

@ -19,6 +19,8 @@
#include "lighting_client.h" #include "lighting_client.h"
#include "esp_ble_mesh_lighting_model_api.h" #include "esp_ble_mesh_lighting_model_api.h"
#if BLE_MESH_LIGHTING_CLIENT_ENABLE
/* Lighting Client Models related functions */ /* 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, 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); btc_ble_mesh_lighting_client_free_req_data(msg);
return; return;
} }
#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */
/* Lighting Server Models related functions */ /* Lighting Server Models related functions */

View File

@ -1012,15 +1012,22 @@ const esp_ble_mesh_comp_t *btc_ble_mesh_comp_get(void)
/* Configuration Models */ /* Configuration Models */
extern const struct bt_mesh_model_op bt_mesh_cfg_srv_op[]; 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; 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; extern const struct bt_mesh_model_cb bt_mesh_cfg_cli_cb;
#endif /* CONFIG_BLE_MESH_CFG_CLI */
/* Health Models */ /* Health Models */
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_op bt_mesh_health_cli_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;
#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; extern const struct bt_mesh_model_cb bt_mesh_health_cli_cb;
#endif /* CONFIG_BLE_MESH_HEALTH_CLI */
/* Generic Client Models */ /* 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_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_level_cli_op[];
extern const struct bt_mesh_model_op bt_mesh_gen_def_trans_time_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_location_cli_op[];
extern const struct bt_mesh_model_op bt_mesh_gen_property_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; extern const struct bt_mesh_model_cb bt_mesh_generic_client_cb;
#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */
/* Lighting Client Models */ /* 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_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_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_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_xyl_cli_op[];
extern const struct bt_mesh_model_op bt_mesh_light_lc_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; extern const struct bt_mesh_model_cb bt_mesh_lighting_client_cb;
#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */
/* Sensor Client Models */ /* 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_op bt_mesh_sensor_cli_op[];
extern const struct bt_mesh_model_cb bt_mesh_sensor_client_cb; extern const struct bt_mesh_model_cb bt_mesh_sensor_client_cb;
#endif /* CONFIG_BLE_MESH_SENSOR_CLI */
/* Time and Scenes Client Models */ /* 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_time_cli_op[];
extern const struct bt_mesh_model_op bt_mesh_scene_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_op bt_mesh_scheduler_cli_op[];
extern const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb; extern const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb;
#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */
/* Generic Server Models */ /* 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_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_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_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_manu_prop_srv_cb;
extern const struct bt_mesh_model_cb bt_mesh_gen_client_prop_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_gen_client_prop_srv_cb;
/* Lighting Server Models */ /* 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_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_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_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_srv_cb;
extern const struct bt_mesh_model_cb bt_mesh_light_lc_setup_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_light_lc_setup_srv_cb;
/* Time and Scenes Server Models */ /* 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_srv_op[];
extern const struct bt_mesh_model_op bt_mesh_time_setup_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_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_srv_cb;
extern const struct bt_mesh_model_cb bt_mesh_scheduler_setup_srv_cb; extern const struct bt_mesh_model_cb bt_mesh_scheduler_setup_srv_cb;
/* Sensor Server Models */ /* 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_srv_op[];
extern const struct bt_mesh_model_op bt_mesh_sensor_setup_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; break;
} }
#if CONFIG_BLE_MESH_CFG_CLI
case BLE_MESH_MODEL_ID_CFG_CLI: { case BLE_MESH_MODEL_ID_CFG_CLI: {
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_cfg_cli_op; 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; 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; break;
} }
#endif /* CONFIG_BLE_MESH_CFG_CLI */
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;
@ -1165,6 +1188,7 @@ static void btc_ble_mesh_model_op_set(esp_ble_mesh_model_t *model)
} }
break; break;
} }
#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;
model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_health_cli_cb; 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; break;
} }
#endif /* CONFIG_BLE_MESH_HEALTH_CLI */
#if BLE_MESH_GENERIC_CLIENT_ENABLE
case BLE_MESH_MODEL_ID_GEN_ONOFF_CLI: { case BLE_MESH_MODEL_ID_GEN_ONOFF_CLI: {
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_gen_onoff_cli_op; 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; 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; break;
} }
#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */
#if BLE_MESH_LIGHTING_CLIENT_ENABLE
case BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI: { case BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI: {
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_light_lightness_cli_op; 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; 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; break;
} }
#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */
#if CONFIG_BLE_MESH_SENSOR_CLI
case BLE_MESH_MODEL_ID_SENSOR_CLI: { case BLE_MESH_MODEL_ID_SENSOR_CLI: {
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_sensor_cli_op; 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; 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; break;
} }
#endif /* CONFIG_BLE_MESH_SENSOR_CLI */
#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE
case BLE_MESH_MODEL_ID_TIME_CLI: { case BLE_MESH_MODEL_ID_TIME_CLI: {
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_time_cli_op; 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; 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; break;
} }
#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */
case BLE_MESH_MODEL_ID_GEN_ONOFF_SRV: case BLE_MESH_MODEL_ID_GEN_ONOFF_SRV:
model->op = (esp_ble_mesh_model_op_t *)bt_mesh_gen_onoff_srv_op; 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; model->cb = (esp_ble_mesh_model_cbs_t *)&bt_mesh_gen_onoff_srv_cb;

View File

@ -19,6 +19,8 @@
#include "sensor_client.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
/* Sensor Client Models related functions */ /* 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, 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); btc_ble_mesh_sensor_client_free_req_data(msg);
return; return;
} }
#endif /* CONFIG_BLE_MESH_SENSOR_CLI */
/* Sensor Server Models related functions */ /* Sensor Server Models related functions */

View File

@ -19,6 +19,8 @@
#include "time_scene_client.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 BLE_MESH_TIME_SCENE_CLIENT_ENABLE
/* Time and Scenes Client Models related functions */ /* 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, 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); btc_ble_mesh_time_scene_client_free_req_data(msg);
return; return;
} }
#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */
/* Time and Scenes Server Models related functions */ /* Time and Scenes Server Models related functions */

View File

@ -17,6 +17,7 @@
#include "btc/btc_manage.h" #include "btc/btc_manage.h"
#include "mesh_byteorder.h" #include "mesh_byteorder.h"
#include "mesh_config.h"
#include "mesh_main.h" #include "mesh_main.h"
#include "fast_prov.h" #include "fast_prov.h"
#include "provisioner_prov.h" #include "provisioner_prov.h"

View File

@ -21,7 +21,24 @@
extern "C" { extern "C" {
#endif #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 #ifdef __cplusplus
} }

View File

@ -16,10 +16,13 @@
#include "btc_ble_mesh_config_model.h" #include "btc_ble_mesh_config_model.h"
#include "mesh.h" #include "mesh.h"
#include "mesh_config.h"
#include "foundation.h" #include "foundation.h"
#include "mesh_common.h" #include "mesh_common.h"
#include "cfg_cli.h" #include "cfg_cli.h"
#if CONFIG_BLE_MESH_CFG_CLI
static const bt_mesh_client_op_pair_t cfg_op_pair[] = { static const bt_mesh_client_op_pair_t cfg_op_pair[] = {
{ OP_BEACON_GET, OP_BEACON_STATUS }, { OP_BEACON_GET, OP_BEACON_STATUS },
{ OP_BEACON_SET, 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, .deinit = cfg_cli_deinit,
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
}; };
#endif /* CONFIG_BLE_MESH_CFG_CLI */

View File

@ -14,10 +14,13 @@
#include "btc_ble_mesh_health_model.h" #include "btc_ble_mesh_health_model.h"
#include "mesh_config.h"
#include "foundation.h" #include "foundation.h"
#include "mesh_common.h" #include "mesh_common.h"
#include "health_cli.h" #include "health_cli.h"
#if CONFIG_BLE_MESH_HEALTH_CLI
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 },
{ OP_HEALTH_FAULT_CLEAR, 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, .deinit = health_cli_deinit,
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
}; };
#endif /* CONFIG_BLE_MESH_HEALTH_CLI */

View File

@ -17,9 +17,12 @@
#include "btc_ble_mesh_generic_model.h" #include "btc_ble_mesh_generic_model.h"
#include "mesh_config.h"
#include "model_opcode.h" #include "model_opcode.h"
#include "generic_client.h" #include "generic_client.h"
#if BLE_MESH_GENERIC_CLIENT_ENABLE
/* 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:
* Opcode + Payload + MIC * Opcode + Payload + MIC
@ -1211,3 +1214,5 @@ const struct bt_mesh_model_cb bt_mesh_generic_client_cb = {
.deinit = generic_client_deinit, .deinit = generic_client_deinit,
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
}; };
#endif /* BLE_MESH_GENERIC_CLIENT_ENABLE */

View File

@ -17,9 +17,12 @@
#include "btc_ble_mesh_lighting_model.h" #include "btc_ble_mesh_lighting_model.h"
#include "mesh_config.h"
#include "model_opcode.h" #include "model_opcode.h"
#include "lighting_client.h" #include "lighting_client.h"
#if BLE_MESH_LIGHTING_CLIENT_ENABLE
/* 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:
* Opcode + Payload + MIC * Opcode + Payload + MIC
@ -1401,3 +1404,5 @@ const struct bt_mesh_model_cb bt_mesh_lighting_client_cb = {
.deinit = lighting_client_deinit, .deinit = lighting_client_deinit,
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
}; };
#endif /* BLE_MESH_LIGHTING_CLIENT_ENABLE */

View File

@ -17,9 +17,12 @@
#include "btc_ble_mesh_sensor_model.h" #include "btc_ble_mesh_sensor_model.h"
#include "mesh_config.h"
#include "model_opcode.h" #include "model_opcode.h"
#include "sensor_client.h" #include "sensor_client.h"
#if CONFIG_BLE_MESH_SENSOR_CLI
/* 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:
* Opcode + Payload + MIC * Opcode + Payload + MIC
@ -651,3 +654,5 @@ const struct bt_mesh_model_cb bt_mesh_sensor_client_cb = {
.deinit = sensor_client_deinit, .deinit = sensor_client_deinit,
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
}; };
#endif /* CONFIG_BLE_MESH_SENSOR_CLI */

View File

@ -17,9 +17,12 @@
#include "btc_ble_mesh_time_scene_model.h" #include "btc_ble_mesh_time_scene_model.h"
#include "mesh_config.h"
#include "model_opcode.h" #include "model_opcode.h"
#include "time_scene_client.h" #include "time_scene_client.h"
#if BLE_MESH_TIME_SCENE_CLIENT_ENABLE
/* 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:
* Opcode + Payload + MIC * Opcode + Payload + MIC
@ -707,3 +710,5 @@ const struct bt_mesh_model_cb bt_mesh_time_scene_client_cb = {
.deinit = time_scene_client_deinit, .deinit = time_scene_client_deinit,
#endif /* CONFIG_BLE_MESH_DEINIT */ #endif /* CONFIG_BLE_MESH_DEINIT */
}; };
#endif /* BLE_MESH_TIME_SCENE_CLIENT_ENABLE */