Skip to content

Commit

Permalink
Merge branch 'mesh_v1.1_idf' into 'master'
Browse files Browse the repository at this point in the history
feat(ble_mesh): Support Bluetooth Mesh Protocol v1.1 (Preview)

See merge request espressif/esp-idf!25605
  • Loading branch information
Isl2017 committed Sep 9, 2023
2 parents a57c8dc + 5bab168 commit 2bc1f2f
Show file tree
Hide file tree
Showing 582 changed files with 35,643 additions and 14,604 deletions.
190 changes: 119 additions & 71 deletions components/bt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -372,25 +372,29 @@ if(CONFIG_BT_ENABLED)
list(APPEND srcs "common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c")

if(CONFIG_BLE_MESH)
list(APPEND srcs "esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c")
list(APPEND srcs "esp_ble_mesh/core/bluedroid_host/adapter.c")
endif()

endif()

if(CONFIG_BLE_MESH)
list(APPEND include_dirs
"esp_ble_mesh/mesh_common/include"
"esp_ble_mesh/mesh_common/tinycrypt/include"
"esp_ble_mesh/mesh_core"
"esp_ble_mesh/mesh_core/include"
"esp_ble_mesh/mesh_core/storage"
"esp_ble_mesh/common/include"
"esp_ble_mesh/common/tinycrypt/include"
"esp_ble_mesh/core"
"esp_ble_mesh/core/include"
"esp_ble_mesh/core/storage"
"esp_ble_mesh/btc/include"
"esp_ble_mesh/mesh_models/common/include"
"esp_ble_mesh/mesh_models/client/include"
"esp_ble_mesh/mesh_models/server/include"
"esp_ble_mesh/models/common/include"
"esp_ble_mesh/models/client/include"
"esp_ble_mesh/models/server/include"
"esp_ble_mesh/api/core/include"
"esp_ble_mesh/api/models/include"
"esp_ble_mesh/api")
"esp_ble_mesh/api"
"esp_ble_mesh/v1.1/api/core/include"
"esp_ble_mesh/v1.1/api/models/include"
"esp_ble_mesh/v1.1/btc/include"
"esp_ble_mesh/v1.1/include")

