feat(ble_mesh): esp ble mesh v1.1 features enable/disable supported

This commit is contained in:
luoxu 2024-09-18 20:45:47 +08:00
parent dc6657cac4
commit 8413ad1f68
27 changed files with 845 additions and 308 deletions

View File

@ -46,12 +46,20 @@ set(ble_mesh_include_dirs
"esp_ble_mesh/api/core/include"
"esp_ble_mesh/api/models/include"
"esp_ble_mesh/api"
)
set(ble_mesh_v11_include_dirs
"esp_ble_mesh/lib/include"
"esp_ble_mesh/v1.1/api/core/include"
"esp_ble_mesh/v1.1/api/models/include"
"esp_ble_mesh/v1.1/btc/include"
)
if(CONFIG_IDF_DOC_BUILD)
list(APPEND ble_mesh_include_dirs
${ble_mesh_v11_include_dirs})
endif()
set(bluedroid_include_dirs host/bluedroid/api/include/api)
if(CONFIG_BT_CONTROLLER_ENABLED OR CONFIG_IDF_DOC_BUILD)
@ -533,34 +541,41 @@ if(CONFIG_BT_ENABLED)
"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/lib/ext.c")
"esp_ble_mesh/models/server/time_scene_server.c")
if(CONFIG_BLE_MESH_V11_SUPPORT)
list(APPEND include_dirs ${ble_mesh_v11_include_dirs})
if(CONFIG_BLE_MESH_SAR_ENHANCEMENT)
list(APPEND srcs "esp_ble_mesh/core/transport.enh.c")
list(APPEND srcs
"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/lib/ext.c")
if(CONFIG_BLE_MESH_SAR_ENHANCEMENT)
list(APPEND srcs "esp_ble_mesh/core/transport.enh.c")
else()
list(APPEND srcs "esp_ble_mesh/core/transport.c")
endif()
else()
list(APPEND srcs "esp_ble_mesh/core/transport.c")
list(APPEND srcs
"esp_ble_mesh/core/transport.c")
endif()
endif()
@ -881,7 +896,7 @@ if(CONFIG_BT_ENABLED)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
endif()
if(CONFIG_BLE_MESH)
if(CONFIG_BLE_MESH_V11_SUPPORT)
if(CONFIG_IDF_TARGET_ESP32)
add_prebuilt_library(ble_mesh "esp_ble_mesh/lib/lib/esp32/libble_mesh.a")
target_link_libraries(${COMPONENT_LIB} PRIVATE ble_mesh)

View File

@ -69,6 +69,12 @@
#include "btc_ble_mesh_prov.h"
#include "btc_ble_mesh_health_model.h"
#include "btc_ble_mesh_config_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"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "btc_ble_mesh_mbt_model.h"
#include "btc_ble_mesh_agg_model.h"
#include "btc_ble_mesh_brc_model.h"
#include "btc_ble_mesh_df_model.h"
@ -78,11 +84,7 @@
#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 /* CONFIG_BLE_MESH_V11_SUPPORT */
#endif /* #if CONFIG_BLE_MESH */
#define BTC_TASK_PINNED_TO_CORE (TASK_PINNED_TO_CORE)

View File