list(APPEND srcs "esp_ble_mesh/api/core/esp_ble_mesh_ble_api.c"
"esp_ble_mesh/api/core/esp_ble_mesh_common_api.c"
Expand All @@ -413,66 +417,91 @@ if(CONFIG_BT_ENABLED)
"esp_ble_mesh/btc/btc_ble_mesh_prov.c"
"esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c"
"esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/aes_decrypt.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/aes_encrypt.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/cbc_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ccm_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/cmac_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ctr_mode.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ctr_prng.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc_dh.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc_dsa.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc_platform_specific.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/ecc.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/hmac_prng.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/hmac.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/sha256.c"
"esp_ble_mesh/mesh_common/tinycrypt/src/utils.c"
"esp_ble_mesh/mesh_common/mesh_atomic.c"
"esp_ble_mesh/mesh_common/mesh_buf.c"
"esp_ble_mesh/mesh_common/mesh_common.c"
"esp_ble_mesh/mesh_common/mesh_kernel.c"
"esp_ble_mesh/mesh_common/mesh_mutex.c"
"esp_ble_mesh/mesh_common/mesh_timer.c"
"esp_ble_mesh/mesh_common/mesh_util.c"
"esp_ble_mesh/mesh_core/storage/settings_nvs.c"
"esp_ble_mesh/mesh_core/access.c"
"esp_ble_mesh/mesh_core/adv.c"
"esp_ble_mesh/mesh_core/beacon.c"
"esp_ble_mesh/mesh_core/cfg_cli.c"
"esp_ble_mesh/mesh_core/cfg_srv.c"
"esp_ble_mesh/mesh_core/crypto.c"
"esp_ble_mesh/mesh_core/fast_prov.c"
"esp_ble_mesh/mesh_core/friend.c"
"esp_ble_mesh/mesh_core/health_cli.c"
"esp_ble_mesh/mesh_core/health_srv.c"
"esp_ble_mesh/mesh_core/local_operation.c"
"esp_ble_mesh/mesh_core/lpn.c"
"esp_ble_mesh/mesh_core/main.c"
"esp_ble_mesh/mesh_core/net.c"
"esp_ble_mesh/mesh_core/prov.c"
"esp_ble_mesh/mesh_core/provisioner_main.c"
"esp_ble_mesh/mesh_core/provisioner_prov.c"
"esp_ble_mesh/mesh_core/proxy_client.c"
"esp_ble_mesh/mesh_core/proxy_server.c"
"esp_ble_mesh/mesh_core/settings_uid.c"
"esp_ble_mesh/mesh_core/settings.c"
"esp_ble_mesh/mesh_core/scan.c"
"esp_ble_mesh/mesh_core/test.c"
"esp_ble_mesh/mesh_core/transport.c"
"esp_ble_mesh/mesh_models/common/device_property.c"
"esp_ble_mesh/mesh_models/client/client_common.c"
"esp_ble_mesh/mesh_models/client/generic_client.c"
"esp_ble_mesh/mesh_models/client/lighting_client.c"
"esp_ble_mesh/mesh_models/client/sensor_client.c"
"esp_ble_mesh/mesh_models/client/time_scene_client.c"
"esp_ble_mesh/mesh_models/server/generic_server.c"
"esp_ble_mesh/mesh_models/server/lighting_server.c"
"esp_ble_mesh/mesh_models/server/sensor_server.c"
"esp_ble_mesh/mesh_models/server/server_common.c"
"esp_ble_mesh/mesh_models/server/state_binding.c"
"esp_ble_mesh/mesh_models/server/state_transition.c"
"esp_ble_mesh/mesh_models/server/time_scene_server.c")
"esp_ble_mesh/common/tinycrypt/src/aes_decrypt.c"
"esp_ble_mesh/common/tinycrypt/src/aes_encrypt.c"
"esp_ble_mesh/common/tinycrypt/src/cbc_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ccm_mode.c"
"esp_ble_mesh/common/tinycrypt/src/cmac_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ctr_mode.c"
"esp_ble_mesh/common/tinycrypt/src/ctr_prng.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_dh.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_dsa.c"
"esp_ble_mesh/common/tinycrypt/src/ecc_platform_specific.c"
"esp_ble_mesh/common/tinycrypt/src/ecc.c"
"esp_ble_mesh/common/tinycrypt/src/hmac_prng.c"
"esp_ble_mesh/common/tinycrypt/src/hmac.c"
"esp_ble_mesh/common/tinycrypt/src/sha256.c"
"esp_ble_mesh/common/tinycrypt/src/utils.c"
"esp_ble_mesh/common/atomic.c"
"esp_ble_mesh/common/buf.c"
"esp_ble_mesh/common/common.c"
"esp_ble_mesh/common/kernel.c"
"esp_ble_mesh/common/mutex.c"
"esp_ble_mesh/common/timer.c"
"esp_ble_mesh/common/utils.c"
"esp_ble_mesh/core/storage/settings_nvs.c"
"esp_ble_mesh/core/storage/settings_uid.c"
"esp_ble_mesh/core/storage/settings.c"
"esp_ble_mesh/core/access.c"
"esp_ble_mesh/core/adv.c"
"esp_ble_mesh/core/beacon.c"
"esp_ble_mesh/core/cfg_cli.c"
"esp_ble_mesh/core/cfg_srv.c"
"esp_ble_mesh/core/crypto.c"
"esp_ble_mesh/core/fast_prov.c"
"esp_ble_mesh/core/friend.c"
"esp_ble_mesh/core/health_cli.c"
"esp_ble_mesh/core/health_srv.c"
"esp_ble_mesh/core/local.c"
"esp_ble_mesh/core/lpn.c"
"esp_ble_mesh/core/main.c"
"esp_ble_mesh/core/net.c"
"esp_ble_mesh/core/prov_common.c"
"esp_ble_mesh/core/prov_node.c"
"esp_ble_mesh/core/prov_pvnr.c"
"esp_ble_mesh/core/proxy_client.c"
"esp_ble_mesh/core/proxy_server.c"
"esp_ble_mesh/core/pvnr_mgmt.c"
"esp_ble_mesh/core/rpl.c"
"esp_ble_mesh/core/scan.c"
"esp_ble_mesh/core/test.c"
"esp_ble_mesh/core/transport.c"
"esp_ble_mesh/models/common/device_property.c"
"esp_ble_mesh/models/common/model_common.c"
"esp_ble_mesh/models/client/client_common.c"
"esp_ble_mesh/models/client/generic_client.c"
"esp_ble_mesh/models/client/lighting_client.c"
"esp_ble_mesh/models/client/sensor_client.c"
"esp_ble_mesh/models/client/time_scene_client.c"
"esp_ble_mesh/models/server/generic_server.c"
"esp_ble_mesh/models/server/lighting_server.c"
"esp_ble_mesh/models/server/sensor_server.c"
"esp_ble_mesh/models/server/server_common.c"
"esp_ble_mesh/models/server/state_binding.c"
"esp_ble_mesh/models/server/state_transition.c"
"esp_ble_mesh/models/server/time_scene_server.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_agg_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_brc_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_cm_data_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_df_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_lcd_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_odp_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_prb_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_rpr_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_sar_model_api.c"
"esp_ble_mesh/v1.1/api/core/esp_ble_mesh_srpl_model_api.c"
"esp_ble_mesh/v1.1/api/models/esp_ble_mesh_mbt_model_api.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_agg_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_brc_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_df_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_lcd_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_mbt_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_odp_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_prb_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_rpr_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_sar_model.c"
"esp_ble_mesh/v1.1/btc/btc_ble_mesh_srpl_model.c"
"esp_ble_mesh/v1.1/ext.c")
endif()