@ -6,6 +6,12 @@ if BLE_MESH
help
It is a temporary solution and needs further modifications.
config BLE_MESH_V11_SUPPORT
bool "Support ESP BLE Mesh v1.1 features (Preview)"
default y
help
Support BLE Mesh v1.1 features
config BLE_MESH_RANDOM_ADV_INTERVAL
bool "Support using random adv interval for mesh packets"
select BT_BLE_HIGH_DUTY_ADV_INTERVAL if BT_BLUEDROID_ENABLED
@ -33,6 +39,7 @@ if BLE_MESH
config BLE_MESH_ACTIVE_SCAN
bool "Support Active Scan in BLE Mesh"
depends on BLE_MESH_V11_SUPPORT
help
Enable this option to allow using BLE Active Scan for BLE Mesh.
@ -282,6 +289,7 @@ if BLE_MESH
config BLE_MESH_PROV_EPA
bool "BLE Mesh enhanced provisioning authentication"
depends on BLE_MESH_PROV
depends on BLE_MESH_V11_SUPPORT
default y
help
Enable this option to support BLE Mesh enhanced provisioning authentication
@ -291,6 +299,7 @@ if BLE_MESH
config BLE_MESH_CERT_BASED_PROV
bool "Support Certificate-based provisioning"
depends on BLE_MESH_PROV
depends on BLE_MESH_V11_SUPPORT
default n
help
Enable this option to support BLE Mesh Certificate-Based Provisioning.
@ -391,6 +400,7 @@ if BLE_MESH
config BLE_MESH_PROXY_SOLIC_PDU_RX
bool "Support receiving Proxy Solicitation PDU"
depends on BLE_MESH_GATT_PROXY_SERVER
depends on BLE_MESH_V11_SUPPORT
help
Enable this option to support receiving Proxy Solicitation PDU.
@ -418,6 +428,7 @@ if BLE_MESH
config BLE_MESH_PROXY_SOLIC_PDU_TX
bool "Support sending Proxy Solicitation PDU"
depends on BLE_MESH_GATT_PROXY_CLIENT
depends on BLE_MESH_V11_SUPPORT
help
Enable this option to support sending Proxy Solicitation PDU.
@ -704,6 +715,7 @@ if BLE_MESH
to perform the IV index recovery procedure.
config BLE_MESH_SAR_ENHANCEMENT
depends on BLE_MESH_V11_SUPPORT
bool "Segmentation and reassembly enhancement"
default n
help
@ -1103,253 +1115,257 @@ if BLE_MESH
help
Enable support for Health Server model.
config BLE_MESH_BRC_CLI
bool "Bridge Configuration Client model"
help
Enable support for Bridge Configuration Client model.
if BLE_MESH_V11_SUPPORT
config BLE_MESH_BRC_SRV
bool "Bridge Configuration Server model"
default n
help
Enable support for Bridge Configuration Server model.
if BLE_MESH_BRC_SRV
config BLE_MESH_MAX_BRIDGING_TABLE_ENTRY_COUNT
int "Maximum number of Bridging Table entries"
range 16 65535
default 16
config BLE_MESH_BRC_CLI
bool "Bridge Configuration Client model"
help
Maximum number of Bridging Table entries that the Bridge Configuration Server can support.
Enable support for Bridge Configuration Client model.
config BLE_MESH_BRIDGE_CRPL
int "Maximum capacity of bridge replay protection list"
default 5
range 1 255
help
This option specifies the maximum capacity of the bridge replay
protection list. The bridge replay protection list is used to
prevent a bridged subnet from replay attack, which will store the
source address and sequence number of the received bridge messages.
endif #BLE_MESH_BRC_SRV
config BLE_MESH_PRB_CLI
bool "Mesh Private Beacon Client model"
help
Enable support for Mesh Private Beacon Client model.
config BLE_MESH_PRB_SRV
bool "Mesh Private Beacon Server model"
help
Enable support for Mesh Private Beacon Server model.
config BLE_MESH_ODP_CLI
bool "On-Demand Private Proxy Client model"
help
Enable support for On-Demand Private Proxy Client model.
config BLE_MESH_ODP_SRV
bool "On-Demand Private Proxy Server model"
depends on BLE_MESH_PROXY_SOLIC_PDU_RX
select BLE_MESH_SRPL_SRV
help
Enable support for On-Demand Private Proxy Server model.
config BLE_MESH_SRPL_CLI
bool "Solicitation PDU RPL Configuration Client model"
help
Enable support for Solicitation PDU RPL Configuration Client model.
config BLE_MESH_SRPL_SRV
bool "Solicitation PDU RPL Configuration Server model"
depends on BLE_MESH_PROXY_SOLIC_PDU_RX
help
Enable support for Solicitation PDU RPL Configuration Server model.
Note:
This option depends on the functionality of receiving Solicitation
PDU. If the device doesn't support receiving Solicitation PDU, then
there is no need to enable this server model.
config BLE_MESH_AGG_CLI
bool "Opcodes Aggregator Client model"
help
Enable support for Opcodes Aggregator Client model.
config BLE_MESH_AGG_SRV
bool "Opcodes Aggregator Server model"
help
Enable support for Opcodes Aggregator Server model.
config BLE_MESH_SAR_CLI
bool "SAR Configuration Client model"
help
Enable support for SAR Configuration Client model.
config BLE_MESH_SAR_SRV
bool "SAR Configuration Server model"
help
Enable support for SAR Configuration Server model.
config BLE_MESH_COMP_DATA_1
bool "Support Composition Data Page 1"
help
Composition Data Page 1 contains information about the relationships
among models.
Each model either can be a root model or can extend other models.
config BLE_MESH_COMP_DATA_128
bool "Support Composition Data Page 128"
help
Composition Data Page 128 is used to indicate the structure of
elements, features, and models of a node after the successful
execution of the Node Address Refresh procedure or the Node
Composition Refresh procedure, or after the execution of the
Node Removal procedure followed by the provisioning process.
Composition Data Page 128 shall be present if the node supports
the Remote Provisioning Server model; otherwise it is optional.
config BLE_MESH_MODELS_METADATA_0
bool "Support Models Metadata Page 0"
help
The Models Metadata state contains metadata of a nodes models.
The Models Metadata state is composed of a number of pages of
information.
Models Metadata Page 0 shall be present if the node supports
the Large Composition Data Server model.
config BLE_MESH_MODELS_METADATA_128
bool "Support Models Metadata Page 128"
depends on BLE_MESH_MODELS_METADATA_0
help
The Models Metadata state contains metadata of a nodes models.
The Models Metadata state is composed of a number of pages of
information.
Models Metadata Page 128 contains metadata for the nodes models
after the successful execution of the Node Address Refresh
procedure or the Node Composition Refresh procedure, or after
the execution of the Node Removal procedure followed by the
provisioning process.
Models Metadata Page 128 shall be present if the node supports
the Remote Provisioning Server model and the node supports the
Large Composition Data Server model.
config BLE_MESH_LCD_CLI
bool "Large Composition Data Client model"
help
Enable support for Large Composition Data Client model.
config BLE_MESH_LCD_SRV
bool "Large Composition Data Server model"
select BLE_MESH_MODELS_METADATA_0
help
Enable support for Large Composition Data Server model.
config BLE_MESH_RPR_CLI
bool "Remote Provisioning Client model"
depends on BLE_MESH_PROVISIONER
select BLE_MESH_PROV
help
Enable support for Remote Provisioning Client model
if BLE_MESH_RPR_CLI
config BLE_MESH_RPR_CLI_PROV_SAME_TIME
int "Maximum number of PB-Remote running at the same time by Provisioner"
range 1 5
default 2
help
This option specifies how many devices can be provisioned at the same time
using PB-REMOTE. For example, if the value is 2, it means a Provisioner can
provision two unprovisioned devices with PB-REMOTE at the same time.
endif # BLE_MESH_RPR_CLI
config BLE_MESH_RPR_SRV
bool "Remote Provisioning Server model"
depends on BLE_MESH_NODE
select BLE_MESH_PB_ADV
help
Enable support for Remote Provisioning Server model
if BLE_MESH_RPR_SRV
config BLE_MESH_RPR_SRV_MAX_SCANNED_ITEMS
int "Maximum number of device information can be scanned"
range 4 255
default 10
help
This option specifies how many device information can a Remote
Provisioning Server store each time while scanning.
config BLE_MESH_RPR_SRV_ACTIVE_SCAN
bool "Support Active Scan for remote provisioning"
select BLE_MESH_ACTIVE_SCAN
help
Enable this option to support Active Scan for remote provisioning.
config BLE_MESH_RPR_SRV_MAX_EXT_SCAN
int "Maximum number of extended scan procedures"
range 1 10
default 1
help
This option specifies how many extended scan procedures can be
started by the Remote Provisioning Server.
endif # BLE_MESH_RPR_SRV
config BLE_MESH_DF_CLI
bool "Directed Forwarding Configuration Client model"
help
Enable support for Directed Forwarding Configuration Client model.
config BLE_MESH_DF_SRV
bool "Directed Forwarding Configuration Server model"
help
Enable support for Directed Forwarding Configuration Server model.
if BLE_MESH_DF_SRV
config BLE_MESH_MAX_DISC_TABLE_ENTRY_COUNT
int "Maximum number of discovery table entries in a given subnet"
range 2 255
default 2
help
Maximum number of Discovery Table entries supported by the node in a given subnet.
config BLE_MESH_MAX_FORWARD_TABLE_ENTRY_COUNT
int "Maximum number of forward table entries in a given subnet"
range 2 64
default 2
help
Maximum number of Forward Table entries supported by the node in a given subnet.
config BLE_MESH_MAX_DEPS_NODES_PER_PATH
int "Maximum number of dependent nodes per path"
range 2 64
default 2
help
Maximum size of dependent nodes list supported by each forward table entry.
config BLE_MESH_PATH_MONITOR_TEST
bool "Enable Path Monitoring test mode"
config BLE_MESH_BRC_SRV
bool "Bridge Configuration Server model"
default n
help
The option only removes the Path Use timer; all other behavior of the
device is not changed.
If Path Monitoring test mode is going to be used, this option should
be enabled.
Enable support for Bridge Configuration Server model.
if BLE_MESH_GATT_PROXY_SERVER
config BLE_MESH_SUPPORT_DIRECTED_PROXY
bool "Enable Directed Proxy functionality"
default y
if BLE_MESH_BRC_SRV
config BLE_MESH_MAX_BRIDGING_TABLE_ENTRY_COUNT
int "Maximum number of Bridging Table entries"
range 16 65535
default 16
help
Support Directed Proxy functionality.
endif
Maximum number of Bridging Table entries that the Bridge Configuration Server can support.
endif # BLE_MESH_DF_SRV
config BLE_MESH_BRIDGE_CRPL
int "Maximum capacity of bridge replay protection list"
default 5
range 1 255
help
This option specifies the maximum capacity of the bridge replay
protection list. The bridge replay protection list is used to
prevent a bridged subnet from replay attack, which will store the
source address and sequence number of the received bridge messages.
endif #BLE_MESH_BRC_SRV
config BLE_MESH_PRB_CLI
bool "Mesh Private Beacon Client model"
help
Enable support for Mesh Private Beacon Client model.
config BLE_MESH_PRB_SRV
bool "Mesh Private Beacon Server model"
help
Enable support for Mesh Private Beacon Server model.
config BLE_MESH_ODP_CLI
bool "On-Demand Private Proxy Client model"
help
Enable support for On-Demand Private Proxy Client model.
config BLE_MESH_ODP_SRV
bool "On-Demand Private Proxy Server model"
depends on BLE_MESH_PROXY_SOLIC_PDU_RX
select BLE_MESH_SRPL_SRV
help
Enable support for On-Demand Private Proxy Server model.
config BLE_MESH_SRPL_CLI
bool "Solicitation PDU RPL Configuration Client model"
help
Enable support for Solicitation PDU RPL Configuration Client model.
config BLE_MESH_SRPL_SRV
bool "Solicitation PDU RPL Configuration Server model"
depends on BLE_MESH_PROXY_SOLIC_PDU_RX
help
Enable support for Solicitation PDU RPL Configuration Server model.
Note:
This option depends on the functionality of receiving Solicitation
PDU. If the device doesn't support receiving Solicitation PDU, then
there is no need to enable this server model.
config BLE_MESH_AGG_CLI
bool "Opcodes Aggregator Client model"
help
Enable support for Opcodes Aggregator Client model.
config BLE_MESH_AGG_SRV
bool "Opcodes Aggregator Server model"
help
Enable support for Opcodes Aggregator Server model.
config BLE_MESH_SAR_CLI
bool "SAR Configuration Client model"
help
Enable support for SAR Configuration Client model.
config BLE_MESH_SAR_SRV
bool "SAR Configuration Server model"
help
Enable support for SAR Configuration Server model.
config BLE_MESH_COMP_DATA_1
bool "Support Composition Data Page 1"
help
Composition Data Page 1 contains information about the relationships
among models.
Each model either can be a root model or can extend other models.
config BLE_MESH_COMP_DATA_128
bool "Support Composition Data Page 128"
help
Composition Data Page 128 is used to indicate the structure of
elements, features, and models of a node after the successful
execution of the Node Address Refresh procedure or the Node
Composition Refresh procedure, or after the execution of the
Node Removal procedure followed by the provisioning process.
Composition Data Page 128 shall be present if the node supports
the Remote Provisioning Server model; otherwise it is optional.
config BLE_MESH_MODELS_METADATA_0
bool "Support Models Metadata Page 0"
help
The Models Metadata state contains metadata of a nodes models.
The Models Metadata state is composed of a number of pages of
information.
Models Metadata Page 0 shall be present if the node supports
the Large Composition Data Server model.
config BLE_MESH_MODELS_METADATA_128
bool "Support Models Metadata Page 128"
depends on BLE_MESH_MODELS_METADATA_0
help
The Models Metadata state contains metadata of a nodes models.
The Models Metadata state is composed of a number of pages of
information.
Models Metadata Page 128 contains metadata for the nodes models
after the successful execution of the Node Address Refresh
procedure or the Node Composition Refresh procedure, or after
the execution of the Node Removal procedure followed by the
provisioning process.
Models Metadata Page 128 shall be present if the node supports
the Remote Provisioning Server model and the node supports the
Large Composition Data Server model.
config BLE_MESH_LCD_CLI
bool "Large Composition Data Client model"
help
Enable support for Large Composition Data Client model.
config BLE_MESH_LCD_SRV
bool "Large Composition Data Server model"
select BLE_MESH_MODELS_METADATA_0
help
Enable support for Large Composition Data Server model.
config BLE_MESH_RPR_CLI
bool "Remote Provisioning Client model"
depends on BLE_MESH_PROVISIONER
select BLE_MESH_PROV
help
Enable support for Remote Provisioning Client model
if BLE_MESH_RPR_CLI
config BLE_MESH_RPR_CLI_PROV_SAME_TIME
int "Maximum number of PB-Remote running at the same time by Provisioner"
range 1 5
default 2
help
This option specifies how many devices can be provisioned at the same time
using PB-REMOTE. For example, if the value is 2, it means a Provisioner can
provision two unprovisioned devices with PB-REMOTE at the same time.
endif # BLE_MESH_RPR_CLI
config BLE_MESH_RPR_SRV
bool "Remote Provisioning Server model"
depends on BLE_MESH_NODE
select BLE_MESH_PB_ADV
help
Enable support for Remote Provisioning Server model
if BLE_MESH_RPR_SRV
config BLE_MESH_RPR_SRV_MAX_SCANNED_ITEMS
int "Maximum number of device information can be scanned"
range 4 255
default 10
help
This option specifies how many device information can a Remote
Provisioning Server store each time while scanning.
config BLE_MESH_RPR_SRV_ACTIVE_SCAN
bool "Support Active Scan for remote provisioning"
select BLE_MESH_ACTIVE_SCAN
help
Enable this option to support Active Scan for remote provisioning.
config BLE_MESH_RPR_SRV_MAX_EXT_SCAN
int "Maximum number of extended scan procedures"
range 1 10
default 1
help
This option specifies how many extended scan procedures can be
started by the Remote Provisioning Server.
endif # BLE_MESH_RPR_SRV
config BLE_MESH_DF_CLI
bool "Directed Forwarding Configuration Client model"
help
Enable support for Directed Forwarding Configuration Client model.
config BLE_MESH_DF_SRV
bool "Directed Forwarding Configuration Server model"
help
Enable support for Directed Forwarding Configuration Server model.
if BLE_MESH_DF_SRV
config BLE_MESH_MAX_DISC_TABLE_ENTRY_COUNT
int "Maximum number of discovery table entries in a given subnet"
range 2 255
default 2
help
Maximum number of Discovery Table entries supported by the node in a given subnet.
config BLE_MESH_MAX_FORWARD_TABLE_ENTRY_COUNT
int "Maximum number of forward table entries in a given subnet"
range 2 64
default 2
help
Maximum number of Forward Table entries supported by the node in a given subnet.
config BLE_MESH_MAX_DEPS_NODES_PER_PATH
int "Maximum number of dependent nodes per path"
range 2 64
default 2
help
Maximum size of dependent nodes list supported by each forward table entry.
config BLE_MESH_PATH_MONITOR_TEST
bool "Enable Path Monitoring test mode"
default n
help
The option only removes the Path Use timer; all other behavior of the
device is not changed.
If Path Monitoring test mode is going to be used, this option should
be enabled.
if BLE_MESH_GATT_PROXY_SERVER
config BLE_MESH_SUPPORT_DIRECTED_PROXY
bool "Enable Directed Proxy functionality"
default y
help
Support Directed Proxy functionality.
endif
endif # BLE_MESH_DF_SRV
endif # BLE_MESH_V11_SUPPORT
endmenu #Support for BLE Mesh Foundation models
@ -1466,6 +1482,7 @@ if BLE_MESH
config BLE_MESH_MBT_CLI
bool "BLOB Transfer Client model"
depends on BLE_MESH_V11_SUPPORT
default n
help
Enable support for BLOB Transfer Client model.
@ -1484,6 +1501,7 @@ if BLE_MESH
config BLE_MESH_MBT_SRV
bool "BLOB Transfer Server model"
depends on BLE_MESH_V11_SUPPORT
default n
help
Enable support for BLOB Transfer Server model.

View File

@ -10,11 +10,13 @@
#include "btc_ble_mesh_prov.h"
#include "btc_ble_mesh_config_model.h"
#include "btc_ble_mesh_health_model.h"
#include "btc_ble_mesh_prb_model.h"
#include "btc_ble_mesh_generic_model.h"
#include "btc_ble_mesh_time_scene_model.h"
#include "btc_ble_mesh_sensor_model.h"
#include "btc_ble_mesh_lighting_model.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "btc_ble_mesh_prb_model.h"
#include "btc_ble_mesh_brc_model.h"
#include "btc_ble_mesh_odp_model.h"
#include "btc_ble_mesh_srpl_model.h"
@ -24,6 +26,8 @@
#include "btc_ble_mesh_rpr_model.h"
#include "btc_ble_mesh_df_model.h"
#include "btc_ble_mesh_mbt_model.h"
#include "mesh_v1.1/utils.h"
#endif /* CONFIG_BLE_MESH_V11_SUPPORT */
#include "adv.h"
#include "mesh/kernel.h"
@ -65,8 +69,6 @@
#include "mesh/state_binding.h"
#include "local.h"
#include "mesh_v1.1/utils.h"
#include "esp_ble_mesh_common_api.h"
#include "esp_ble_mesh_provisioning_api.h"
#include "esp_ble_mesh_networking_api.h"