Expand Down Expand Up @@ -645,7 +674,7 @@ if(CONFIG_BT_ENABLED)
"common/btc/profile/esp/blufi/nimble_host/esp_blufi.c")

if(CONFIG_BLE_MESH)
list(APPEND srcs "esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c")
list(APPEND srcs "esp_ble_mesh/core/nimble_host/adapter.c")
endif()

if(CONFIG_BT_NIMBLE_MESH)
Expand Down Expand Up @@ -741,6 +770,25 @@ if(CONFIG_BT_ENABLED)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
endif()

if(CONFIG_BLE_MESH)
if(CONFIG_IDF_TARGET_ESP32)
add_prebuilt_library(mesh_v11 "esp_ble_mesh/v1.1/lib/esp32/libmesh_v1.1.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE mesh_v11)
elseif(CONFIG_IDF_TARGET_ESP32S3)
add_prebuilt_library(mesh_v11 "esp_ble_mesh/v1.1/lib/esp32s3/libmesh_v1.1.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE mesh_v11)
elseif(CONFIG_IDF_TARGET_ESP32C3)
add_prebuilt_library(mesh_v11 "esp_ble_mesh/v1.1/lib/esp32c3/libmesh_v1.1.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE mesh_v11)
elseif(CONFIG_IDF_TARGET_ESP32C6)
add_prebuilt_library(mesh_v11 "esp_ble_mesh/v1.1/lib/esp32c6/libmesh_v1.1.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE mesh_v11)
elseif(CONFIG_IDF_TARGET_ESP32H2)
add_prebuilt_library(mesh_v11 "esp_ble_mesh/v1.1/lib/esp32h2/libmesh_v1.1.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE mesh_v11)
endif()
endif()

if(CONFIG_BT_NIMBLE_MESH)
set_source_files_properties("host/nimble/nimble/nimble/host/mesh/src/net.c"
PROPERTIES COMPILE_FLAGS -Wno-type-limits)
Expand Down
70 changes: 70 additions & 0 deletions components/bt/common/btc/core/btc_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,20 @@
#include "btc_ble_mesh_prov.h"
#include "btc_ble_mesh_health_model.h"
#include "btc_ble_mesh_config_model.h"
#include "btc_ble_mesh_agg_model.h"
#include "btc_ble_mesh_brc_model.h"
#include "btc_ble_mesh_df_model.h"
#include "btc_ble_mesh_lcd_model.h"
#include "btc_ble_mesh_odp_model.h"
#include "btc_ble_mesh_prb_model.h"
#include "btc_ble_mesh_rpr_model.h"
#include "btc_ble_mesh_sar_model.h"
#include "btc_ble_mesh_srpl_model.h"
#include "btc_ble_mesh_generic_model.h"
#include "btc_ble_mesh_lighting_model.h"
#include "btc_ble_mesh_sensor_model.h"
#include "btc_ble_mesh_time_scene_model.h"
#include "btc_ble_mesh_mbt_model.h"
#endif /* #if CONFIG_BLE_MESH */

#define BTC_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)
Expand Down Expand Up @@ -158,6 +168,60 @@ 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 CONFIG_BLE_MESH_AGG_CLI
[BTC_PID_AGG_CLIENT] = {btc_ble_mesh_agg_client_call_handler, btc_ble_mesh_agg_client_cb_handler },
#endif /* CONFIG_BLE_MESH_AGG_CLI */
#if CONFIG_BLE_MESH_AGG_SRV
[BTC_PID_AGG_SERVER] = {NULL, btc_ble_mesh_agg_server_cb_handler },
#endif /* CONFIG_BLE_MESH_AGG_SRV */
#if CONFIG_BLE_MESH_BRC_CLI
[BTC_PID_BRC_CLIENT] = {btc_ble_mesh_brc_client_call_handler, btc_ble_mesh_brc_client_cb_handler },
#endif /* CONFIG_BLE_MESH_BRC_CLI */
#if CONFIG_BLE_MESH_BRC_SRV
[BTC_PID_BRC_SERVER] = {NULL, btc_ble_mesh_brc_server_cb_handler },
#endif /* CONFIG_BLE_MESH_BRC_SRV */
#if CONFIG_BLE_MESH_DF_CLI
[BTC_PID_DF_CLIENT] = {btc_ble_mesh_df_client_call_handler, btc_ble_mesh_df_client_cb_handler },
#endif /* CONFIG_BLE_MESH_DF_CLI */
#if CONFIG_BLE_MESH_DF_SRV
[BTC_PID_DF_SERVER] = {NULL, btc_ble_mesh_df_server_cb_handler },
#endif /* CONFIG_BLE_MESH_DF_SRV */
#if CONFIG_BLE_MESH_LCD_CLI
[BTC_PID_LCD_CLIENT] = {btc_ble_mesh_lcd_client_call_handler, btc_ble_mesh_lcd_client_cb_handler },
#endif /* CONFIG_BLE_MESH_LCD_CLI */
#if CONFIG_BLE_MESH_LCD_SRV
[BTC_PID_LCD_SERVER] = {NULL, btc_ble_mesh_lcd_server_cb_handler },
#endif /* CONFIG_BLE_MESH_LCD_SRV */
#if CONFIG_BLE_MESH_ODP_CLI
[BTC_PID_ODP_CLIENT] = {btc_ble_mesh_odp_client_call_handler, btc_ble_mesh_odp_client_cb_handler },
#endif /* CONFIG_BLE_MESH_ODP_CLI */
#if CONFIG_BLE_MESH_ODP_SRV
[BTC_PID_ODP_SERVER] = {NULL, btc_ble_mesh_odp_server_cb_handler },
#endif /* CONFIG_BLE_MESH_ODP_SRV */
#if CONFIG_BLE_MESH_PRB_CLI
[BTC_PID_PRB_CLIENT] = {btc_ble_mesh_prb_client_call_handler, btc_ble_mesh_prb_client_cb_handler },
#endif /* CONFIG_BLE_MESH_PRB_CLI */
#if CONFIG_BLE_MESH_PRB_SRV
[BTC_PID_PRB_SERVER] = {NULL, btc_ble_mesh_prb_server_cb_handler },
#endif /*CONFIG_BLE_MESH_PRB_SRV*/
#if CONFIG_BLE_MESH_RPR_CLI
[BTC_PID_RPR_CLIENT] = {btc_ble_mesh_rpr_client_call_handler, btc_ble_mesh_rpr_client_cb_handler },
#endif /* CONFIG_BLE_MESH_RPR_CLI */
#if CONFIG_BLE_MESH_RPR_SRV
[BTC_PID_RPR_SERVER] = {NULL, btc_ble_mesh_rpr_server_cb_handler },
#endif /* CONFIG_BLE_MESH_RPR_SRV */
#if CONFIG_BLE_MESH_SAR_CLI
[BTC_PID_SAR_CLIENT] = {btc_ble_mesh_sar_client_call_handler, btc_ble_mesh_sar_client_cb_handler },
#endif /* CONFIG_BLE_MESH_SAR_CLI */
#if CONFIG_BLE_MESH_SAR_SRV
[BTC_PID_SAR_SERVER] = {NULL, btc_ble_mesh_sar_server_cb_handler },
#endif /* CONFIG_BLE_MESH_SAR_SRV */
#if CONFIG_BLE_MESH_SRPL_CLI
[BTC_PID_SRPL_CLIENT] = {btc_ble_mesh_srpl_client_call_handler, btc_ble_mesh_srpl_client_cb_handler },
#endif /* CONFIG_BLE_MESH_SRPL_CLI */
#if CONFIG_BLE_MESH_SRPL_SRV
[BTC_PID_SRPL_SERVER] = {NULL, btc_ble_mesh_srpl_server_cb_handler },
#endif /* CONFIG_BLE_MESH_SRPL_SRV */
#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 /* CONFIG_BLE_MESH_GENERIC_CLIENT */
Expand All @@ -182,6 +246,12 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = {
#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 */
#if CONFIG_BLE_MESH_MBT_CLI
[BTC_PID_MBT_CLIENT] = {btc_ble_mesh_mbt_client_call_handler, btc_ble_mesh_mbt_client_cb_handler },
#endif /* CONFIG_BLE_MESH_MBT_CLI */
#if CONFIG_BLE_MESH_MBT_SRV
[BTC_PID_MBT_SERVER] = {btc_ble_mesh_mbt_server_call_handler, btc_ble_mesh_mbt_server_cb_handler },
#endif /* CONFIG_BLE_MESH_MBT_SRV */
#if CONFIG_BLE_MESH_BLE_COEX_SUPPORT
[BTC_PID_BLE_MESH_BLE_COEX] = {btc_ble_mesh_ble_call_handler, btc_ble_mesh_ble_cb_handler },
#endif /* CONFIG_BLE_MESH_BLE_COEX_SUPPORT */
Expand Down
20 changes: 20 additions & 0 deletions components/bt/common/btc/include/btc/btc_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ typedef enum {
BTC_PID_HEALTH_SERVER,
BTC_PID_CONFIG_CLIENT,
BTC_PID_CONFIG_SERVER,
BTC_PID_AGG_CLIENT,
BTC_PID_AGG_SERVER,
BTC_PID_BRC_CLIENT,
BTC_PID_BRC_SERVER,
BTC_PID_DF_CLIENT,
BTC_PID_DF_SERVER,
BTC_PID_LCD_CLIENT,
BTC_PID_LCD_SERVER,
BTC_PID_ODP_CLIENT,
BTC_PID_ODP_SERVER,
BTC_PID_PRB_CLIENT,
BTC_PID_PRB_SERVER,
BTC_PID_RPR_CLIENT,
BTC_PID_RPR_SERVER,
BTC_PID_SAR_CLIENT,
BTC_PID_SAR_SERVER,
BTC_PID_SRPL_CLIENT,
BTC_PID_SRPL_SERVER,
BTC_PID_GENERIC_CLIENT,
BTC_PID_LIGHTING_CLIENT,
BTC_PID_SENSOR_CLIENT,
Expand All @@ -83,6 +101,8 @@ typedef enum {
BTC_PID_LIGHTING_SERVER,
BTC_PID_SENSOR_SERVER,
BTC_PID_TIME_SCENE_SERVER,
BTC_PID_MBT_CLIENT,
BTC_PID_MBT_SERVER,
BTC_PID_BLE_MESH_BLE_COEX,
#endif /* CONFIG_BLE_MESH */
BTC_PID_NUM,
Expand Down
Loading

0 comments on commit 2bc1f2f

Please sign in to comment.