View File

@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -11,6 +11,7 @@
#include <errno.h>
#include "mesh.h"
#include "tag.h"
#include "adv.h"
#include "lpn.h"
#include "friend.h"
@ -22,7 +23,9 @@
#include "fast_prov.h"
#include "pvnr_mgmt.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#define BLE_MESH_SDU_MAX_LEN 384
@ -814,6 +817,135 @@ static bool ready_to_send(uint16_t dst)
return false;
}
#if !CONFIG_BLE_MESH_V11_SUPPORT
static bool use_friend_cred(uint16_t net_idx, uint16_t dst)
{
/* Currently LPN only supports using NetKey in bt_mesh.sub[0] */
if (IS_ENABLED(CONFIG_BLE_MESH_LOW_POWER) &&
net_idx == 0 &&
bt_mesh_lpn_match(dst)) {
return true;
}
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND) &&
bt_mesh_friend_match(net_idx, dst)) {
return true;
}
return false;
}
bool bt_mesh_valid_security_cred(struct bt_mesh_net_tx *tx)
{
/* If the message is tagged with immutable-credentials,
* then the security credentials shall not be changed
* in lower layers.
* If not, later a better security credentials could be
* chosen for the message.
*/
if (!bt_mesh_tag_immutable_cred(tx->ctx->send_tag)) {
return true;
}
if (tx->ctx->send_cred > BLE_MESH_FRIENDSHIP_CRED) {
return false;
}
if (tx->ctx->send_cred == BLE_MESH_FRIENDSHIP_CRED &&
!use_friend_cred(tx->ctx->net_idx, tx->ctx->addr)) {
return false;
}
return true;
}
void bt_mesh_choose_better_security_cred(struct bt_mesh_net_tx *tx)
{
uint8_t send_cred = 0U;
uint8_t send_tag = 0U;
uint16_t net_idx = 0U;
uint16_t addr = 0U;
send_cred = tx->ctx->send_cred;
send_tag = tx->ctx->send_tag;
net_idx = tx->ctx->net_idx;
addr = tx->ctx->addr;
/* If the message is tagged with immutable-credentials,
* then the security credentials shall not be changed.
*/
if (bt_mesh_tag_immutable_cred(send_tag)) {
return;
}
if (send_cred > BLE_MESH_FRIENDSHIP_CRED) {
BT_INFO("Use managed flooding security credentials");
tx->ctx->send_cred = BLE_MESH_FLOODING_CRED;
return;
}
if (send_cred == BLE_MESH_FRIENDSHIP_CRED) {
if (!use_friend_cred(net_idx, addr)) {
BT_INFO("Use managed flooding security credentials");
tx->ctx->send_cred = BLE_MESH_FLOODING_CRED;
tx->ctx->send_tag = send_tag | BLE_MESH_TAG_IMMUTABLE_CRED;
} else {
/* TODO:
* For LPN, do we need to change the friendship security
* credentials to managed flooding credentials?
* If changed, this could increase the possibility that
* the corresponding Friend node receives this message.
*/
}
return;
}
/* If the message is destinated to a LPN, the following could be
* introduced to send the message with the friendship credentials.
*
* For LPN, this optimization should not be introduced, since it
* may cause the message failed to received by the Friend node,
* using friendship credentials will make the message can not be
* relayed by other mesh nodes.
*/
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND) &&
BLE_MESH_ADDR_IS_UNICAST(addr) &&
bt_mesh_friend_match(net_idx, addr)) {
BT_INFO("Use friendship security credentials");
tx->ctx->send_cred = BLE_MESH_FRIENDSHIP_CRED;
tx->ctx->send_tag = send_tag | BLE_MESH_TAG_IMMUTABLE_CRED;
return;
}
/**
* Spec 3.7.3.1
* The Low power node in friendship should use friendship security
* material.
*
* But in Spec 3.6.6.2
* Depending on the value of the Publish Friendship Credentials Flag
* (see Section 4.2.3.4), the Low Power node model publishes messages
* using either the friendship security credentials or the managed
* flooding security credentials (see Section 3.9.6.3.1).
*
* So use the BLE_MESH_TAG_IMMUTABLE_CRED to indicate that the
* credentials of the message should not be changed when the
* message is sent by model publishing, even though the spec
* didn't require this flag to be set when model publishing.
*/
#if CONFIG_BLE_MESH_LOW_POWER
if (BLE_MESH_ADDR_IS_UNICAST(addr) &&
bt_mesh.lpn.frnd == addr &&
!bt_mesh_tag_immutable_cred(send_tag)) {
tx->ctx->send_cred = BLE_MESH_FRIENDSHIP_CRED;
tx->ctx->send_tag = send_tag | BLE_MESH_TAG_IMMUTABLE_CRED;
return;
}
#endif
}
#endif /* !CONFIG_BLE_MESH_V11_SUPPORT */
static int model_send(struct bt_mesh_model *model,
struct bt_mesh_net_tx *tx, bool implicit_bind,
struct net_buf_simple *msg,
@ -1108,11 +1240,13 @@ size_t bt_mesh_rx_devkey_size(void)
#if CONFIG_BLE_MESH_NODE && !CONFIG_BLE_MESH_PROVISIONER
if (bt_mesh_is_provisioned()) {
size = 1;
#if CONFIG_BLE_MESH_RPR_SRV
if (bt_mesh_dev_key_ca_valid()) {
size += 1;
}
#endif /* CONFIG_BLE_MESH_RPR_SRV */
}
#endif
#endif /* CONFIG_BLE_MESH_NODE && !CONFIG_BLE_MESH_PROVISIONER */
#if !CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PROVISIONER
if (bt_mesh_is_provisioner_en()) {
@ -1122,9 +1256,11 @@ size_t bt_mesh_rx_devkey_size(void)
#if CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PROVISIONER
size = 1;
#if CONFIG_BLE_MESH_RPR_SRV
if (bt_mesh_dev_key_ca_valid()) {
size += 1;
}
#endif /* CONFIG_BLE_MESH_RPR_SRV */
if (bt_mesh_is_provisioner_en()) {
size += 1;
}
@ -1156,7 +1292,9 @@ const uint8_t *bt_mesh_rx_devkey_get(size_t index, uint16_t src)
#if CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PROVISIONER
if (index == 0) {
key = bt_mesh.dev_key;
} else if (index == 1 && bt_mesh_dev_key_ca_valid()) {
} else
#if CONFIG_BLE_MESH_RPR_SRV
if (index == 1 && bt_mesh_dev_key_ca_valid()) {
/* If index == 1, there are two cases.
* 1. bt_mesh_dev_key_ca_valid() is true, it should be return bt_mesh.dev_key_ca.
* 2. bt_mesh_is_provisioner_en() is true, it should be return bt_mesh_provisioner_dev_key_get(src).
@ -1166,7 +1304,9 @@ const uint8_t *bt_mesh_rx_devkey_get(size_t index, uint16_t src)
* Then this round of function bt_mesh_rx_devkey_get(2, src) will return bt_mesh_provisioner_dev_key_get(src).
*/
key = bt_mesh.dev_key_ca;
} else {
} else
#endif
{
key = bt_mesh_provisioner_dev_key_get(src);
}
#endif

View File

@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -25,7 +25,9 @@
#include "pvnr_mgmt.h"
#include "mesh/common.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#if defined(CONFIG_BLE_MESH_UNPROVISIONED_BEACON_INTERVAL)
#define UNPROV_BEACON_INTERVAL K_SECONDS(CONFIG_BLE_MESH_UNPROVISIONED_BEACON_INTERVAL)
@ -472,12 +474,13 @@ void bt_mesh_beacon_recv(struct net_buf_simple *buf, int8_t rssi)
bt_mesh_provisioner_unprov_beacon_recv(buf, rssi);
}
if (IS_ENABLED(CONFIG_BLE_MESH_RPR_SRV) &&
bt_mesh_is_provisioned()) {
#if CONFIG_BLE_MESH_RPR_SRV
if (bt_mesh_is_provisioned()) {
const bt_mesh_addr_t *addr = bt_mesh_get_unprov_dev_addr();
bt_mesh_unprov_dev_fifo_enqueue(buf->data, addr->val, bt_mesh_get_adv_type());
bt_mesh_rpr_srv_unprov_beacon_recv(buf, bt_mesh_get_adv_type(), addr, rssi);
}
#endif
break;
case BEACON_TYPE_SECURE:
secure_beacon_recv(buf);

View File

@ -32,7 +32,9 @@
#include "net.h"
#include "beacon.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
struct bt_mesh_dev bt_mesh_dev;

View File

@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -30,7 +30,9 @@
#include "mesh/common.h"
#include "heartbeat.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#define DEFAULT_TTL 7
@ -38,6 +40,158 @@ static struct bt_mesh_cfg_srv *conf;
static struct label labels[CONFIG_BLE_MESH_LABEL_COUNT];
#if !CONFIG_BLE_MESH_V11_SUPPORT
const void *comp_0;
static uint8_t bt_mesh_comp_page_check(uint8_t page, bool largest)
{
/* If the page doesn't exist, TWO situations currently:
* 1. For Composition Data Get:
* With the Page field set to the largest page number of
* the Composition Data that the node supports and that is
* less than the Page field value of the received Config
* Composition Data Get message;
* 2. For Large Composition Data Get:
* The Page field shall be set to the largest page number
* of the Composition Data that the node supports.
*/
ARG_UNUSED(largest);
if (page != 0) {
BT_WARN("Composition Data Page %d not exists", page);
}
return 0;
}
static inline uint16_t get_comp_elem_size(struct bt_mesh_elem *elem)
{
return (4 + elem->model_count * 2 + elem->vnd_model_count * 4);
}
static uint16_t get_comp_data_size(const struct bt_mesh_comp *comp)
{
uint16_t size = 10; /* CID + PID + VID + CRPL + Features */
for (int i = 0; i < comp->elem_count; i++) {
size += get_comp_elem_size(&(comp->elem[i]));
}
return size;
}
static void get_comp_data(struct net_buf_simple *buf,
const struct bt_mesh_comp *comp,
bool full_element)
{
struct bt_mesh_model *model = NULL;
struct bt_mesh_elem *elem = NULL;
uint16_t feat = 0;
if (IS_ENABLED(CONFIG_BLE_MESH_RELAY)) {
feat |= BLE_MESH_FEAT_RELAY;
}
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
feat |= BLE_MESH_FEAT_PROXY;
}
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND)) {
feat |= BLE_MESH_FEAT_FRIEND;
}
if (IS_ENABLED(CONFIG_BLE_MESH_LOW_POWER)) {
feat |= BLE_MESH_FEAT_LOW_POWER;
}
net_buf_simple_add_le16(buf, comp->cid);
net_buf_simple_add_le16(buf, comp->pid);
net_buf_simple_add_le16(buf, comp->vid);
net_buf_simple_add_le16(buf, CONFIG_BLE_MESH_CRPL);
net_buf_simple_add_le16(buf, feat);
for (size_t i = 0; i < comp->elem_count; i++) {
elem = &(comp->elem[i]);
/* If "full_element" is true, which means the complete list
* of models within the element needs to fit in the data,
* otherwise the element shall not be reported.
*/
if (full_element &&
net_buf_simple_tailroom(buf) < get_comp_elem_size(elem)) {
return;
}
net_buf_simple_add_le16(buf, elem->loc);
net_buf_simple_add_u8(buf, elem->model_count);
net_buf_simple_add_u8(buf, elem->vnd_model_count);
for (size_t j = 0; j < elem->model_count; j++) {
model = &(elem->models[j]);
net_buf_simple_add_le16(buf, model->id);
}
for (size_t j = 0; j < elem->vnd_model_count; j++) {
model = &(elem->vnd_models[j]);
net_buf_simple_add_le16(buf, model->vnd.company);
net_buf_simple_add_le16(buf, model->vnd.id);
}
}
}
static int fetch_comp_data(struct net_buf_simple *buf,
const struct bt_mesh_comp *comp,
uint8_t page, uint16_t offset,
bool full_element)
{
uint16_t size = get_comp_data_size(comp);
if (offset >= size) {
BT_WARN("Too large offset %d for comp data %d, size %d",
page, offset, size);
return 0;
}
if (net_buf_simple_tailroom(buf) < 10 ||
size - offset > net_buf_simple_tailroom(buf)) {
BT_ERR("Too small buffer for comp data %d, %d, expected %d",
page, buf->size, size - offset);
return -EINVAL;
}
if (offset) {
struct net_buf_simple *pdu = bt_mesh_alloc_buf(size);
if (pdu == NULL) {
BT_ERR("%s, Out of memory", __func__);
return -ENOMEM;
}
get_comp_data(pdu, comp, false);
/* Get part of Composition Data Page 0/128 */
net_buf_simple_add_mem(buf, pdu->data + offset, pdu->len - offset);
bt_mesh_free_buf(pdu);
} else {
get_comp_data(buf, comp, full_element);
}
return 0;
}
static int bt_mesh_get_comp_data(struct net_buf_simple *buf,
uint8_t page, uint16_t offset,
bool full_element)
{
if (page == 0) {
return fetch_comp_data(buf, comp_0, page, offset, full_element);
}
BT_ERR("Invalid Composition Data Page %d", page);
return -EINVAL;
}
#endif /* !CONFIG_BLE_MESH_V11_SUPPORT */
static void comp_data_get(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
@ -2758,7 +2912,7 @@ static void node_reset(struct bt_mesh_model *model,
bt_mesh_model_msg_init(&msg, OP_NODE_RESET_STATUS);
/* Send the response first since we wont have any keys left to
/* Send the response first since we won't have any keys left to
* send it later.
*/
if (bt_mesh_model_send(model, ctx, &msg, NULL, NULL)) {

View File

@ -22,7 +22,9 @@
#include "mesh/common.h"
#include "mesh/adapter.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#define NET_MIC_LEN(pdu) (((pdu)[1] & 0x80) ? 8 : 4)
#define APP_MIC_LEN(aszmic) ((aszmic) ? 8 : 4)

View File

@ -21,7 +21,9 @@
#include "mesh/common.h"
#include "pvnr_mgmt.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#ifdef CONFIG_BLE_MESH_FRIEND

View File

@ -10,6 +10,7 @@
#include <errno.h>
#include "crypto.h"
#include "tag.h"
#include "adv.h"
#include "scan.h"
#include "mesh.h"
@ -23,7 +24,9 @@
#include "mesh/cfg_srv.h"
#include "heartbeat.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#ifdef CONFIG_BLE_MESH_LOW_POWER

View File

@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -30,7 +30,9 @@
#include "prov_pvnr.h"
#include "pvnr_mgmt.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
static bool mesh_init = false;
@ -161,9 +163,9 @@ void bt_mesh_node_reset(void)
bt_mesh_clear_seq();
bt_mesh_clear_dkca();
bt_mesh_clear_role();
if (IS_ENABLED(CONFIG_BLE_MESH_DF_SRV)) {
bt_mesh_clear_all_directed_forwarding_table_data();
}
#if CONFIG_BLE_MESH_DF_SRV
bt_mesh_clear_all_directed_forwarding_table_data();
#endif
}
memset(bt_mesh.flags, 0, sizeof(bt_mesh.flags));
@ -405,12 +407,14 @@ int bt_mesh_init(const struct bt_mesh_prov *prov,
return -EALREADY;
}
#if CONFIG_BLE_MESH_V11_SUPPORT
extern int bt_mesh_v11_ext_init(void);
err = bt_mesh_v11_ext_init();
if (err) {
BT_ERR("Bluetooth Mesh v1.1 init failed");
return err;
}
#endif
bt_mesh_mutex_init();

View File

@ -11,6 +11,7 @@
#define _MESH_H_
#include "net.h"
#include "tag.h"
#ifdef __cplusplus
extern "C" {

View File

@ -31,7 +31,9 @@
#include "proxy_server.h"
#include "pvnr_mgmt.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
/* Minimum valid Mesh Network PDU length. The Network headers
* themselves take up 9 bytes. After that there is a minumum of 1 byte
@ -1019,6 +1021,33 @@ int bt_mesh_net_encode(struct bt_mesh_net_tx *tx, struct net_buf_simple *buf,
return bt_mesh_net_obfuscate(buf->data, BLE_MESH_NET_IVI_TX, priv);
}
#if !CONFIG_BLE_MESH_V11_SUPPORT
static void bt_mesh_net_adv_xmit_update(struct bt_mesh_net_tx *tx)
{
/* When transmitting a Network PDU that is tagged as friendship,
* the Advertising Bearer Network Interface shall transmit the
* Network PDU over the advertising bearer only once.
*
* Note: Currently when transmitting a packet with the friendship
* credentials used, the message flow will not reach here. It
* will be enqueued into the friend queue in transport.c, and
* waited to be sent.
*/
if (bt_mesh_tag_friendship(tx->ctx->send_tag)) {
tx->xmit = BLE_MESH_TRANSMIT(0, BLE_MESH_TRANSMIT_INT(bt_mesh_net_transmit_get()));
return;
}
if (bt_mesh_tag_relay(tx->ctx->send_tag)) {
tx->xmit = bt_mesh_relay_retransmit_get();
} else {
tx->xmit = bt_mesh_net_transmit_get();
}
return;
}
#endif /* !CONFIG_BLE_MESH_V11_SUPPORT */
int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
const struct bt_mesh_send_cb *cb, void *cb_data)
{
@ -1418,13 +1447,94 @@ static bool relay_to_adv(enum bt_mesh_net_if net_if)
case BLE_MESH_NET_IF_ADV:
return (bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED);
case BLE_MESH_NET_IF_PROXY:
return (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED ||
bt_mesh_private_gatt_proxy_state_get() == BLE_MESH_PRIVATE_GATT_PROXY_ENABLED);
return (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED
#if CONFIG_BLE_MESH_PRB_SRV
|| bt_mesh_private_gatt_proxy_state_get() == BLE_MESH_PRIVATE_GATT_PROXY_ENABLED
#endif
);
default:
return false;
}
}
#if !CONFIG_BLE_MESH_V11_SUPPORT
static uint8_t net_retransmission_adv(struct bt_mesh_net_rx *rx,
uint8_t *cred, uint8_t *tag)
{
if (rx->ctx.recv_cred == BLE_MESH_FLOODING_CRED) {
uint8_t bearer = BLE_MESH_NONE_BEARER;
/* Inbound bearer: ADV;
* Inbound Security Material: managed flooding;
*/
/* Condition: Relay is enabled. */
if (IS_ENABLED(CONFIG_BLE_MESH_RELAY) &&
bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED) {
bearer |= BLE_MESH_ADV_BEARER;
*cred = BLE_MESH_FLOODING_CRED;
/* Additional action: Tag as relay */
*tag |= BLE_MESH_TAG_RELAY;
}
/* Condition: Proxy is enabled. */
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED) {
bearer |= BLE_MESH_GATT_BEARER;
*cred = BLE_MESH_FLOODING_CRED;
}
return bearer;
}
if (rx->ctx.recv_cred == BLE_MESH_FRIENDSHIP_CRED &&
IS_ENABLED(CONFIG_BLE_MESH_FRIEND) &&
bt_mesh_friend_get() == BLE_MESH_FRIEND_ENABLED) {
/* Condition: Directed friend is disabled. */
*cred = BLE_MESH_FLOODING_CRED;
return BLE_MESH_ALL_BEARERS;
}
return BLE_MESH_NONE_BEARER;
}
static uint8_t net_retransmission_gatt(struct bt_mesh_net_rx *rx,
uint8_t *cred, uint8_t *tag)
{
if (rx->ctx.recv_cred == BLE_MESH_FLOODING_CRED) {
/* Inbound bearer: GATT;
* Inbound Security Material: managed flooding;
* Condition: Proxy is enabled;
*/
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED) {
/* Condition: Directed proxy is disabled. */
*cred = BLE_MESH_FLOODING_CRED;
return BLE_MESH_ALL_BEARERS;
}
return BLE_MESH_NONE_BEARER;
}
return BLE_MESH_NONE_BEARER;
}
static uint8_t bt_mesh_net_retrans_match(struct bt_mesh_net_rx *rx,
uint8_t *cred, uint8_t *tag)
{
if (rx->net_if == BLE_MESH_NET_IF_ADV) {
return net_retransmission_adv(rx, cred, tag);
}
if (rx->net_if == BLE_MESH_NET_IF_PROXY) {
return net_retransmission_gatt(rx, cred, tag);
}
return BLE_MESH_NONE_BEARER;
}
#endif /* !CONFIG_BLE_MESH_V11_SUPPORT */
static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
struct bt_mesh_net_rx *rx)
{
@ -1621,7 +1731,9 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
(bearer & BLE_MESH_GATT_BEARER) &&
((bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED &&
cred != BLE_MESH_FRIENDSHIP_CRED) ||
#if CONFIG_BLE_MESH_PRB_SRV
bt_mesh_private_gatt_proxy_state_get() == BLE_MESH_PRIVATE_GATT_PROXY_ENABLED ||
#endif
rx->net_if == BLE_MESH_NET_IF_LOCAL ||
rx->ctx.recv_cred == BLE_MESH_FRIENDSHIP_CRED)) {
if (bt_mesh_proxy_server_relay(&buf->b, rx->ctx.recv_dst) &&
@ -1819,7 +1931,9 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
bt_mesh_elem_find(rx.ctx.recv_dst));
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
#if CONFIG_BLE_MESH_PRB_SRV
bt_mesh_private_gatt_proxy_state_get() != BLE_MESH_PRIVATE_GATT_PROXY_ENABLED &&
#endif
net_if == BLE_MESH_NET_IF_PROXY) {
bt_mesh_proxy_server_addr_add(data, rx.ctx.addr);

View File

@ -17,7 +17,9 @@
#include "mesh/timer.h"
#include "mesh/adapter.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -22,7 +22,9 @@
#include "prov_common.h"
#include "prov_node.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#if CONFIG_BLE_MESH_NODE

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -22,7 +22,9 @@
#include "prov_pvnr.h"
#include "pvnr_mgmt.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#if CONFIG_BLE_MESH_PROVISIONER
@ -1413,7 +1415,7 @@ static int prov_auth(struct bt_mesh_prov_link *link,
return -EINVAL;
}
/* Provisioner ouput number/string and wait for device's Provisioning Input Complete PDU */
/* Provisioner output number/string and wait for device's Provisioning Input Complete PDU */
link->expect = PROV_INPUT_COMPLETE;
/* NOTE: The Bluetooth SIG recommends that mesh implementations enforce a randomly

View File

@ -21,7 +21,9 @@
#include "pvnr_mgmt.h"
#include "mesh/adapter.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT

View File

@ -11,7 +11,9 @@
#include "mesh/adapter.h"
#include "prov_common.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -22,7 +22,9 @@
#include "prov_common.h"
#include "prov_node.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_SERVER

View File

@ -22,7 +22,9 @@
#include "prov_pvnr.h"
#include "pvnr_mgmt.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#if CONFIG_BLE_MESH_PROVISIONER

View File

@ -2,7 +2,7 @@
/*
* SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2020-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -27,7 +27,9 @@
#include "prov_pvnr.h"
#include "mesh/adapter.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
/* Scan Window and Interval are equal for continuous scanning */
#define SCAN_INTERVAL 0x20
@ -263,12 +265,13 @@ static void handle_adv_service_data(struct net_buf_simple *buf,
bt_mesh_provisioner_prov_adv_recv(buf, addr, rssi);
}
if (IS_ENABLED(CONFIG_BLE_MESH_RPR_SRV) &&
bt_mesh_is_provisioned()) {
#if CONFIG_BLE_MESH_RPR_SRV
if (bt_mesh_is_provisioned()) {
const bt_mesh_addr_t *addr = bt_mesh_get_unprov_dev_addr();
bt_mesh_unprov_dev_fifo_enqueue(buf->data, addr->val, bt_mesh_get_adv_type());
bt_mesh_rpr_srv_unprov_beacon_recv(buf, bt_mesh_get_adv_type(), addr, rssi);
}
#endif
break;
#endif
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT

View File

@ -22,7 +22,9 @@
#include "pvnr_mgmt.h"
#include "prov_pvnr.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
/* BLE Mesh NVS Key and corresponding data struct.
* Note: The length of nvs key must be <= 15.

View File

@ -0,0 +1,53 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _BLE_MESH_v11_TAG_H_
#define _BLE_MESH_v11_TAG_H_
#include <stdint.h>
#include <stdbool.h>
#include "mesh.h"
#ifdef __cplusplus
extern "C" {
#endif
#if !CONFIG_BLE_MESH_V11_SUPPORT
/* TAG - additional metadata */
#define BLE_MESH_TAG_SEND_SEGMENTED BIT(0)
#define BLE_MESH_TAG_IMMUTABLE_CRED BIT(1)
#define BLE_MESH_TAG_RELAY BIT(3)
#define BLE_MESH_TAG_FRIENDSHIP BIT(4)
static inline bool bt_mesh_tag_send_segmented(uint8_t tag)
{
return (tag & BLE_MESH_TAG_SEND_SEGMENTED);
}
static inline bool bt_mesh_tag_immutable_cred(uint8_t tag)
{
return (tag & BLE_MESH_TAG_IMMUTABLE_CRED);
}
static inline bool bt_mesh_tag_relay(uint8_t tag)
{
return (tag & BLE_MESH_TAG_RELAY);
}
static inline bool bt_mesh_tag_friendship(uint8_t tag)
{
return (tag & BLE_MESH_TAG_FRIENDSHIP);
}
#endif /* !CONFIG_BLE_MESH_V11_SUPPORT */
#ifdef __cplusplus
}
#endif
#endif /* _BLE_MESH_v11_TAG_H_ */

View File

@ -11,6 +11,7 @@
#include <errno.h>
#include "crypto.h"
#include "tag.h"
#include "adv.h"
#include "mesh.h"
#include "lpn.h"
@ -26,7 +27,9 @@
#include "mesh/cfg_srv.h"
#include "heartbeat.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
/* The transport layer needs at least three buffers for itself to avoid
* deadlocks. Ensure that there are a sufficient number of advertising
@ -1039,18 +1042,18 @@ static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr,
return 0;
}
if (IS_ENABLED(CONFIG_BLE_MESH_DF_SRV)) {
switch (ctl_op) {
case TRANS_CTL_OP_PATH_REQ:
case TRANS_CTL_OP_PATH_REPLY:
case TRANS_CTL_OP_PATH_CFM:
case TRANS_CTL_OP_PATH_ECHO_REQ:
case TRANS_CTL_OP_PATH_ECHO_REPLY:
case TRANS_CTL_OP_DEP_NODE_UPDATE:
case TRANS_CTL_OP_PATH_REQ_SOLIC:
return bt_mesh_directed_forwarding_ctl_recv(ctl_op, rx, buf);
}
#if CONFIG_BLE_MESH_DF_SRV
switch (ctl_op) {
case TRANS_CTL_OP_PATH_REQ:
case TRANS_CTL_OP_PATH_REPLY:
case TRANS_CTL_OP_PATH_CFM:
case TRANS_CTL_OP_PATH_ECHO_REQ:
case TRANS_CTL_OP_PATH_ECHO_REPLY:
case TRANS_CTL_OP_DEP_NODE_UPDATE:
case TRANS_CTL_OP_PATH_REQ_SOLIC:
return bt_mesh_directed_forwarding_ctl_recv(ctl_op, rx, buf);
}
#endif
if (IS_ENABLED(CONFIG_BLE_MESH_FRIEND) && !bt_mesh_lpn_established()) {
switch (ctl_op) {
@ -1759,8 +1762,6 @@ void bt_mesh_trans_init(void)
{
int i;
bt_mesh_sar_init();
for (i = 0; i < ARRAY_SIZE(seg_tx); i++) {
k_delayed_work_init(&seg_tx[i].rtx_timer, seg_retransmit);
}

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

View File

@ -14,7 +14,9 @@
#include "mesh/client_common.h"
#include "mesh/common.h"
#if CONFIG_BLE_MESH_V11_SUPPORT
#include "mesh_v1.1/utils.h"
#endif
#define HCI_TIME_FOR_START_ADV K_MSEC(5) /* Three adv related hci commands may take 4 ~ 5ms */