Merge branch 'espressif:release/v5.5' into release/v5.5
This commit is contained in:
@@ -13,25 +13,9 @@ ESP-IDF is the development framework for Espressif SoCs supported on Windows, Li
|
||||
|
||||
# ESP-IDF Release and SoC Compatibility
|
||||
|
||||
The following table shows ESP-IDF support of Espressif SoCs where ![alt text][preview] and ![alt text][supported] denote preview status and support, respectively. The preview support is usually limited in time and intended for beta versions of chips. Please use an ESP-IDF release where the desired SoC is already supported.
|
||||

|
||||
|
||||
|Chip | v5.1 | v5.2 | v5.3 | v5.4 | v5.5 | |
|
||||
|:----------- |:--------------------: | :--------------------: | :--------------------: | :--------------------: | :--------------------: |:------------------------------------------------------------------- |
|
||||
|ESP32 | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | |
|
||||
|ESP32-S2 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | |
|
||||
|ESP32-C3 | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | |
|
||||
|ESP32-S3 | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32_S3) |
|
||||
|ESP32-C2 | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32-C2) |
|
||||
|ESP32-C6 | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32_C6) |
|
||||
|ESP32-H2 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32_H2) |
|
||||
|ESP32-P4 | | | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |[Announcement](https://www.espressif.com/en/news/ESP32-P4) |
|
||||
|ESP32-C5 | | | | |![alt text][supported] |since v5.5.1, [Announcement](https://www.espressif.com/en/news/ESP32-C5) |
|
||||
|ESP32-C61 | | | | |![alt text][supported] |since v5.5.1, [Announcement](https://www.espressif.com/en/products/socs/esp32-c61) |
|
||||
|
||||
[supported]: https://img.shields.io/badge/-supported-green "supported"
|
||||
[preview]: https://img.shields.io/badge/-preview-orange "preview"
|
||||
|
||||
There are variants of revisions for a series of chips. See [Compatibility Between ESP-IDF Releases and Revisions of Espressif SoCs](https://github.com/espressif/esp-idf/blob/master/COMPATIBILITY.md) for the details of the compatibility between ESP-IDF and chip revisions.
|
||||
See [Compatibility Between ESP-IDF Releases and Revisions of Espressif SoCs](https://github.com/espressif/esp-idf/blob/master/COMPATIBILITY.md) for the details of the compatibility between ESP-IDF and chip revisions.
|
||||
|
||||
Espressif SoCs released before 2016 (ESP8266 and ESP8285) are supported by [RTOS SDK](https://github.com/espressif/ESP8266_RTOS_SDK) instead.
|
||||
|
||||
|
||||
+2
-19
@@ -13,26 +13,9 @@ ESP-IDF 是乐鑫官方推出的物联网开发框架,支持 Windows、Linux
|
||||
|
||||
# ESP-IDF 与乐鑫芯片
|
||||
|
||||
下表总结了乐鑫芯片在 ESP-IDF 各版本中的支持状态,其中 ![alt text][supported] 代表已支持,![alt text][preview] 代表目前处于预览支持状态。预览支持状态通常有时间限制,而且仅适用于测试版芯片。请确保使用与芯片相匹配的 ESP-IDF 版本。
|
||||

|
||||
|
||||
芯片 | v5.1 | v5.2 | v5.3 | v5.4 | v5.5 | |
|
||||
|:----------- | :--------------------: | :--------------------: | :--------------------: | :--------------------: | :--------------------: |:------------------------------------------------------------------------ |
|
||||
|ESP32 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |![alt text][supported] | |
|
||||
|ESP32-S2 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | |
|
||||
|ESP32-C3 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] | |
|
||||
|ESP32-S3 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32_S3) |
|
||||
|ESP32-C2 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32-C2) |
|
||||
|ESP32-C6 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32_C6) |
|
||||
|ESP32-H2 |![alt text][supported] | ![alt text][supported] | ![alt text][supported] | ![alt text][supported] |![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32_H2) |
|
||||
|ESP32-P4 | | | ![alt text][supported] | ![alt text][supported] |![alt text][supported] | [芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32-P4) |
|
||||
|ESP32-C5 | | | | |![alt text][supported] | 自 v5.5.1 开始,[芯片发布公告](https://www.espressif.com/zh-hans/news/ESP32-C5) |
|
||||
|ESP32-C61 | | | | |![alt text][supported] | 自 v5.5.1 开始,[芯片发布公告](https://www.espressif.com/zh-hans/products/socs/esp32-c61) |
|
||||
|
||||
|
||||
[supported]: https://img.shields.io/badge/-%E6%94%AF%E6%8C%81-green "supported"
|
||||
[preview]: https://img.shields.io/badge/-%E9%A2%84%E8%A7%88-orange "preview"
|
||||
|
||||
每款乐鑫芯片都可能有不同版本。建议参考 [ESP-IDF 版本与乐鑫芯片版本兼容性](https://github.com/espressif/esp-idf/blob/master/COMPATIBILITY_CN.md),了解 ESP-IDF 版本与各芯片版本之间的兼容性。
|
||||
请参考 [ESP-IDF 版本与乐鑫芯片版本兼容性](https://github.com/espressif/esp-idf/blob/master/COMPATIBILITY_CN.md) 了解 ESP-IDF 版本与芯片版本之间的兼容性详情。
|
||||
|
||||
对于 2016 年之前发布的乐鑫芯片(包括 ESP8266 和 ESP8285),请参考 [RTOS SDK](https://github.com/espressif/ESP8266_RTOS_SDK)。
|
||||
|
||||
|
||||
@@ -676,6 +676,10 @@ if(CONFIG_BT_ENABLED)
|
||||
"porting/transport/src/hci_transport.c"
|
||||
)
|
||||
|
||||
list(APPEND include_dirs
|
||||
host/nimble/port/include
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED)
|
||||
list(APPEND srcs
|
||||
"host/nimble/nimble/porting/nimble/src/hal_uart.c"
|
||||
@@ -716,7 +720,12 @@ if(CONFIG_BT_ENABLED)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT (CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS OR CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS))
|
||||
# Compile TinyCrypt if:
|
||||
# 1. Controller uses TinyCrypt (not mbedTLS), OR
|
||||
# 2. NimBLE uses TinyCrypt (not mbedTLS), OR
|
||||
# 3. Bluedroid Host SMP uses TinyCrypt
|
||||
if(CONFIG_BT_SMP_CRYPTO_STACK_TINYCRYPT OR
|
||||
(NOT CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS AND NOT CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS))
|
||||
list(APPEND include_dirs
|
||||
common/tinycrypt/include
|
||||
common/tinycrypt/port
|
||||
@@ -975,7 +984,7 @@ set(bt_priv_requires
|
||||
)
|
||||
|
||||
if(CONFIG_BLE_COMPRESSED_LOG_ENABLE)
|
||||
set(BT_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(CODE_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
# When log compression is enabled, selected logs are replaced
|
||||
# by auto-generated macros that emit pre-encoded data.
|
||||
# This eliminates the original format strings, reducing firmware size and
|
||||
|
||||
@@ -6,6 +6,43 @@ config BT_ALARM_MAX_NUM
|
||||
This option decides the maximum number of alarms which
|
||||
could be used by Bluetooth host.
|
||||
|
||||
choice BT_SMP_CRYPTO_STACK
|
||||
prompt "SMP cryptographic stack"
|
||||
depends on (BT_BLE_SMP_ENABLE || BT_SMP_ENABLE || BT_NIMBLE_SECURITY_ENABLE)
|
||||
default BT_SMP_CRYPTO_STACK_NATIVE
|
||||
help
|
||||
Select the cryptographic library to use for SMP operations (AES, AES-CMAC, ECDH P-256).
|
||||
|
||||
config BT_SMP_CRYPTO_STACK_NATIVE
|
||||
bool "Native Bluedroid implementation"
|
||||
depends on (BT_BLE_SMP_ENABLE || BT_SMP_ENABLE)
|
||||
help
|
||||
Use the built-in Bluedroid cryptographic implementation.
|
||||
This provides compatibility with all features.
|
||||
This option is only available for Bluedroid host.
|
||||
|
||||
config BT_SMP_CRYPTO_STACK_TINYCRYPT
|
||||
bool "TinyCrypt"
|
||||
help
|
||||
Use TinyCrypt library for cryptographic operations.
|
||||
TinyCrypt is a lightweight cryptographic library designed for constrained devices.
|
||||
This can reduce code size compared to the native implementation.
|
||||
This is the default option.
|
||||
|
||||
config BT_SMP_CRYPTO_STACK_MBEDTLS
|
||||
bool "mbedTLS"
|
||||
select MBEDTLS_AES_C
|
||||
select MBEDTLS_CMAC_C
|
||||
select MBEDTLS_ECDH_C
|
||||
select MBEDTLS_ECP_C
|
||||
select MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
help
|
||||
Use mbedTLS library for cryptographic operations.
|
||||
This can provide hardware acceleration on supported platforms and reduce code size
|
||||
by sharing crypto implementations with other components.
|
||||
|
||||
endchoice
|
||||
|
||||
menu "BLE Log"
|
||||
source "$IDF_PATH/components/bt/common/ble_log/Kconfig.in"
|
||||
endmenu
|
||||
|
||||
@@ -110,12 +110,46 @@ if BLE_LOG_ENABLED
|
||||
help
|
||||
Enable BLE Log TS with external logging module
|
||||
|
||||
config BLE_LOG_SYNC_IO_NUM
|
||||
int "GPIO number for Timestamp Synchronization (TS) toggle output"
|
||||
depends on BLE_LOG_TS_ENABLED
|
||||
default 0
|
||||
help
|
||||
GPIO number for TS toggle output
|
||||
if BLE_LOG_TS_ENABLED
|
||||
config BLE_LOG_SYNC_IO_NUM
|
||||
int "GPIO number for Timestamp Synchronization (TS) toggle output"
|
||||
depends on BLE_LOG_TS_ENABLED
|
||||
default 0
|
||||
help
|
||||
GPIO number for TS toggle output
|
||||
|
||||
config BLE_LOG_TS_TRIGGER_TIMEOUT_MS
|
||||
int "Timeout (ms) for Timestamp Synchronization toggle"
|
||||
default 1000
|
||||
help
|
||||
Timeout (ms) for Timestamp Synchronization toggle
|
||||
|
||||
choice BLE_LOG_TS_TRIGGER_CHOICE
|
||||
prompt "BLE Log Timestamp Synchronization trigger choice"
|
||||
default BLE_LOG_TS_TRIGGER_TASK_EVENT
|
||||
help
|
||||
Choose BLE Log Timestamp Synchronization trigger
|
||||
|
||||
config BLE_LOG_TS_TRIGGER_ESP_TIMER
|
||||
bool "BLE Log Timestamp Synchronization trigger - ESP Timer"
|
||||
help
|
||||
ESP Timer based periodic TS trigger
|
||||
|
||||
config BLE_LOG_TS_TRIGGER_TASK_EVENT
|
||||
bool "BLE Log Timestamp Synchronization trigger - Task Event"
|
||||
help
|
||||
Task Event based TS trigger (Light Sleep Test Compatibility)
|
||||
endchoice
|
||||
|
||||
config BLE_LOG_TS_TRIGGER_ESP_TIMER_ISR_DISPATCH_METHOD
|
||||
bool "Utilize ISR dispatch method for ESP Timer as Timestamp Synchronization trigger"
|
||||
default n
|
||||
select ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
|
||||
select GPIO_CTRL_FUNC_IN_IRAM
|
||||
depends on BLE_LOG_TS_TRIGGER_ESP_TIMER
|
||||
help
|
||||
Utilize ISR dispatch method for ESP Timer as Timestamp Synchronization trigger
|
||||
endif
|
||||
|
||||
choice BLE_LOG_PRPH_CHOICE
|
||||
prompt "BLE Log peripheral choice"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
set(LOG_COMPRESSED_MODULE "")
|
||||
set(LOG_COMPRESSED_MODULE_CODE_PATH "")
|
||||
set(BT_ROOT_PATH $ENV{IDF_PATH}/components/bt)
|
||||
set(LOG_COMPRESSED_SRCS_DIR "${CMAKE_BINARY_DIR}/ble_log/.compressed_srcs")
|
||||
|
||||
# default config value for ble mesh module
|
||||
@@ -17,32 +17,62 @@ set(BLE_HOST_TAGS_PRESERVE "")
|
||||
|
||||
if(CONFIG_BLE_MESH_COMPRESSED_LOG_ENABLE)
|
||||
list(APPEND LOG_COMPRESSED_MODULE "BLE_MESH")
|
||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/ble_log/include/mesh_log_index.h")
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/ble_log/include/mesh_log_index.h" "")
|
||||
endif()
|
||||
list(APPEND LOG_COMPRESSED_MODULE_CODE_PATH "esp_ble_mesh")
|
||||
|
||||
# update config file
|
||||
set(BLE_MESH_CODE_PATH "esp_ble_mesh")
|
||||
set(BLE_MESH_LOG_INDEX_HEADER "mesh_log_index.h")
|
||||
set(BLE_MESH_LOG_SCRIPT_PATH
|
||||
"${CMAKE_CURRENT_LIST_DIR}/scripts/module_scripts/ble_mesh/make_mesh_log_macro.py")
|
||||
# update BLE_MESH_TAGS and BLE_MESH_TAGS_PRESERVE
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/ble_mesh_log_tags.cmake)
|
||||
|
||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/ble_log/include/${BLE_MESH_LOG_INDEX_HEADER}")
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/ble_log/include/${BLE_MESH_LOG_INDEX_HEADER}" "")
|
||||
endif()
|
||||
list(APPEND LOG_COMPRESSED_MODULE_CODE_PATH ${BLE_MESH_CODE_PATH})
|
||||
endif()
|
||||
|
||||
if(CONFIG_BLE_HOST_COMPRESSED_LOG_ENABLE AND CONFIG_BT_BLUEDROID_ENABLED)
|
||||
list(APPEND LOG_COMPRESSED_MODULE "BLE_HOST")
|
||||
list(APPEND LOG_COMPRESSED_MODULE_CODE_PATH "host/bluedroid/stack")
|
||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/ble_log/include/host_log_index.h")
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/ble_log/include/host_log_index.h" "")
|
||||
endif()
|
||||
|
||||
# update config file
|
||||
set(HOST_CODE_PATH "host/bluedroid/stack")
|
||||
set(HOST_LOG_INDEX_HEADER "host_log_index.h")
|
||||
set(BLE_HOST_LOG_SCRIPT_PATH
|
||||
"${CMAKE_CURRENT_LIST_DIR}/scripts/module_scripts/bluedroid/make_bluedroid_log_macro.py")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/ble_host_bluedroid_tags.cmake)
|
||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/ble_log/include/${HOST_LOG_INDEX_HEADER}")
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/ble_log/include/${HOST_LOG_INDEX_HEADER}" "")
|
||||
endif()
|
||||
list(APPEND LOG_COMPRESSED_MODULE_CODE_PATH ${HOST_CODE_PATH})
|
||||
endif()
|
||||
|
||||
if(BLE_COMPRESSED_LIB_LOG_BUILD)
|
||||
if(NOT (BLE_COMPRESSED_LIB_NAME AND BLE_COMPRESSED_LIB_CODE_DIR AND BLE_COMPRESSED_LIB_LOG_TAGS))
|
||||
message(FATAL_ERROR "Invalid settings")
|
||||
else()
|
||||
message("Building compressed log for ${BLE_COMPRESSED_LIB_NAME}")
|
||||
endif()
|
||||
list(APPEND LOG_COMPRESSED_MODULE ${BLE_COMPRESSED_LIB_NAME})
|
||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/ble_log/include/${BLE_COMPRESSED_LIB_LOG_INDEX_HEADER}")
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/ble_log/include/${BLE_COMPRESSED_LIB_LOG_INDEX_HEADER}" "")
|
||||
endif()
|
||||
list(APPEND LOG_COMPRESSED_MODULE_CODE_PATH ${BLE_COMPRESSED_LIB_CODE_DIR})
|
||||
|
||||
string(REPLACE ";" "," BLE_COMPRESSED_LIB_CODE_DIR "${BLE_COMPRESSED_LIB_CODE_DIR}")
|
||||
string(REPLACE ";" "," BLE_COMPRESSED_LIB_LOG_TAGS "${BLE_COMPRESSED_LIB_LOG_TAGS}")
|
||||
string(REPLACE ";" "," BLE_COMPRESSED_LIB_LOG_TAGS_PRESERVE "${BLE_COMPRESSED_LIB_LOG_TAGS_PRESERVE}")
|
||||
else()
|
||||
set(BLE_COMPRESSED_LIB_NAME "placeholder")
|
||||
endif()
|
||||
|
||||
|
||||
if(LOG_COMPRESSED_MODULE)
|
||||
list(APPEND srcs "common/ble_log/extension/log_compression/ble_log_compression.c")
|
||||
list(APPEND include_dirs "${CMAKE_BINARY_DIR}/ble_log/include")
|
||||
# When building the library, ble_log_compression.c and its dependencies are not needed
|
||||
if(NOT BLE_COMPRESSED_LIB_LOG_BUILD)
|
||||
list(APPEND srcs "common/ble_log/extension/log_compression/ble_log_compression.c")
|
||||
list(APPEND include_dirs "${CMAKE_BINARY_DIR}/ble_log/include")
|
||||
endif()
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.15.0)
|
||||
set(Python3_FIND_STRATEGY LOCATION)
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
@@ -111,19 +141,39 @@ if(LOG_COMPRESSED_MODULE)
|
||||
"host/nimble/nimble/nimble/host/store/config/src")
|
||||
endif()
|
||||
|
||||
add_custom_target(ble_log_compression ALL
|
||||
COMMAND ${BLE_PYTHON_EXECUTABLE} ${PYTHON_SCRIPT}
|
||||
compress
|
||||
--compressed_srcs_path "${LOG_COMPRESSED_SRCS_DIR}"
|
||||
--build_path "${CMAKE_BINARY_DIR}"
|
||||
--module "'${LOG_COMPRESSED_MODULE}'"
|
||||
--bt_path "${BT_ROOT_PATH}"
|
||||
--srcs "'${compressed_srcs}'"
|
||||
DEPENDS ${compressed_srcs_with_abs_path} ${PYTHON_SCRIPT}
|
||||
COMMENT "Log compression is being performed, please wait..."
|
||||
WORKING_DIRECTORY ${BT_ROOT_PATH}
|
||||
USES_TERMINAL
|
||||
)
|
||||
if(BLE_COMPRESSED_LIB_LOG_BUILD)
|
||||
execute_process(COMMAND ${BLE_PYTHON_EXECUTABLE} ${PYTHON_SCRIPT}
|
||||
compress
|
||||
--compressed_srcs_path "${LOG_COMPRESSED_SRCS_DIR}"
|
||||
--build_path "${CMAKE_BINARY_DIR}"
|
||||
--module "${LOG_COMPRESSED_MODULE}"
|
||||
--code_base_path "${CODE_BASE_PATH}"
|
||||
--srcs "${compressed_srcs}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_VARIABLE err)
|
||||
if(NOT ${result} EQUAL 0)
|
||||
message(WARNING "${err}")
|
||||
message(WARNING "Exit this log compression due to failure of compression")
|
||||
set(LOG_COMPRESS_INCLUDE_DIRS ${include_dirs} PARENT_SCOPE)
|
||||
set(LOG_COMPRESSION_TARGET "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
else()
|
||||
add_custom_target(ble_log_compression ALL
|
||||
COMMAND ${BLE_PYTHON_EXECUTABLE} ${PYTHON_SCRIPT}
|
||||
compress
|
||||
--compressed_srcs_path "${LOG_COMPRESSED_SRCS_DIR}"
|
||||
--build_path "${CMAKE_BINARY_DIR}"
|
||||
--module "'${LOG_COMPRESSED_MODULE}'"
|
||||
--code_base_path "${CODE_BASE_PATH}"
|
||||
--srcs "'${compressed_srcs}'"
|
||||
DEPENDS ${compressed_srcs_with_abs_path} ${PYTHON_SCRIPT}
|
||||
COMMENT "Log compression is being performed, please wait..."
|
||||
WORKING_DIRECTORY ${BT_ROOT_PATH}
|
||||
USES_TERMINAL
|
||||
)
|
||||
endif()
|
||||
|
||||
function(add_flags_if_in_list file file_list compile_flags)
|
||||
set(PROCESSED OFF PARENT_SCOPE)
|
||||
@@ -190,7 +240,10 @@ if(LOG_COMPRESSED_MODULE)
|
||||
set(LOG_COMPRESSION_TARGET ble_log_compression PARENT_SCOPE)
|
||||
# set(LOG_COMPRESSION_TARGET "" PARENT_SCOPE)
|
||||
set(LOG_COMPRESS_SRCS "${compressed_srcs_with_abs_path};${uncompressed_srcs}" PARENT_SCOPE)
|
||||
list(APPEND include_dirs "common/ble_log/extension/log_compression/include")
|
||||
if(NOT BLE_COMPRESSED_LIB_LOG_BUILD)
|
||||
list(APPEND include_dirs "common/ble_log/extension/log_compression/include")
|
||||
endif()
|
||||
list(APPEND include_dirs "${CMAKE_BINARY_DIR}/ble_log/include")
|
||||
set(LOG_COMPRESS_INCLUDE_DIRS ${include_dirs} PARENT_SCOPE)
|
||||
else()
|
||||
set(LOG_COMPRESSION_TARGET "" PARENT_SCOPE)
|
||||
|
||||
+56
-122
@@ -19,6 +19,7 @@ This script processes Bluetooth source files to compress logging statements.
|
||||
|
||||
import argparse
|
||||
import enum
|
||||
import importlib.util
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
@@ -33,6 +34,7 @@ from typing import Dict
|
||||
from typing import List
|
||||
from typing import Tuple
|
||||
from typing import Union
|
||||
from typing import cast
|
||||
|
||||
import tree_sitter_c as tsc
|
||||
import yaml
|
||||
@@ -72,10 +74,16 @@ CLANG_PARSER: Union[Parser, None] = None
|
||||
SOURCE_ENUM_MAP = {
|
||||
'BLE_HOST': 0,
|
||||
'BLE_MESH': 1,
|
||||
'BLE_MESH_LIB': 2,
|
||||
}
|
||||
|
||||
# Functions that require hex formatting
|
||||
HEX_FUNCTIONS = ['bt_hex'] # Used in Mesh and Audio modules
|
||||
HEX_FUNCTIONS = {
|
||||
# func_name: (arg_cnt, buf_idx, buf_len)
|
||||
# Negative buf_len indicates constant buffer size
|
||||
'bt_hex': (2, 0, 1), # Used in Mesh and Audio modules
|
||||
'MAC2STR': (1, 0, -6), # Used in Bluedroid Host
|
||||
}
|
||||
|
||||
# C keywords to exclude from function names
|
||||
C_KEYWORDS = {
|
||||
@@ -119,15 +127,6 @@ LINE_MACROS = {
|
||||
'__LINE__',
|
||||
}
|
||||
|
||||
BLUEDROID_LOG_MODE_LEVEL_GET = {
|
||||
'BTM': 'btm_cb.trace_level',
|
||||
'L2CAP': 'l2cb.l2cap_trace_level',
|
||||
'GAP': 'gap_cb.trace_level',
|
||||
'GATT': 'gatt_cb.trace_level',
|
||||
'SMP': 'smp_cb.trace_level',
|
||||
'APPL': 'appl_trace_level',
|
||||
}
|
||||
|
||||
|
||||
class ARG_SIZE_TYPE(enum.IntEnum):
|
||||
U32 = 0
|
||||
@@ -174,11 +173,12 @@ class LogCompressor:
|
||||
"""Main class for BLE log compression."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.bt_component_path = Path()
|
||||
self.code_base_path = Path()
|
||||
self.build_dir = Path()
|
||||
self.bt_compressed_srcs_path = Path()
|
||||
self.config: dict[str, Any] = {}
|
||||
self.module_info: dict[str, Any] = {}
|
||||
self.module_mod: dict[str, Any] = {}
|
||||
|
||||
def init_parser(self) -> Parser:
|
||||
"""Initialize tree-sitter parser for C."""
|
||||
@@ -371,15 +371,20 @@ class LogCompressor:
|
||||
if (
|
||||
arg_node.type == 'call_expression'
|
||||
and arg_node.child_by_field_name('function')
|
||||
and arg_node.child_by_field_name('function').text.decode('utf-8') in HEX_FUNCTIONS
|
||||
and arg_node.child_by_field_name('function').text.decode('utf-8') in HEX_FUNCTIONS.keys()
|
||||
):
|
||||
# Extract arguments of the hex function
|
||||
hex_func_name = arg_node.child_by_field_name('function').text.decode('utf-8')
|
||||
hex_args = arg_node.child_by_field_name('arguments')
|
||||
if hex_args and hex_args.named_child_count >= 2:
|
||||
buf_node = hex_args.named_children[0]
|
||||
len_node = hex_args.named_children[1]
|
||||
hex_func_info = HEX_FUNCTIONS[hex_func_name]
|
||||
if hex_args and hex_args.named_child_count == hex_func_info[0]:
|
||||
buf_node = hex_args.named_children[hex_func_info[1]].text.decode('utf-8')
|
||||
if hex_func_info[2] < 0:
|
||||
len_node = abs(hex_func_info[2])
|
||||
else:
|
||||
len_node = hex_args.named_children[hex_func_info[2]].text.decode('utf-8')
|
||||
token_list = list(token)
|
||||
token_list[6] = f'@hex_func@{buf_node.text.decode("utf-8")}@{len_node.text.decode("utf-8")}'
|
||||
token_list[6] = f'@hex_func@{buf_node}@{len_node}'
|
||||
tokens[tokens_tuple_map[i]] = tuple(token_list)
|
||||
|
||||
log_info['argu_tokens'] = tokens
|
||||
@@ -419,7 +424,7 @@ class LogCompressor:
|
||||
if (
|
||||
node.type == 'call_expression'
|
||||
and node.child_by_field_name('function')
|
||||
and node.child_by_field_name('function').text.decode('utf-8') in HEX_FUNCTIONS
|
||||
and node.child_by_field_name('function').text.decode('utf-8') in HEX_FUNCTIONS.keys()
|
||||
):
|
||||
return True
|
||||
|
||||
@@ -462,53 +467,6 @@ class LogCompressor:
|
||||
if not log_idx:
|
||||
return ''
|
||||
|
||||
def generate_mesh_log_prefix(source: str, tag: str, print_statm: str) -> str:
|
||||
level = tag.split('_')[-1]
|
||||
mod = tag.split('_')[0]
|
||||
if level == 'ERR':
|
||||
level = 'ERROR'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_ERROR'
|
||||
elif level == 'WARN':
|
||||
level = 'WARN'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_WARN'
|
||||
elif level == 'INFO':
|
||||
level = 'INFO'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_INFO'
|
||||
elif level == 'DBG':
|
||||
level = 'DEBUG'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_DEBUG'
|
||||
else:
|
||||
LOGGER.error(f'Invalid log level {level}')
|
||||
return ''
|
||||
if mod == 'NET':
|
||||
used_log_levl = 'BLE_MESH_NET_BUF_LOG_LEVEL'
|
||||
used_log_mod = 'BLE_MESH_NET_BUF'
|
||||
else:
|
||||
used_log_levl = 'BLE_MESH_LOG_LEVEL'
|
||||
used_log_mod = 'BLE_MESH'
|
||||
return (
|
||||
f'{{do {{ if (({used_log_levl} >= {log_level}) &&'
|
||||
f' BLE_MESH_LOG_LEVEL_CHECK({used_log_mod}, {level})) {print_statm};}} while (0);}}\\\n'
|
||||
)
|
||||
|
||||
def generate_bluedroid_log_prefix(source: str, tag: str, print_statm: str) -> str:
|
||||
tag_info = tag.split('_')
|
||||
mod = tag_info[0]
|
||||
|
||||
return (
|
||||
f'{{if ({BLUEDROID_LOG_MODE_LEVEL_GET[mod]} >= BT_TRACE_LEVEL_{tag_info[-1]} &&'
|
||||
f' BT_LOG_LEVEL_CHECK({mod}, {tag_info[-1]})) {print_statm};}}\\\n'
|
||||
)
|
||||
|
||||
def generate_log_lvl_prefix(source: str, tag: str, print_statm: str) -> str:
|
||||
if source == 'BLE_MESH':
|
||||
return ' ' + generate_mesh_log_prefix(source, tag, print_statm)
|
||||
elif source == 'BLE_HOST': # only bluedroid host supported for now
|
||||
return ' ' + generate_bluedroid_log_prefix(source, tag, print_statm)
|
||||
else:
|
||||
LOGGER.error(f'Unknown source {source}')
|
||||
return ''
|
||||
|
||||
source_value = SOURCE_ENUM_MAP.get(source.upper())
|
||||
if source_value is None:
|
||||
raise ValueError(f'Invalid source: {source}')
|
||||
@@ -551,41 +509,22 @@ class LogCompressor:
|
||||
else:
|
||||
sizes.append(f'{int(ARG_SIZE_TYPE.U32)}')
|
||||
|
||||
if arg_count > 0:
|
||||
size_str = ', '.join(sizes)
|
||||
arg_str = ', '.join(arguments).replace('\n', '')
|
||||
macro += generate_log_lvl_prefix(
|
||||
source,
|
||||
tag,
|
||||
(f'BLE_LOG_COMPRESSED_HEX_PRINT({source_value}, {log_idx}, {arg_count}, {size_str}, {arg_str})'),
|
||||
)
|
||||
stmt = self.module_mod[source].gen_compressed_stmt(
|
||||
log_idx,
|
||||
source_value,
|
||||
tag,
|
||||
log_info['arguments'][0],
|
||||
[{'name': arg, 'size_type': size_type} for arg, size_type in zip(arguments, sizes)],
|
||||
[
|
||||
{
|
||||
'buffer': hex_str.split('@')[2],
|
||||
'length': hex_str.split('@')[3],
|
||||
}
|
||||
for hex_str in hex_func
|
||||
],
|
||||
)
|
||||
macro += cast(str, stmt)
|
||||
|
||||
for idx, item in enumerate(hex_func):
|
||||
# hex_func format: @hex_func@buf@len
|
||||
parts = item.split('@')
|
||||
if len(parts) >= 4:
|
||||
buf = parts[2]
|
||||
buf_len = parts[3]
|
||||
macro += generate_log_lvl_prefix(
|
||||
source,
|
||||
tag,
|
||||
(f'BLE_LOG_COMPRESSED_HEX_PRINT_BUF({source_value}, {log_idx}, {idx}, {buf}, {buf_len})'),
|
||||
)
|
||||
else:
|
||||
macro += generate_log_lvl_prefix(
|
||||
source, tag, f'BLE_LOG_COMPRESSED_HEX_PRINT_WITH_ZERO_ARGUMENTS({source_value}, {log_idx})'
|
||||
)
|
||||
for idx, item in enumerate(hex_func):
|
||||
# hex_func format: @hex_func@buf@len
|
||||
parts = item.split('@')
|
||||
if len(parts) >= 4:
|
||||
buf = parts[2]
|
||||
buf_len = parts[3]
|
||||
macro += generate_log_lvl_prefix(
|
||||
source,
|
||||
tag,
|
||||
(f'BLE_LOG_COMPRESSED_HEX_PRINT_BUF({source_value}, {log_idx}, {idx}, {buf}, {buf_len})'),
|
||||
)
|
||||
if (
|
||||
'tags_with_preserve' in self.module_info[source]
|
||||
and tag in self.module_info[source]['tags_with_preserve']
|
||||
@@ -593,8 +532,7 @@ class LogCompressor:
|
||||
macro += f' {tag}(fmt, ##__VA_ARGS__);\\\n'
|
||||
else:
|
||||
# Non-hexified log
|
||||
print_fmt = print_fmt or 'NULL'
|
||||
macro += f' BLE_LOG_COMPRESSED_PRINT({source_value}, {log_idx}, "{print_fmt}", ##__VA_ARGS__); \\\n'
|
||||
raise ValueError('Hexify convert failed')
|
||||
|
||||
macro += '}\n'
|
||||
return macro
|
||||
@@ -716,7 +654,7 @@ class LogCompressor:
|
||||
total_cnt = 0
|
||||
for src in srcs:
|
||||
if pattern.match(src):
|
||||
src_path = self.bt_component_path / src
|
||||
src_path = self.code_base_path / src
|
||||
dest_path = self.bt_compressed_srcs_path / src
|
||||
temp_path = f'{dest_path}.tmp'
|
||||
total_cnt += 1
|
||||
@@ -754,7 +692,7 @@ class LogCompressor:
|
||||
module: Module name
|
||||
macros: List of (log_id, macro_definition)
|
||||
"""
|
||||
# header_path = self.bt_component_path / self.module_info[module]['log_index_path']
|
||||
# header_path = self.code_base_path / self.module_info[module]['log_index_path']
|
||||
header_path = self.build_dir / Path('ble_log') / Path('include') / self.module_info[module]['log_index_file']
|
||||
# Create directory if needed
|
||||
header_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
@@ -764,8 +702,7 @@ class LogCompressor:
|
||||
return
|
||||
elif update_state == self.db_manager.SOURCE_LOG_UPDATE_FULL:
|
||||
# Header template
|
||||
header_content = (
|
||||
textwrap.dedent(f"""
|
||||
header_content = textwrap.dedent(f"""
|
||||
/*
|
||||
* SPDX-FileCopyrightText: {datetime.now().year} Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
@@ -778,22 +715,11 @@ class LogCompressor:
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Compression function declarations
|
||||
extern int ble_log_compressed_hex_print
|
||||
(uint32_t source, uint32_t log_index, size_t args_size_cnt, ...);
|
||||
extern int ble_log_compressed_hex_print_buf
|
||||
(uint8_t source, uint32_t log_index, uint8_t buf_idx, const uint8_t *buf, size_t len);
|
||||
|
||||
// Compression macros
|
||||
#define BLE_LOG_COMPRESSED_HEX_PRINT(source, log_index, args_cnt, ...) \\
|
||||
ble_log_compressed_hex_print(source, log_index, args_cnt, ##__VA_ARGS__)
|
||||
#define BLE_LOG_COMPRESSED_HEX_PRINT_BUF(source, log_index, buf_idx, buf, len) \\
|
||||
ble_log_compressed_hex_print_buf(source, log_index, buf_idx, (const uint8_t *)buf, len)
|
||||
#define BLE_LOG_COMPRESSED_HEX_PRINT_WITH_ZERO_ARGUMENTS(source, log_index) \\
|
||||
ble_log_compressed_hex_print(source, log_index, 0)
|
||||
""").strip()
|
||||
+ '\n\n'
|
||||
)
|
||||
|
||||
header_content += self.module_mod[module].gen_header_head()
|
||||
header_content += '\n\n'
|
||||
|
||||
# Add sorted macros
|
||||
for log_id, macro_def in sorted(macros, key=lambda x: x[0]):
|
||||
header_content += macro_def + '\n'
|
||||
@@ -852,6 +778,14 @@ class LogCompressor:
|
||||
for module in module_names:
|
||||
if module in modules:
|
||||
self.module_info[module] = modules[module]
|
||||
module_script_path = self.module_info[module]['script']
|
||||
spec = self.module_mod[module] = importlib.util.spec_from_file_location(module, module_script_path)
|
||||
if spec and spec.loader:
|
||||
self.module_mod[module] = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(self.module_mod[module])
|
||||
else:
|
||||
LOGGER.error(f"Failed to load module '{module}' script")
|
||||
raise ImportError(' Failed to load module script')
|
||||
print(f'Found module {module} for compression\n', flush=True, end='', file=sys.stdout)
|
||||
else:
|
||||
LOGGER.warning(f"Skipping module '{module}' - config not found")
|
||||
@@ -863,7 +797,7 @@ class LogCompressor:
|
||||
|
||||
compress_parser = subparsers.add_parser('compress')
|
||||
compress_parser.add_argument('--srcs', required=True, help='Semicolon-separated source file paths')
|
||||
compress_parser.add_argument('--bt_path', required=True, help='Bluetooth component root path')
|
||||
compress_parser.add_argument('--code_base_path', required=True, help='Component base path')
|
||||
compress_parser.add_argument('--module', required=True, help='Semicolon-separated module names')
|
||||
compress_parser.add_argument('--build_path', required=True, help='Build output directory')
|
||||
compress_parser.add_argument('--compressed_srcs_path', required=True, help='Directory for processed sources')
|
||||
@@ -871,7 +805,7 @@ class LogCompressor:
|
||||
args = parser.parse_args()
|
||||
|
||||
# Setup paths
|
||||
self.bt_component_path = Path(args.bt_path)
|
||||
self.code_base_path = Path(args.code_base_path)
|
||||
self.build_dir = Path(args.build_path)
|
||||
self.bt_compressed_srcs_path = Path(args.compressed_srcs_path)
|
||||
|
||||
@@ -947,7 +881,7 @@ class LogCompressor:
|
||||
# Mark files as processed
|
||||
for module, info in self.module_info.items():
|
||||
for temp_path in info['files_to_process']:
|
||||
src_path = self.bt_component_path / os.path.relpath(temp_path[:-4], self.bt_compressed_srcs_path)
|
||||
src_path = self.code_base_path / os.path.relpath(temp_path[:-4], self.bt_compressed_srcs_path)
|
||||
db_manager.mark_file_processed(module, src_path, temp_path)
|
||||
for root, _, files in os.walk(self.bt_compressed_srcs_path):
|
||||
for name in files:
|
||||
|
||||
+10
@@ -6,6 +6,7 @@ log_config:
|
||||
description: "BLE Mesh"
|
||||
code_path: [@BLE_MESH_CODE_PATH@]
|
||||
log_index_file: @BLE_MESH_LOG_INDEX_HEADER@
|
||||
script: @BLE_MESH_LOG_SCRIPT_PATH@
|
||||
tags: [@BLE_MESH_TAGS@]
|
||||
tags_with_preserve: [@BLE_MESH_TAGS_PRESERVE@]
|
||||
|
||||
@@ -13,5 +14,14 @@ log_config:
|
||||
description: "BLE Host"
|
||||
code_path: [@HOST_CODE_PATH@]
|
||||
log_index_file: @HOST_LOG_INDEX_HEADER@
|
||||
script: @BLE_HOST_LOG_SCRIPT_PATH@
|
||||
tags: [@BLE_HOST_TAGS@]
|
||||
tags_with_preserve: [@BLE_HOST_TAGS_PRESERVE@]
|
||||
|
||||
@BLE_COMPRESSED_LIB_NAME@:
|
||||
description: "@BLE_COMPRESSED_LIB_DESC@"
|
||||
code_path: [@BLE_COMPRESSED_LIB_CODE_DIR@]
|
||||
log_index_file: @BLE_COMPRESSED_LIB_LOG_INDEX_HEADER@
|
||||
script: @BLE_COMPRESSED_LIB_LOG_SCRIPT_PATH@
|
||||
tags: [@BLE_COMPRESSED_LIB_LOG_TAGS@]
|
||||
tags_with_preserve: [@BLE_COMPRESSED_LIB_LOG_TAGS_PRESERVE@]
|
||||
|
||||
@@ -163,4 +163,5 @@ TYPES_MACRO_MAP = {
|
||||
'SCNoPTR': __PRIPTR_PREFIX + 'o',
|
||||
'SCNuPTR': __PRIPTR_PREFIX + 'u',
|
||||
'SCNxPTR': __PRIPTR_PREFIX + 'x',
|
||||
'MACSTR': '%s',
|
||||
}
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import textwrap
|
||||
|
||||
|
||||
def generate_mesh_log_prefix(tag: str, print_statm: str) -> str:
|
||||
level = tag.split('_')[-1]
|
||||
mod = tag.split('_')[0]
|
||||
if level == 'ERR':
|
||||
level = 'ERROR'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_ERROR'
|
||||
elif level == 'WARN':
|
||||
level = 'WARN'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_WARN'
|
||||
elif level == 'INFO':
|
||||
level = 'INFO'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_INFO'
|
||||
elif level == 'DBG':
|
||||
level = 'DEBUG'
|
||||
log_level = 'BLE_MESH_LOG_LEVEL_DEBUG'
|
||||
else:
|
||||
return ''
|
||||
if mod == 'NET':
|
||||
used_log_levl = 'BLE_MESH_NET_BUF_LOG_LEVEL'
|
||||
used_log_mod = 'BLE_MESH_NET_BUF'
|
||||
else:
|
||||
used_log_levl = 'BLE_MESH_LOG_LEVEL'
|
||||
used_log_mod = 'BLE_MESH'
|
||||
return (
|
||||
f'{{do {{ if (({used_log_levl} >= {log_level}) &&'
|
||||
f' BLE_MESH_LOG_LEVEL_CHECK({used_log_mod}, {level})) {print_statm};}} while (0);}}\\\n'
|
||||
)
|
||||
|
||||
|
||||
def gen_header_head() -> str:
|
||||
head = textwrap.dedent("""
|
||||
// Compression function declarations
|
||||
extern int ble_log_compressed_hex_print
|
||||
(uint8_t source, uint32_t log_index, size_t args_size_cnt, ...);
|
||||
extern int ble_log_compressed_hex_print_buf
|
||||
(uint8_t source, uint32_t log_index, uint8_t buf_idx, const uint8_t *buf, size_t len);
|
||||
""")
|
||||
return head
|
||||
|
||||
|
||||
def gen_compressed_stmt(
|
||||
log_index: int, module_id: int, func_name: str, fmt: str, args: list[dict], buffer_args: list[dict]
|
||||
) -> str:
|
||||
if len(args) == 0:
|
||||
stmt = f' ble_log_compressed_hex_print({module_id}, {log_index}, 0);'
|
||||
for idx, buffer_arg in enumerate(buffer_args):
|
||||
stmt += '\\\n'
|
||||
stmt += (
|
||||
f' ble_log_compressed_hex_print_buf('
|
||||
f'{module_id}, {log_index}, {idx}, '
|
||||
f'(const uint8_t *){buffer_arg["buffer"]}, {buffer_arg["length"]});'
|
||||
)
|
||||
stmt += '\\\n'
|
||||
return ' ' + generate_mesh_log_prefix(func_name, stmt)
|
||||
size_str = ', '.join([arg['size_type'] for arg in args])
|
||||
args_str = ', '.join([arg['name'] for arg in args]).replace('\n', '')
|
||||
stmt = f' ble_log_compressed_hex_print({module_id}, {log_index}, {len(args)}, {size_str}, {args_str});'
|
||||
for idx, buffer_arg in enumerate(buffer_args):
|
||||
stmt += '\\\n'
|
||||
stmt += (
|
||||
f' ble_log_compressed_hex_print_buf('
|
||||
f'{module_id}, {log_index}, {idx}, '
|
||||
f'(const uint8_t *){buffer_arg["buffer"]}, {buffer_arg["length"]});'
|
||||
)
|
||||
stmt += '\\\n'
|
||||
return ' ' + generate_mesh_log_prefix(func_name, stmt)
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import textwrap
|
||||
|
||||
BLUEDROID_LOG_MODE_LEVEL_GET = {
|
||||
'BTM': 'btm_cb.trace_level',
|
||||
'L2CAP': 'l2cb.l2cap_trace_level',
|
||||
'GAP': 'gap_cb.trace_level',
|
||||
'GATT': 'gatt_cb.trace_level',
|
||||
'SMP': 'smp_cb.trace_level',
|
||||
'APPL': 'appl_trace_level',
|
||||
}
|
||||
|
||||
|
||||
def generate_bluedroid_log_prefix(tag: str, print_statm: str) -> str:
|
||||
tag_info = tag.split('_')
|
||||
mod = tag_info[0]
|
||||
|
||||
return (
|
||||
f'{{if ({BLUEDROID_LOG_MODE_LEVEL_GET[mod]} >= BT_TRACE_LEVEL_{tag_info[-1]} &&'
|
||||
f' BT_LOG_LEVEL_CHECK({mod}, {tag_info[-1]})) {print_statm};}}\\\n'
|
||||
)
|
||||
|
||||
|
||||
def gen_header_head() -> str:
|
||||
head = textwrap.dedent("""
|
||||
// Compression function declarations
|
||||
extern int ble_log_compressed_hex_print
|
||||
(uint8_t source, uint32_t log_index, size_t args_size_cnt, ...);
|
||||
extern int ble_log_compressed_hex_print_buf
|
||||
(uint8_t source, uint32_t log_index, uint8_t buf_idx, const uint8_t *buf, size_t len);
|
||||
""")
|
||||
return head
|
||||
|
||||
|
||||
def gen_compressed_stmt(
|
||||
log_index: int, module_id: int, func_name: str, fmt: str, args: list[dict], buffer_args: list[dict]
|
||||
) -> str:
|
||||
if len(args) == 0:
|
||||
stmt = f' ble_log_compressed_hex_print({module_id},{log_index}, 0);'
|
||||
for idx, buffer_arg in enumerate(buffer_args):
|
||||
stmt += '\\\n'
|
||||
stmt += (
|
||||
f' ble_log_compressed_hex_print_buf('
|
||||
f'{module_id}, {log_index}, {idx}, '
|
||||
f'(const uint8_t *){buffer_arg["buffer"]}, {buffer_arg["length"]});'
|
||||
)
|
||||
stmt += '\\\n'
|
||||
return ' ' + generate_bluedroid_log_prefix(func_name, stmt)
|
||||
size_str = ', '.join([arg['size_type'] for arg in args])
|
||||
args_str = ', '.join([arg['name'] for arg in args]).replace('\n', '')
|
||||
stmt = f' ble_log_compressed_hex_print({module_id},{log_index}, {len(args)}, {size_str}, {args_str});'
|
||||
for idx, buffer_arg in enumerate(buffer_args):
|
||||
stmt += '\\\n'
|
||||
stmt += (
|
||||
f' ble_log_compressed_hex_print_buf('
|
||||
f'{module_id}, {log_index}, {idx}, '
|
||||
f'(const uint8_t *){buffer_arg["buffer"]}, {buffer_arg["length"]});'
|
||||
)
|
||||
stmt += '\\\n'
|
||||
return ' ' + generate_bluedroid_log_prefix(func_name, stmt)
|
||||
@@ -107,7 +107,8 @@ void ble_log_lbm_write_trans(ble_log_prph_trans_t **trans, ble_log_src_t src_cod
|
||||
}
|
||||
if (len_append) {
|
||||
#if CONFIG_SOC_ESP_NIMBLE_CONTROLLER
|
||||
if (omdata) {
|
||||
if (omdata && !BLE_LOG_IN_ISR()) {
|
||||
/* os_mbuf_copydata is in flash and not safe to call from ISR */
|
||||
os_mbuf_copydata((struct os_mbuf *)addr_append, 0,
|
||||
len_append, buf + BLE_LOG_FRAME_HEAD_LEN + len);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,15 @@ BLE_LOG_STATIC TaskHandle_t rt_task_handle = NULL;
|
||||
BLE_LOG_STATIC QueueHandle_t rt_queue_handle = NULL;
|
||||
#if CONFIG_BLE_LOG_TS_ENABLED
|
||||
BLE_LOG_STATIC bool rt_ts_enabled = false;
|
||||
#if CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER
|
||||
BLE_LOG_STATIC esp_timer_handle_t rt_ts_timer = NULL;
|
||||
#endif /* CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER */
|
||||
#endif /* CONFIG_BLE_LOG_TS_ENABLED */
|
||||
|
||||
/* PRIVATE FUNCTION DECLARATION */
|
||||
#if CONFIG_BLE_LOG_TS_ENABLED
|
||||
BLE_LOG_STATIC void ble_log_rt_task(void *pvParameters);
|
||||
BLE_LOG_STATIC void ble_log_rt_ts_trigger(void *arg);
|
||||
#endif /* CONFIG_BLE_LOG_TS_ENABLED */
|
||||
|
||||
/* PRIVATE FUNCTION */
|
||||
@@ -56,15 +65,9 @@ BLE_LOG_IRAM_ATTR BLE_LOG_STATIC void ble_log_rt_task(void *pvParameters)
|
||||
};
|
||||
ble_log_write_hex(BLE_LOG_SRC_INTERNAL, (const uint8_t *)&ble_log_info, sizeof(ble_log_info_t));
|
||||
|
||||
#if CONFIG_BLE_LOG_TS_ENABLED
|
||||
if (rt_ts_enabled) {
|
||||
ble_log_ts_info_t *ts_info = NULL;
|
||||
ble_log_ts_info_update(&ts_info);
|
||||
if (ts_info) {
|
||||
ble_log_write_hex(BLE_LOG_SRC_INTERNAL, (const uint8_t *)ts_info, sizeof(ble_log_ts_info_t));
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BLE_LOG_TS_ENABLED */
|
||||
#if CONFIG_BLE_LOG_TS_TRIGGER_TASK_EVENT
|
||||
ble_log_rt_ts_trigger(NULL);
|
||||
#endif /* CONFIG_BLE_LOG_TS_TRIGGER_TASK_EVENT */
|
||||
|
||||
#if CONFIG_BLE_LOG_ENH_STAT_ENABLED
|
||||
ble_log_write_enh_stat();
|
||||
@@ -72,6 +75,24 @@ BLE_LOG_IRAM_ATTR BLE_LOG_STATIC void ble_log_rt_task(void *pvParameters)
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_BLE_LOG_TS_ENABLED
|
||||
#if CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER_ISR_DISPATCH_METHOD
|
||||
BLE_LOG_IRAM_ATTR
|
||||
#endif /* CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER_ISR_DISPATCH_METHOD */
|
||||
BLE_LOG_STATIC void ble_log_rt_ts_trigger(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
if (!rt_inited || !rt_ts_enabled) {
|
||||
return;
|
||||
}
|
||||
ble_log_ts_info_t *ts_info = NULL;
|
||||
ble_log_ts_info_update(&ts_info);
|
||||
if (ts_info) {
|
||||
ble_log_write_hex(BLE_LOG_SRC_INTERNAL, (const uint8_t *)ts_info, sizeof(ble_log_ts_info_t));
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BLE_LOG_TS_ENABLED */
|
||||
|
||||
/* INTERFACE */
|
||||
bool ble_log_rt_init(void)
|
||||
{
|
||||
@@ -92,10 +113,28 @@ bool ble_log_rt_init(void)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
rt_inited = true;
|
||||
#if CONFIG_BLE_LOG_TS_ENABLED
|
||||
rt_ts_enabled = false;
|
||||
#if CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER
|
||||
/* Initialize ESP Timer Trigger */
|
||||
esp_timer_create_args_t ts_timer_args = {
|
||||
.callback = ble_log_rt_ts_trigger,
|
||||
.arg = NULL,
|
||||
#if CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER_ISR_DISPATCH_METHOD
|
||||
.dispatch_method = ESP_TIMER_ISR,
|
||||
#endif /* CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER_ISR_DISPATCH_METHOD */
|
||||
.name = "ble_log_ts_timer",
|
||||
};
|
||||
if (esp_timer_create(&ts_timer_args, &rt_ts_timer) != ESP_OK) {
|
||||
goto exit;
|
||||
}
|
||||
if (esp_timer_start_periodic(rt_ts_timer, BLE_LOG_TS_TRIGGER_TIMEOUT_US) != ESP_OK) {
|
||||
goto exit;
|
||||
}
|
||||
#endif /* CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER */
|
||||
#endif /* CONFIG_BLE_LOG_TS_ENABLED */
|
||||
|
||||
rt_inited = true;
|
||||
return true;
|
||||
|
||||
exit:
|
||||
@@ -108,6 +147,13 @@ void ble_log_rt_deinit(void)
|
||||
rt_inited = false;
|
||||
#if CONFIG_BLE_LOG_TS_ENABLED
|
||||
rt_ts_enabled = false;
|
||||
#if CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER
|
||||
if (rt_ts_timer) {
|
||||
esp_timer_stop(rt_ts_timer);
|
||||
esp_timer_delete(rt_ts_timer);
|
||||
rt_ts_timer = NULL;
|
||||
}
|
||||
#endif /* CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER */
|
||||
#endif /* CONFIG_BLE_LOG_TS_ENABLED */
|
||||
|
||||
/* CRITICAL:
|
||||
|
||||
@@ -61,6 +61,9 @@ void ble_log_ts_deinit(void)
|
||||
gpio_reset_pin(CONFIG_BLE_LOG_SYNC_IO_NUM);
|
||||
}
|
||||
|
||||
#if CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER_ISR_DISPATCH_METHOD
|
||||
BLE_LOG_IRAM_ATTR
|
||||
#endif /* CONFIG_BLE_LOG_TS_TRIGGER_ESP_TIMER_ISR_DISPATCH_METHOD */
|
||||
void ble_log_ts_info_update(ble_log_ts_info_t **info)
|
||||
{
|
||||
if (!ts_inited) {
|
||||
|
||||
@@ -20,7 +20,8 @@ portMUX_TYPE ble_log_spin_lock = portMUX_INITIALIZER_UNLOCKED;
|
||||
#if CONFIG_BLE_LOG_XOR_CHECKSUM_ENABLED
|
||||
#include "esp_compiler.h"
|
||||
|
||||
static inline uint32_t ror32(uint32_t word, uint32_t shift)
|
||||
BLE_LOG_IRAM_ATTR BLE_LOG_STATIC BLE_LOG_INLINE
|
||||
uint32_t ror32(uint32_t word, uint32_t shift)
|
||||
{
|
||||
if (unlikely(shift == 0)) {
|
||||
return word;
|
||||
|
||||
@@ -22,7 +22,12 @@
|
||||
/* MACRO */
|
||||
#define BLE_LOG_TASK_PRIO (ESP_TASK_PRIO_MAX - 1)
|
||||
#define BLE_LOG_TASK_STACK_SIZE CONFIG_BLE_LOG_TASK_STACK_SIZE
|
||||
#if CONFIG_BLE_LOG_TS_ENABLED
|
||||
#define BLE_LOG_TS_TRIGGER_TIMEOUT_US (CONFIG_BLE_LOG_TS_TRIGGER_TIMEOUT_MS * 1000)
|
||||
#define BLE_LOG_TASK_HOOK_TIMEOUT_MS CONFIG_BLE_LOG_TS_TRIGGER_TIMEOUT_MS
|
||||
#else /* !CONFIG_BLE_LOG_TS_ENABLED */
|
||||
#define BLE_LOG_TASK_HOOK_TIMEOUT_MS (1000)
|
||||
#endif /* CONFIG_BLE_LOG_TS_ENABLED */
|
||||
|
||||
/* INTERFACE */
|
||||
bool ble_log_rt_init();
|
||||
|
||||
@@ -225,6 +225,10 @@ esp_err_t IRAM_ATTR bt_hci_log_record_data(bt_hci_log_t *p_hci_log_ctl, char *st
|
||||
ts = esp_timer_get_time();
|
||||
|
||||
temp_buf = (uint8_t *)malloc(data_len + 8);
|
||||
if (!temp_buf) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
memset(temp_buf, 0x0, data_len + 8);
|
||||
|
||||
memcpy(temp_buf, &ts, 8);
|
||||
|
||||
@@ -61,6 +61,22 @@
|
||||
#define HEAP_MEMORY_DEBUG FALSE
|
||||
#endif
|
||||
|
||||
#if UC_BT_BLUEDROID_MEM_STATS
|
||||
#define HEAP_MEMORY_STATS TRUE
|
||||
#else
|
||||
#define HEAP_MEMORY_STATS FALSE
|
||||
#endif
|
||||
|
||||
#if UC_BT_BLUEDROID_THREAD_DEBUG
|
||||
#define OSI_THREAD_DEBUG TRUE
|
||||
#else
|
||||
#define OSI_THREAD_DEBUG FALSE
|
||||
#endif
|
||||
|
||||
#define OSI_THREAD_BLOCK_TIME UC_BT_BLUEDROID_THREAD_BLOCK_TIME
|
||||
|
||||
#define OSI_THREAD_BLOCK_MSG UC_BT_BLUEDROID_THREAD_BLOCK_MSG
|
||||
|
||||
#ifndef BT_BLE_DYNAMIC_ENV_MEMORY
|
||||
#define BT_BLE_DYNAMIC_ENV_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
@@ -107,6 +107,30 @@
|
||||
#define UC_BT_BLUEDROID_MEM_DEBUG FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_MEM_STATS
|
||||
#define UC_BT_BLUEDROID_MEM_STATS TRUE
|
||||
#else
|
||||
#define UC_BT_BLUEDROID_MEM_STATS FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_THREAD_DEBUG
|
||||
#define UC_BT_BLUEDROID_THREAD_DEBUG TRUE
|
||||
#else
|
||||
#define UC_BT_BLUEDROID_THREAD_DEBUG FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_THREAD_BLOCK_TIME
|
||||
#define UC_BT_BLUEDROID_THREAD_BLOCK_TIME CONFIG_BT_BLUEDROID_THREAD_BLOCK_TIME
|
||||
#else
|
||||
#define UC_BT_BLUEDROID_THREAD_BLOCK_TIME 1000
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_THREAD_BLOCK_MSG
|
||||
#define UC_BT_BLUEDROID_THREAD_BLOCK_MSG CONFIG_BT_BLUEDROID_THREAD_BLOCK_MSG
|
||||
#else
|
||||
#define UC_BT_BLUEDROID_THREAD_BLOCK_MSG 50
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
|
||||
#define UC_HEAP_ALLOCATION_FROM_SPIRAM_FIRST CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST
|
||||
#else
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
#if HEAP_MEMORY_STATS
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
#endif
|
||||
|
||||
extern void *pvPortZalloc(size_t size);
|
||||
extern void vPortFree(void *pv);
|
||||
@@ -198,6 +204,28 @@ uint32_t osi_mem_dbg_get_max_size_section(uint8_t index)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
static size_t s_mem_used_size = 0;
|
||||
static SemaphoreHandle_t s_mem_mutex = NULL;
|
||||
|
||||
int osi_mem_init(void)
|
||||
{
|
||||
s_mem_mutex = xSemaphoreCreateMutex();
|
||||
if (s_mem_mutex == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void osi_mem_deinit(void)
|
||||
{
|
||||
if (s_mem_mutex) {
|
||||
vSemaphoreDelete(s_mem_mutex);
|
||||
s_mem_mutex = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
char *osi_strdup(const char *str)
|
||||
{
|
||||
size_t size = strlen(str) + 1; // + 1 for the null terminator
|
||||
@@ -216,12 +244,23 @@ void *osi_malloc_func(size_t size)
|
||||
void *p = osi_malloc_base(size);
|
||||
|
||||
if (size != 0 && p == NULL) {
|
||||
OSI_TRACE_ERROR("malloc failed (caller=%p size=%u)\n", __builtin_return_address(0), size);
|
||||
OSI_TRACE_ERROR("malloc failed (caller=%p size=%u)", __builtin_return_address(0), size);
|
||||
OSI_TRACE_ERROR("heap info: free=%d, largest_block=%d",
|
||||
heap_caps_get_free_size(MALLOC_CAP_DEFAULT), heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT));
|
||||
#if HEAP_ALLOCATION_FAILS_ABORT
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
if (s_mem_mutex != NULL && p != NULL) {
|
||||
size_t alloc_size = heap_caps_get_allocated_size(p);
|
||||
xSemaphoreTake(s_mem_mutex, portMAX_DELAY);
|
||||
s_mem_used_size += alloc_size;
|
||||
xSemaphoreGive(s_mem_mutex);
|
||||
}
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -230,16 +269,53 @@ void *osi_calloc_func(size_t size)
|
||||
void *p = osi_calloc_base(size);
|
||||
|
||||
if (size != 0 && p == NULL) {
|
||||
OSI_TRACE_ERROR("calloc failed (caller=%p size=%u)\n", __builtin_return_address(0), size);
|
||||
OSI_TRACE_ERROR("calloc failed (caller=%p size=%u)", __builtin_return_address(0), size);
|
||||
OSI_TRACE_ERROR("heap info: free=%d, largest_block=%d",
|
||||
heap_caps_get_free_size(MALLOC_CAP_DEFAULT), heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT));
|
||||
#if HEAP_ALLOCATION_FAILS_ABORT
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
if (s_mem_mutex != NULL && p != NULL) {
|
||||
size_t alloc_size = heap_caps_get_allocated_size(p);
|
||||
xSemaphoreTake(s_mem_mutex, portMAX_DELAY);
|
||||
s_mem_used_size += alloc_size;
|
||||
xSemaphoreGive(s_mem_mutex);
|
||||
}
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void osi_free_func(void *ptr)
|
||||
{
|
||||
osi_free(ptr);
|
||||
#if HEAP_MEMORY_DEBUG
|
||||
osi_mem_dbg_clean(ptr, __func__, __LINE__);
|
||||
#endif
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
if (s_mem_mutex != NULL && ptr != NULL) {
|
||||
size_t free_size = heap_caps_get_allocated_size(ptr);
|
||||
xSemaphoreTake(s_mem_mutex, portMAX_DELAY);
|
||||
if (s_mem_used_size >= free_size) {
|
||||
s_mem_used_size -= free_size;
|
||||
} else {
|
||||
OSI_TRACE_ERROR("The size of malloc and free not match: alloc_size=%u free_size=%u",
|
||||
s_mem_used_size, free_size);
|
||||
}
|
||||
xSemaphoreGive(s_mem_mutex);
|
||||
}
|
||||
#endif
|
||||
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
// Get the size of memory allocated by Bluedroid but not yet freed
|
||||
uint32_t esp_host_used_heap_size_get(void)
|
||||
{
|
||||
return s_mem_used_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -21,8 +21,13 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include "bt_common.h"
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
int osi_mem_init(void);
|
||||
void osi_mem_deinit(void);
|
||||
#endif
|
||||
char *osi_strdup(const char *str);
|
||||
|
||||
void *osi_malloc_func(size_t size);
|
||||
@@ -108,7 +113,7 @@ do { \
|
||||
// Memory alloc function with print and assertion when fails
|
||||
#define osi_malloc(size) osi_malloc_func((size))
|
||||
#define osi_calloc(size) osi_calloc_func((size))
|
||||
#define osi_free(p) free((p))
|
||||
#define osi_free(p) osi_free_func((p))
|
||||
|
||||
#endif /* HEAP_MEMORY_DEBUG */
|
||||
|
||||
|
||||
@@ -65,10 +65,15 @@ void osi_mutex_unlock(osi_mutex_t *mutex)
|
||||
xSemaphoreGive(*mutex);
|
||||
}
|
||||
|
||||
/** Delete a semaphore
|
||||
* @param mutex the mutex to delete */
|
||||
/** Delete a mutex
|
||||
* @param mutex the mutex to delete
|
||||
* Note: Safe to call with NULL or uninitialized mutex (IDFGH-16853)
|
||||
*/
|
||||
void osi_mutex_free(osi_mutex_t *mutex)
|
||||
{
|
||||
if (mutex == NULL || *mutex == NULL) {
|
||||
return;
|
||||
}
|
||||
vSemaphoreDelete(*mutex);
|
||||
*mutex = NULL;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ struct pkt_queue {
|
||||
|
||||
struct pkt_queue *pkt_queue_create(void)
|
||||
{
|
||||
struct pkt_queue *queue = calloc(1, sizeof(struct pkt_queue));
|
||||
struct pkt_queue *queue = osi_calloc(sizeof(struct pkt_queue));
|
||||
if (queue == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -69,9 +69,15 @@ osi_sem_take(osi_sem_t *sem, uint32_t timeout)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Deallocates a semaphore
|
||||
/** Deallocates a semaphore
|
||||
* @param sem the semaphore to delete
|
||||
* Note: Safe to call with NULL or uninitialized semaphore (IDFGH-16853)
|
||||
*/
|
||||
void osi_sem_free(osi_sem_t *sem)
|
||||
{
|
||||
if (sem == NULL || *sem == NULL) {
|
||||
return;
|
||||
}
|
||||
vSemaphoreDelete(*sem);
|
||||
*sem = NULL;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ struct osi_event {
|
||||
|
||||
static const size_t DEFAULT_WORK_QUEUE_CAPACITY = 100;
|
||||
|
||||
#if OSI_THREAD_DEBUG
|
||||
static void osi_thread_run_item(osi_thread_t *thread, int wq_idx, struct work_item *item);
|
||||
#endif
|
||||
|
||||
static struct work_queue *osi_work_queue_create(size_t capacity)
|
||||
{
|
||||
if (capacity == 0) {
|
||||
@@ -162,7 +166,11 @@ static void osi_thread_run(void *arg)
|
||||
struct work_item item;
|
||||
while (!thread->stop && idx < thread->work_queue_num) {
|
||||
if (osi_thead_work_queue_get(thread->work_queues[idx], &item) == true) {
|
||||
#if OSI_THREAD_DEBUG
|
||||
osi_thread_run_item(thread, idx, &item);
|
||||
#else
|
||||
item.func(item.context);
|
||||
#endif
|
||||
idx = 0;
|
||||
continue;
|
||||
} else {
|
||||
@@ -451,3 +459,45 @@ bool osi_thread_post_event(struct osi_event *event, uint32_t timeout)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if OSI_THREAD_DEBUG
|
||||
static void osi_thread_run_item(osi_thread_t *thread, int wq_idx, struct work_item *item)
|
||||
{
|
||||
uint32_t pre_time;
|
||||
uint32_t pre_msg_cnt;
|
||||
uint32_t cur_time;
|
||||
uint32_t cur_msg_cnt;
|
||||
|
||||
pre_time = esp_log_timestamp();
|
||||
pre_msg_cnt = uxQueueMessagesWaiting(thread->work_queues[wq_idx]->queue);
|
||||
item->func(item->context);
|
||||
cur_time = esp_log_timestamp();
|
||||
cur_msg_cnt = uxQueueMessagesWaiting(thread->work_queues[wq_idx]->queue);
|
||||
if ((cur_time - pre_time) >= OSI_THREAD_BLOCK_TIME ||
|
||||
(cur_msg_cnt > pre_msg_cnt && (cur_msg_cnt - pre_msg_cnt) >= OSI_THREAD_BLOCK_MSG)) {
|
||||
OSI_TRACE_ERROR("%s was blocked while running item: %p exec_time=[%u %u] msg_inc=[%u %u]",
|
||||
pcTaskGetName(thread->thread_handle), item->func, cur_time, pre_time, cur_msg_cnt, pre_msg_cnt);
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
void osi_thread_workqueue_dump(osi_thread_t *thread)
|
||||
{
|
||||
int idx = 0;
|
||||
struct work_item item;
|
||||
|
||||
vTaskSuspendAll();
|
||||
|
||||
while (idx < thread->work_queue_num) {
|
||||
if (osi_thead_work_queue_get(thread->work_queues[idx], &item) == true) {
|
||||
esp_rom_printf("[%u] %p %p\n", idx, item.func, item.context);
|
||||
idx = 0;
|
||||
continue;
|
||||
} else {
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
xTaskResumeAll();
|
||||
}
|
||||
#endif // OSI_THREAD_DEBUG
|
||||
|
||||
@@ -232,6 +232,10 @@ static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
static bool esp_bt_check_wakeup_by_bt(void);
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
#include "tinycrypt/ecc.h"
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@@ -1024,6 +1028,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "hci transport init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
uECC_set_rng(ecc_rand_func);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
@@ -1457,6 +1464,29 @@ static mbedtls_ecp_keypair keypair;
|
||||
#if CONFIG_BT_LE_SM_SC
|
||||
#include "tinycrypt/cmac_mode.h"
|
||||
#include "tinycrypt/ecc_dh.h"
|
||||
|
||||
|
||||
#if CONFIG_BT_CONTROLLER_ONLY
|
||||
/* Used by uECC to get random data */
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len)
|
||||
{
|
||||
int offset_cnt = 0;
|
||||
uint8_t *u8ptr = dst;
|
||||
uint64_t random64 = 0;
|
||||
|
||||
while(len > 0) {
|
||||
random64 = (uint64_t)esp_random();
|
||||
random64 = (random64 << 32)| (uint64_t)esp_random();;
|
||||
offset_cnt = len < sizeof(uint64_t) ? len : sizeof(uint64_t);
|
||||
memcpy(u8ptr, &random64, offset_cnt);
|
||||
len -= offset_cnt;
|
||||
u8ptr += offset_cnt;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_CONTROLLER_ONLY
|
||||
#endif // CONFIG_BT_LE_SM_SC
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
|
||||
@@ -1548,11 +1578,11 @@ exit:
|
||||
}
|
||||
|
||||
#else
|
||||
if (uECC_valid_public_key(pk, &curve_secp256r1) < 0) {
|
||||
if (uECC_valid_public_key(pk, uECC_secp256r1()) < 0) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
|
||||
rc = uECC_shared_secret(pk, priv, dh, &curve_secp256r1);
|
||||
rc = uECC_shared_secret(pk, priv, dh, uECC_secp256r1());
|
||||
if (rc == TC_CRYPTO_FAIL) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
@@ -1628,7 +1658,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#else
|
||||
if (uECC_make_key(pk, priv, &curve_secp256r1) != TC_CRYPTO_SUCCESS) {
|
||||
if (uECC_make_key(pk, priv, uECC_secp256r1()) != TC_CRYPTO_SUCCESS) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
|
||||
@@ -951,3 +951,11 @@ config BT_LE_CTRL_SLV_FAST_RX_CONN_DATA_EN
|
||||
When this option is enabled, the Controller continues receiving PDUs
|
||||
In the next connection event instead of entering latency
|
||||
After a data packet is received.
|
||||
|
||||
config BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN
|
||||
bool "Enables the automatic initiation of a data length update(Experimental)."
|
||||
default n
|
||||
help
|
||||
When this option is enabled, the Controller automatically initiates a data length update
|
||||
Using the appropriate data length parameters
|
||||
When a PHY update or a connection interval update occurs.
|
||||
|
||||
@@ -180,6 +180,7 @@ extern int r_ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_c
|
||||
extern char *ble_controller_get_compile_version(void);
|
||||
extern int esp_ble_register_bb_funcs(void);
|
||||
extern void esp_ble_unregister_bb_funcs(void);
|
||||
extern bool esp_ble_controller_lib_check(void);
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
@@ -218,6 +219,10 @@ static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
static bool esp_bt_check_wakeup_by_bt(void);
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
#include "tinycrypt/ecc.h"
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@@ -1121,6 +1126,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
if (!esp_ble_controller_lib_check()) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Controller lib version mismatch!");
|
||||
}
|
||||
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
uECC_set_rng(ecc_rand_func);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
@@ -1594,6 +1606,26 @@ static mbedtls_ecp_keypair keypair;
|
||||
#if CONFIG_BT_LE_SM_SC
|
||||
#include "tinycrypt/cmac_mode.h"
|
||||
#include "tinycrypt/ecc_dh.h"
|
||||
#if CONFIG_BT_CONTROLLER_ONLY
|
||||
/* Used by uECC to get random data */
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len)
|
||||
{
|
||||
int offset_cnt = 0;
|
||||
uint8_t *u8ptr = dst;
|
||||
uint64_t random64 = 0;
|
||||
|
||||
while(len > 0) {
|
||||
random64 = (uint64_t)esp_random();
|
||||
random64 = (random64 << 32)| (uint64_t)esp_random();;
|
||||
offset_cnt = len < sizeof(uint64_t) ? len : sizeof(uint64_t);
|
||||
memcpy(u8ptr, &random64, offset_cnt);
|
||||
len -= offset_cnt;
|
||||
u8ptr += offset_cnt;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_ONLY
|
||||
#endif // CONFIG_BT_LE_SM_SC
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
|
||||
@@ -1685,11 +1717,11 @@ exit:
|
||||
}
|
||||
|
||||
#else
|
||||
if (uECC_valid_public_key(pk, &curve_secp256r1) < 0) {
|
||||
if (uECC_valid_public_key(pk, uECC_secp256r1()) < 0) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
|
||||
rc = uECC_shared_secret(pk, priv, dh, &curve_secp256r1);
|
||||
rc = uECC_shared_secret(pk, priv, dh, uECC_secp256r1());
|
||||
if (rc == TC_CRYPTO_FAIL) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
@@ -1765,7 +1797,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#else
|
||||
if (uECC_make_key(pk, priv, &curve_secp256r1) != TC_CRYPTO_SUCCESS) {
|
||||
if (uECC_make_key(pk, priv, uECC_secp256r1()) != TC_CRYPTO_SUCCESS) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
|
||||
@@ -215,6 +215,13 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_CTRL_SLV_FAST_RX_CONN_DATA_EN (0)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CONFIG_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN)
|
||||
#define DEFAULT_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN (CONFIG_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
#else
|
||||
|
||||
@@ -985,3 +985,11 @@ config BT_LE_CTRL_SLV_FAST_RX_CONN_DATA_EN
|
||||
When this option is enabled, the Controller continues receiving PDUs
|
||||
In the next connection event instead of entering latency
|
||||
After a data packet is received.
|
||||
|
||||
config BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN
|
||||
bool "Enables the automatic initiation of a data length update(Experimental)."
|
||||
default n
|
||||
help
|
||||
When this option is enabled, the Controller automatically initiates a data length update
|
||||
Using the appropriate data length parameters
|
||||
When a PHY update or a connection interval update occurs.
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "ble_priv.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_pm.h"
|
||||
#ifdef CONFIG_ESP_PHY_ENABLED
|
||||
@@ -133,7 +133,6 @@ typedef union {
|
||||
};
|
||||
uint32_t val;
|
||||
} bt_wakeup_params_t;
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
@@ -192,6 +191,7 @@ extern int r_ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_c
|
||||
extern char *ble_controller_get_compile_version(void);
|
||||
extern int esp_ble_register_bb_funcs(void);
|
||||
extern void esp_ble_unregister_bb_funcs(void);
|
||||
extern bool esp_ble_controller_lib_check(void);
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
@@ -233,6 +233,11 @@ static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
static bool esp_bt_check_wakeup_by_bt(void);
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
#include "tinycrypt/ecc.h"
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@@ -1055,6 +1060,7 @@ static void ble_rtc_clk_init(esp_bt_controller_config_t *cfg)
|
||||
esp_bt_rtc_slow_clk_select(s_bt_lpclk_src);
|
||||
}
|
||||
|
||||
|
||||
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
{
|
||||
uint8_t mac[6];
|
||||
@@ -1191,6 +1197,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
if (!esp_ble_controller_lib_check()) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Controller lib version mismatch!");
|
||||
}
|
||||
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
uECC_set_rng(ecc_rand_func);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
@@ -1443,7 +1456,6 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
esp_bt_controller_status_t esp_bt_controller_get_status(void)
|
||||
{
|
||||
return ble_controller_status;
|
||||
@@ -1664,6 +1676,27 @@ static mbedtls_ecp_keypair keypair;
|
||||
#if CONFIG_BT_LE_SM_SC
|
||||
#include "tinycrypt/cmac_mode.h"
|
||||
#include "tinycrypt/ecc_dh.h"
|
||||
|
||||
#if CONFIG_BT_CONTROLLER_ONLY
|
||||
/* Used by uECC to get random data */
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len)
|
||||
{
|
||||
int offset_cnt = 0;
|
||||
uint8_t *u8ptr = dst;
|
||||
uint64_t random64 = 0;
|
||||
|
||||
while(len > 0) {
|
||||
random64 = (uint64_t)esp_random();
|
||||
random64 = (random64 << 32)| (uint64_t)esp_random();;
|
||||
offset_cnt = len < sizeof(uint64_t) ? len : sizeof(uint64_t);
|
||||
memcpy(u8ptr, &random64, offset_cnt);
|
||||
len -= offset_cnt;
|
||||
u8ptr += offset_cnt;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_ONLY
|
||||
#endif // CONFIG_BT_LE_SM_SC
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
|
||||
@@ -1755,11 +1788,11 @@ exit:
|
||||
}
|
||||
|
||||
#else
|
||||
if (uECC_valid_public_key(pk, &curve_secp256r1) < 0) {
|
||||
if (uECC_valid_public_key(pk, uECC_secp256r1()) < 0) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
|
||||
rc = uECC_shared_secret(pk, priv, dh, &curve_secp256r1);
|
||||
rc = uECC_shared_secret(pk, priv, dh, uECC_secp256r1());
|
||||
if (rc == TC_CRYPTO_FAIL) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
@@ -1835,7 +1868,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#else
|
||||
if (uECC_make_key(pk, priv, &curve_secp256r1) != TC_CRYPTO_SUCCESS) {
|
||||
if (uECC_make_key(pk, priv, uECC_secp256r1()) != TC_CRYPTO_SUCCESS) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
@@ -1851,7 +1884,6 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
|
||||
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
|
||||
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||
|
||||
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
#include "esp_gdbstub.h"
|
||||
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
|
||||
@@ -218,6 +218,13 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_CTRL_SLV_FAST_RX_CONN_DATA_EN (0)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CONFIG_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN)
|
||||
#define DEFAULT_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN (CONFIG_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
#else
|
||||
@@ -307,7 +314,6 @@ extern "C" {
|
||||
#define RUN_QA_TEST (0)
|
||||
#define NIMBLE_DISABLE_SCAN_BACKOFF (0)
|
||||
#define BT_LL_CTRL_PRIO_LVL_CFG ((CONFIG_BT_LE_DFT_SYNC_SCHED_PRIO_LEVEL << 4) | (CONFIG_BT_LE_DFT_PERIODIC_ADV_SCHED_PRIO_LEVEL << 2) | CONFIG_BT_LE_DFT_ADV_SCHED_PRIO_LEVEL)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -989,3 +989,11 @@ config BT_LE_CTRL_SLV_FAST_RX_CONN_DATA_EN
|
||||
When this option is enabled, the Controller continues receiving PDUs
|
||||
In the next connection event instead of entering latency
|
||||
After a data packet is received.
|
||||
|
||||
config BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN
|
||||
bool "Enables the automatic initiation of a data length update(Experimental)."
|
||||
default n
|
||||
help
|
||||
When this option is enabled, the Controller automatically initiates a data length update
|
||||
Using the appropriate data length parameters
|
||||
When a PHY update or a connection interval update occurs.
|
||||
|
||||
@@ -187,6 +187,7 @@ extern int r_ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_c
|
||||
extern char *ble_controller_get_compile_version(void);
|
||||
extern int esp_ble_register_bb_funcs(void);
|
||||
extern void esp_ble_unregister_bb_funcs(void);
|
||||
extern bool esp_ble_controller_lib_check(void);
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
@@ -226,6 +227,10 @@ static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
static bool esp_bt_check_wakeup_by_bt(void);
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
#include "tinycrypt/ecc.h"
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@@ -1144,6 +1149,13 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
if (!esp_ble_controller_lib_check()) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Controller lib version mismatch!");
|
||||
}
|
||||
|
||||
#if (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
uECC_set_rng(ecc_rand_func);
|
||||
#endif // (CONFIG_BT_CONTROLLER_ONLY) && (CONFIG_BT_LE_SM_SC) && (!CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS)
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
@@ -1614,6 +1626,27 @@ static mbedtls_ecp_keypair keypair;
|
||||
#if CONFIG_BT_LE_SM_SC
|
||||
#include "tinycrypt/cmac_mode.h"
|
||||
#include "tinycrypt/ecc_dh.h"
|
||||
|
||||
#if CONFIG_BT_CONTROLLER_ONLY
|
||||
/* Used by uECC to get random data */
|
||||
static int ecc_rand_func(uint8_t *dst, unsigned int len)
|
||||
{
|
||||
int offset_cnt = 0;
|
||||
uint8_t *u8ptr = dst;
|
||||
uint64_t random64 = 0;
|
||||
|
||||
while(len > 0) {
|
||||
random64 = (uint64_t)esp_random();
|
||||
random64 = (random64 << 32)| (uint64_t)esp_random();;
|
||||
offset_cnt = len < sizeof(uint64_t) ? len : sizeof(uint64_t);
|
||||
memcpy(u8ptr, &random64, offset_cnt);
|
||||
len -= offset_cnt;
|
||||
u8ptr += offset_cnt;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_ONLY
|
||||
#endif // CONFIG_BT_LE_SM_SC
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
|
||||
@@ -1705,11 +1738,11 @@ exit:
|
||||
}
|
||||
|
||||
#else
|
||||
if (uECC_valid_public_key(pk, &curve_secp256r1) < 0) {
|
||||
if (uECC_valid_public_key(pk, uECC_secp256r1()) < 0) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
|
||||
rc = uECC_shared_secret(pk, priv, dh, &curve_secp256r1);
|
||||
rc = uECC_shared_secret(pk, priv, dh, uECC_secp256r1());
|
||||
if (rc == TC_CRYPTO_FAIL) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
@@ -1785,7 +1818,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#else
|
||||
if (uECC_make_key(pk, priv, &curve_secp256r1) != TC_CRYPTO_SUCCESS) {
|
||||
if (uECC_make_key(pk, priv, uECC_secp256r1()) != TC_CRYPTO_SUCCESS) {
|
||||
return BLE_SM_KEY_ERR;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
@@ -1801,6 +1834,7 @@ int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv)
|
||||
|
||||
#endif // CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
|
||||
#endif // (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||
|
||||
#if CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
#include "esp_gdbstub.h"
|
||||
#endif // CONFIG_BT_LE_DEBUG_REMAIN_SCENE_ENABLED
|
||||
|
||||
@@ -215,6 +215,13 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_CTRL_SLV_FAST_RX_CONN_DATA_EN (0)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CONFIG_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN)
|
||||
#define DEFAULT_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN (CONFIG_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_CTRL_DL_ITVL_PHY_SYNC_EN (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
#define HCI_UART_EN CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
#else
|
||||
|
||||
Submodule components/bt/controller/lib_esp32 updated: a184fa951e...1359f195ed
Submodule components/bt/controller/lib_esp32c2/esp32c2-bt-lib updated: 7c104a8d09...6db3a4abe6
Submodule components/bt/controller/lib_esp32c3_family updated: 9b50531537...16cda80aab
Submodule components/bt/controller/lib_esp32c5/esp32c5-bt-lib updated: a5feba34e1...95899f11a3
Submodule components/bt/controller/lib_esp32c6/esp32c6-bt-lib updated: cf7c287226...d40be82077
Submodule components/bt/controller/lib_esp32h2/esp32h2-bt-lib updated: a568fa5a03...1034b3c595
@@ -42,6 +42,7 @@ static int adv_send(struct net_buf *buf)
|
||||
uint8_t adv_cnt = 0;
|
||||
struct bt_mesh_adv_data ad = {0};
|
||||
int err = 0;
|
||||
bool start_cb_called = (BLE_MESH_ADV(buf)->flags & BLE_MESH_ADV_FLAG_SKIP_START_CB);
|
||||
|
||||
BT_DBG("LegacyAdvSend, Type %u", BLE_MESH_ADV(buf)->type);
|
||||
BT_DBG("Len %u: %s", buf->len, bt_hex(buf->data, buf->len));
|
||||
@@ -175,7 +176,10 @@ static int adv_send(struct net_buf *buf)
|
||||
|
||||
net_buf_unref(buf);
|
||||
|
||||
adv_send_start(duration, err, cb, cb_data);
|
||||
if (!start_cb_called && cb && cb->start) {
|
||||
cb->start(duration, err, cb_data);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
BT_ERR("Start advertising failed: err %d", err);
|
||||
return err;
|
||||
@@ -194,7 +198,7 @@ static int adv_send(struct net_buf *buf)
|
||||
err = bt_le_adv_stop();
|
||||
#endif /* CONFIG_BLE_MESH_USE_BLE_50 */
|
||||
|
||||
adv_send_end(err, cb, cb_data);
|
||||
BLE_MESH_SEND_END_CB(err, cb, cb_data);
|
||||
if (err) {
|
||||
BT_ERR("Stop advertising failed: err %d", err);
|
||||
return 0;
|
||||
|
||||
@@ -55,6 +55,29 @@ static bt_mesh_ext_adv_t ext_long_relay_adv_pool[CONFIG_BLE_MESH_LONG_PACKET_REL
|
||||
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
|
||||
#endif /* CONFIG_BLE_MESH_EXT_ADV */
|
||||
|
||||
const uint8_t adv_type[] = {
|
||||
[BLE_MESH_ADV_PROV] = BLE_MESH_DATA_MESH_PROV,
|
||||
[BLE_MESH_ADV_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#if CONFIG_BLE_MESH_EXT_ADV
|
||||
[BLE_MESH_ADV_EXT_PROV] = BLE_MESH_DATA_MESH_PROV,
|
||||
[BLE_MESH_ADV_EXT_RELAY_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
[BLE_MESH_ADV_EXT_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
[BLE_MESH_ADV_EXT_LONG_PROV] = BLE_MESH_DATA_MESH_PROV,
|
||||
[BLE_MESH_ADV_EXT_LONG_RELAY_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
[BLE_MESH_ADV_EXT_LONG_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
|
||||
#endif /* CONFIG_BLE_MESH_EXT_ADV */
|
||||
#if CONFIG_BLE_MESH_FRIEND
|
||||
[BLE_MESH_ADV_FRIEND] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#endif
|
||||
#if CONFIG_BLE_MESH_RELAY_ADV_BUF
|
||||
[BLE_MESH_ADV_RELAY_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#endif
|
||||
[BLE_MESH_ADV_BEACON] = BLE_MESH_DATA_MESH_BEACON,
|
||||
[BLE_MESH_ADV_URI] = BLE_MESH_DATA_URI,
|
||||
};
|
||||
|
||||
static inline void init_adv_with_defaults(struct bt_mesh_adv *adv,
|
||||
enum bt_mesh_adv_type type)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,9 @@ extern "C" {
|
||||
|
||||
#define BLE_MESH_ADV_INST_UNUSED 0xFF
|
||||
|
||||
/* Flags for struct bt_mesh_adv */
|
||||
#define BLE_MESH_ADV_FLAG_SKIP_START_CB BIT(0) /* Skip start callback (already called by GATT) */
|
||||
|
||||
struct bt_mesh_adv {
|
||||
const struct bt_mesh_send_cb *cb;
|
||||
void *cb_data;
|
||||
@@ -61,6 +64,7 @@ struct bt_mesh_adv {
|
||||
uint32_t adv_itvl;
|
||||
uint8_t adv_cnt;
|
||||
uint8_t channel_map;
|
||||
uint8_t flags; /* See BLE_MESH_ADV_FLAG_* */
|
||||
};
|
||||
|
||||
#if CONFIG_BLE_MESH_USE_BLE_50
|
||||
@@ -171,29 +175,7 @@ typedef enum {
|
||||
BLE_MESH_BUF_REF_MAX,
|
||||
} bt_mesh_buf_ref_flag_t;
|
||||
|
||||
|
||||
static const uint8_t adv_type[] = {
|
||||
[BLE_MESH_ADV_PROV] = BLE_MESH_DATA_MESH_PROV,
|
||||
[BLE_MESH_ADV_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#if CONFIG_BLE_MESH_EXT_ADV
|
||||
[BLE_MESH_ADV_EXT_PROV] = BLE_MESH_DATA_MESH_PROV,
|
||||
[BLE_MESH_ADV_EXT_RELAY_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
[BLE_MESH_ADV_EXT_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
[BLE_MESH_ADV_EXT_LONG_PROV] = BLE_MESH_DATA_MESH_PROV,
|
||||
[BLE_MESH_ADV_EXT_LONG_RELAY_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
[BLE_MESH_ADV_EXT_LONG_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#endif /* CONFIG_BLE_MESH_LONG_PACKET */
|
||||
#endif /* CONFIG_BLE_MESH_EXT_ADV */
|
||||
#if CONFIG_BLE_MESH_FRIEND
|
||||
[BLE_MESH_ADV_FRIEND] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#endif
|
||||
#if CONFIG_BLE_MESH_RELAY_ADV_BUF
|
||||
[BLE_MESH_ADV_RELAY_DATA] = BLE_MESH_DATA_MESH_MESSAGE,
|
||||
#endif
|
||||
[BLE_MESH_ADV_BEACON] = BLE_MESH_DATA_MESH_BEACON,
|
||||
[BLE_MESH_ADV_URI] = BLE_MESH_DATA_URI,
|
||||
};
|
||||
extern const uint8_t adv_type[];
|
||||
|
||||
typedef struct bt_mesh_adv *(*bt_mesh_pool_allocator_t)(int id, enum bt_mesh_adv_type type);
|
||||
typedef void (*bt_mesh_adv_queue_send_cb_t)(bt_mesh_msg_t *msg, uint32_t timeout, bool front);
|
||||
@@ -214,22 +196,22 @@ static inline TickType_t K_WAIT(int32_t val)
|
||||
return (val == K_FOREVER) ? portMAX_DELAY : (val / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
static inline void adv_send_start(uint16_t duration, int err,
|
||||
const struct bt_mesh_send_cb *cb,
|
||||
void *cb_data)
|
||||
{
|
||||
if (cb && cb->start) {
|
||||
cb->start(duration, err, cb_data);
|
||||
}
|
||||
}
|
||||
#define BLE_MESH_SEND_START_CB(_buf, _duration, _err, _cb, _cb_data) \
|
||||
do { \
|
||||
if (!(BLE_MESH_ADV(_buf)->flags & BLE_MESH_ADV_FLAG_SKIP_START_CB)) { \
|
||||
if ((_cb) && (_cb)->start) { \
|
||||
(_cb)->start((_duration), (_err), (_cb_data)); \
|
||||
} \
|
||||
BLE_MESH_ADV(_buf)->flags |= BLE_MESH_ADV_FLAG_SKIP_START_CB; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static inline void adv_send_end(int err, const struct bt_mesh_send_cb *cb,
|
||||
void *cb_data)
|
||||
{
|
||||
if (cb && cb->end) {
|
||||
cb->end(err, cb_data);
|
||||
}
|
||||
}
|
||||
#define BLE_MESH_SEND_END_CB(_err, _cb, _cb_data) \
|
||||
do { \
|
||||
if ((_cb) && (_cb)->end) { \
|
||||
(_cb)->end((_err), (_cb_data)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
struct bt_mesh_adv_queue *bt_mesh_adv_queue_get(void);
|
||||
|
||||
|
||||
@@ -1874,6 +1874,7 @@ int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
|
||||
BTA_GATTC_Enh_Open(bt_mesh_gattc_if, bt_mesh_gattc_info[i].addr.val,
|
||||
bt_mesh_gattc_info[i].addr.type, true,
|
||||
BTA_GATT_TRANSPORT_LE, TRUE, BLE_ADDR_UNKNOWN_TYPE,
|
||||
false, 0xFF, 0xFF,
|
||||
BTA_BLE_PHY_1M_MASK, &conn_1m_param, NULL, NULL);
|
||||
#else /* CONFIG_BLE_MESH_USE_BLE_50 */
|
||||
/* Min_interval: 15ms
|
||||
@@ -1889,6 +1890,7 @@ int bt_mesh_gattc_conn_create(const bt_mesh_addr_t *addr, uint16_t service_uuid)
|
||||
BTA_GATTC_Enh_Open(bt_mesh_gattc_if, bt_mesh_gattc_info[i].addr.val,
|
||||
bt_mesh_gattc_info[i].addr.type, true,
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE,
|
||||
false, 0xFF, 0xFF,
|
||||
BTA_BLE_PHY_1M_MASK, &conn_1m_param, NULL, NULL);
|
||||
#endif /* CONFIG_BLE_MESH_USE_BLE_50 */
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ static int adv_send(struct bt_mesh_adv_inst *inst, uint16_t *adv_duration)
|
||||
break;
|
||||
}
|
||||
|
||||
adv_send_start(duration, err, cb, cb_data);
|
||||
BLE_MESH_SEND_START_CB(buf, duration, err, cb, cb_data);
|
||||
if (err) {
|
||||
BT_ERR("Start advertising failed: err %d", err);
|
||||
return err;
|
||||
@@ -381,8 +381,8 @@ static uint32_t received_adv_evts_handle(uint32_t recv_evts)
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
adv_send_end(0, BLE_MESH_ADV(adv_insts[i].sending_buf)->cb,
|
||||
BLE_MESH_ADV(adv_insts[i].sending_buf)->cb_data);
|
||||
BLE_MESH_SEND_END_CB(0, BLE_MESH_ADV(adv_insts[i].sending_buf)->cb,
|
||||
BLE_MESH_ADV(adv_insts[i].sending_buf)->cb_data);
|
||||
|
||||
bt_mesh_adv_buf_ref_debug(__func__, adv_insts[i].sending_buf, 4U, BLE_MESH_BUF_REF_SMALL);
|
||||
|
||||
|
||||
@@ -37,21 +37,12 @@ extern "C" {
|
||||
*/
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define BLE_MESH_MAX_CONN 1
|
||||
#define BLE_MESH_MAX_CONN MIN(CONFIG_BT_ACL_CONNECTIONS, CONFIG_BTDM_CTRL_BLE_MAX_CONN)
|
||||
#elif (CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3)
|
||||
/* @todo: must ensure CONFIG_BT_CTRL_BLE_MAX_ACT is greater than 2 */
|
||||
#if CONFIG_BT_ACL_CONNECTIONS > (CONFIG_BT_CTRL_BLE_MAX_ACT - 2)
|
||||
/* decrease the adv,scan */
|
||||
#define BLE_MESH_MAX_CONN (CONFIG_BT_CTRL_BLE_MAX_ACT - 2)
|
||||
#else
|
||||
#define BLE_MESH_MAX_CONN CONFIG_BT_ACL_CONNECTIONS
|
||||
#endif /* CONFIG_BT_ACL_CONNECTIONS > (CONFIG_BT_CTRL_BLE_MAX_ACT - 2) */
|
||||
#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5
|
||||
#if CONFIG_BT_ACL_CONNECTIONS > CONFIG_BT_LE_MAX_CONNECTIONS
|
||||
#define BLE_MESH_MAX_CONN CONFIG_BT_LE_MAX_CONNECTIONS
|
||||
#else
|
||||
#define BLE_MESH_MAX_CONN CONFIG_BT_ACL_CONNECTIONS
|
||||
#endif /* CONFIG_BT_ACL_CONNECTIONS > CONFIG_BT_LE_MAX_CONNECTIONS */
|
||||
#define BLE_MESH_MAX_CONN MIN(CONFIG_BT_ACL_CONNECTIONS, (CONFIG_BT_CTRL_BLE_MAX_ACT - 2))
|
||||
#elif (CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || \
|
||||
CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61)
|
||||
#define BLE_MESH_MAX_CONN MIN(CONFIG_BT_ACL_CONNECTIONS, CONFIG_BT_LE_MAX_CONNECTIONS)
|
||||
#else
|
||||
/* default setting */
|
||||
#define BLE_MESH_MAX_CONN 1
|
||||
@@ -60,16 +51,11 @@ extern "C" {
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#define BLE_MESH_MAX_CONN 1
|
||||
#define BLE_MESH_MAX_CONN MIN(CONFIG_BT_NIMBLE_MAX_CONNECTIONS, CONFIG_BTDM_CTRL_BLE_MAX_CONN)
|
||||
#elif (CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3)
|
||||
/* @todo: must ensure CONFIG_BT_CTRL_BLE_MAX_ACT is greater than 2 */
|
||||
#if CONFIG_BT_NIMBLE_MAX_CONNECTIONS > (CONFIG_BT_CTRL_BLE_MAX_ACT - 2)
|
||||
/* decrease the adv,scan */
|
||||
#define BLE_MESH_MAX_CONN (CONFIG_BT_CTRL_BLE_MAX_ACT - 2)
|
||||
#else
|
||||
#define BLE_MESH_MAX_CONN CONFIG_BT_NIMBLE_MAX_CONNECTIONS
|
||||
#endif /* CONFIG_BT_NIMBLE_MAX_CONNECTIONS > (CONFIG_BT_CTRL_BLE_MAX_ACT - 2) */
|
||||
#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5
|
||||
#define BLE_MESH_MAX_CONN MIN(CONFIG_BT_NIMBLE_MAX_CONNECTIONS, (CONFIG_BT_CTRL_BLE_MAX_ACT - 2))
|
||||
#elif (CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || \
|
||||
CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61)
|
||||
#define BLE_MESH_MAX_CONN CONFIG_BT_NIMBLE_MAX_CONNECTIONS
|
||||
#else
|
||||
/* default setting */
|
||||
|
||||
@@ -1239,6 +1239,15 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
|
||||
send_cb = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* GATT bearer sends faster than ADV bearer, so the remote node
|
||||
* may receive the message and respond before ADV bearer starts.
|
||||
* To avoid issues where the start callback hasn't been called
|
||||
* when the response arrives, we call the start callback here
|
||||
* immediately after GATT bearer sends successfully. The ADV
|
||||
* bearer will skip start callback since the flag is set.
|
||||
*/
|
||||
BLE_MESH_SEND_START_CB(buf, 0, 0, send_cb, cb_data);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_GATT_PROXY_CLIENT */
|
||||
@@ -1253,9 +1262,7 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
|
||||
* See BLEMESH24-76 for more details.
|
||||
*/
|
||||
if (BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
|
||||
if (send_cb && send_cb->start) {
|
||||
send_cb->start(0, 0, cb_data);
|
||||
}
|
||||
BLE_MESH_SEND_START_CB(buf, 0, 0, send_cb, cb_data);
|
||||
|
||||
net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));
|
||||
|
||||
|
||||
@@ -472,7 +472,8 @@ void bt_mesh_generic_net_recv(struct net_buf_simple *data,
|
||||
static inline void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
|
||||
enum bt_mesh_net_if net_if)
|
||||
{
|
||||
struct bt_mesh_net_rx rx = { .ctx.recv_rssi = rssi };
|
||||
struct bt_mesh_net_rx rx = {0};
|
||||
rx.ctx.recv_rssi = rssi;
|
||||
#if CONFIG_BLE_MESH_EXT_ADV
|
||||
rx.ctx.enh.adv_cfg_used = false;
|
||||
rx.ctx.enh.ext_adv_cfg_used = false;
|
||||
|
||||
@@ -474,7 +474,7 @@ void bt_mesh_ble_ext_adv_report(struct ble_gap_ext_disc_desc *desc)
|
||||
|
||||
/* Here, only a shallow copy needs to be implemented;
|
||||
* deep copying behavior occurs in btc_ble_mesh_ble_copy_req_data. */
|
||||
adv_rpt.data = desc->length_data ? desc->data : NULL;
|
||||
adv_rpt.data = desc->length_data ? (uint8_t *)desc->data : NULL;
|
||||
|
||||
adv_rpt.event_type = desc->props;
|
||||
adv_rpt.addr_type = desc->addr.type;
|
||||
|
||||
@@ -2528,10 +2528,6 @@ found_rx:
|
||||
}
|
||||
}
|
||||
|
||||
if (rpl) {
|
||||
bt_mesh_update_rpl(rpl, net_rx);
|
||||
}
|
||||
|
||||
/* Mark segment as received */
|
||||
rx->block |= BIT(seg_o);
|
||||
|
||||
@@ -2543,6 +2539,10 @@ found_rx:
|
||||
|
||||
BT_DBG("Complete SDU");
|
||||
|
||||
if (rpl) {
|
||||
bt_mesh_update_rpl(rpl, net_rx);
|
||||
}
|
||||
|
||||
*pdu_type = BLE_MESH_FRIEND_PDU_COMPLETE;
|
||||
|
||||
/* Stop SAR Discard timer when processing result is Last Segment */
|
||||
|
||||
@@ -211,11 +211,6 @@ void bt_mesh_ext_mem_swap(void *buf, size_t length)
|
||||
sys_mem_swap(buf, length);
|
||||
}
|
||||
|
||||
uint32_t bt_mesh_ext_log_timestamp(void)
|
||||
{
|
||||
return esp_log_timestamp();
|
||||
}
|
||||
|
||||
/* Net buf */
|
||||
void bt_mesh_ext_buf_simple_init(struct net_buf_simple *buf, size_t reserve_head)
|
||||
{
|
||||
@@ -4006,8 +4001,6 @@ void bt_mesh_ext_mbt_server_cb_evt_to_btc(uint8_t event, void *model, void *ctx)
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint64_t config_ble_mesh_stack_trace_level : 3;
|
||||
|
||||
uint64_t config_ble_mesh_use_ble_50: 1;
|
||||
uint64_t config_ble_mesh_use_duplicate_scan : 1;
|
||||
uint64_t config_ble_mesh_pb_adv : 1;
|
||||
@@ -4172,8 +4165,6 @@ typedef struct {
|
||||
} bt_mesh_ext_config_t;
|
||||
|
||||
static const bt_mesh_ext_config_t bt_mesh_ext_cfg = {
|
||||
.config_ble_mesh_stack_trace_level = BLE_MESH_LOG_LEVEL,
|
||||
|
||||
.config_ble_mesh_use_ble_50 = IS_ENABLED(CONFIG_BLE_MESH_USE_BLE_50),
|
||||
.config_ble_mesh_use_duplicate_scan = IS_ENABLED(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN),
|
||||
.config_ble_mesh_pb_adv = IS_ENABLED(CONFIG_BLE_MESH_PB_ADV),
|
||||
@@ -4963,6 +4954,106 @@ static const bt_mesh_ext_funcs_t bt_mesh_ext_func = {
|
||||
/* CONFIG_BLE_MESH_MBT_SRV */
|
||||
};
|
||||
|
||||
#define BLE_MESH_LIB_TRACE_TAG "BLE_MESH(lib)"
|
||||
#define BLE_MESH_LOG_FORMAT_START(level) LOG_COLOR_ ## level #level " (%" PRIu32 ") %s: "
|
||||
#define BLE_MESH_LOG_FORMAT_END LOG_RESET_COLOR "\n"
|
||||
|
||||
void bt_mesh_lib_log_error(const char *format, ...)
|
||||
{
|
||||
#if (CONFIG_BLE_MESH_NO_LOG ||\
|
||||
/* Disable log output when compressed logging
|
||||
* is enabled but ERR logs are not preserved */\
|
||||
(CONFIG_BLE_MESH_STACK_ERR_LOG_COMPRESSION &&\
|
||||
!CONFIG_BLE_MESH_STACK_ERR_LOG_PRESERVE))
|
||||
return;
|
||||
#else
|
||||
if ((BLE_MESH_LOG_LEVEL >= BLE_MESH_LOG_LEVEL_ERROR) &&
|
||||
BLE_MESH_LOG_LEVEL_CHECK(BLE_MESH, ERROR)) {
|
||||
va_list args = {0};
|
||||
va_start(args, format);
|
||||
esp_log_write(ESP_LOG_ERROR, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_START(E), esp_log_timestamp(), BLE_MESH_LIB_TRACE_TAG);
|
||||
esp_log_writev(ESP_LOG_ERROR, BLE_MESH_LIB_TRACE_TAG, format, args);
|
||||
esp_log_write(ESP_LOG_ERROR, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_END);
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void bt_mesh_lib_log_warn(const char *format, ...)
|
||||
{
|
||||
#if (CONFIG_BLE_MESH_NO_LOG ||\
|
||||
/* Disable log output when compressed logging
|
||||
* is enabled but WARN logs are not preserved */\
|
||||
(CONFIG_BLE_MESH_STACK_WARN_LOG_COMPRESSION &&\
|
||||
!CONFIG_BLE_MESH_STACK_WARN_LOG_PRESERVE))
|
||||
return;
|
||||
#else
|
||||
if ((BLE_MESH_LOG_LEVEL >= BLE_MESH_LOG_LEVEL_WARN) &&
|
||||
BLE_MESH_LOG_LEVEL_CHECK(BLE_MESH, WARN)) {
|
||||
va_list args = {0};
|
||||
va_start(args, format);
|
||||
esp_log_write(ESP_LOG_WARN, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_START(W), esp_log_timestamp(), BLE_MESH_LIB_TRACE_TAG);
|
||||
esp_log_writev(ESP_LOG_WARN, BLE_MESH_LIB_TRACE_TAG, format, args);
|
||||
esp_log_write(ESP_LOG_WARN, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_END);
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void bt_mesh_lib_log_info(const char *format, ...)
|
||||
{
|
||||
#if (CONFIG_BLE_MESH_NO_LOG ||\
|
||||
/* Disable log output when compressed logging
|
||||
* is enabled but INFO logs are not preserved */\
|
||||
(CONFIG_BLE_MESH_STACK_INFO_LOG_COMPRESSION &&\
|
||||
!CONFIG_BLE_MESH_STACK_INFO_LOG_PRESERVE))
|
||||
return;
|
||||
#else
|
||||
if ((BLE_MESH_LOG_LEVEL >= BLE_MESH_LOG_LEVEL_INFO) &&
|
||||
BLE_MESH_LOG_LEVEL_CHECK(BLE_MESH, INFO)) {
|
||||
va_list args = {0};
|
||||
va_start(args, format);
|
||||
esp_log_write(ESP_LOG_INFO, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_START(I), esp_log_timestamp(), BLE_MESH_LIB_TRACE_TAG);
|
||||
esp_log_writev(ESP_LOG_INFO, BLE_MESH_LIB_TRACE_TAG, format, args);
|
||||
esp_log_write(ESP_LOG_INFO, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_END);
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void bt_mesh_lib_log_debug(const char *format, ...)
|
||||
{
|
||||
#if (CONFIG_BLE_MESH_NO_LOG ||\
|
||||
/* Disable log output when compressed logging
|
||||
* is enabled but DEBUG logs are not preserved */\
|
||||
(CONFIG_BLE_MESH_STACK_DEBUG_LOG_COMPRESSION &&\
|
||||
!CONFIG_BLE_MESH_STACK_DEBUG_LOG_PRESERVE))
|
||||
return;
|
||||
#else
|
||||
if ((BLE_MESH_LOG_LEVEL >= BLE_MESH_LOG_LEVEL_DEBUG) &&
|
||||
BLE_MESH_LOG_LEVEL_CHECK(BLE_MESH, DEBUG)) {
|
||||
va_list args = {0};
|
||||
va_start(args, format);
|
||||
esp_log_write(ESP_LOG_DEBUG, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_START(D), esp_log_timestamp(), BLE_MESH_LIB_TRACE_TAG);
|
||||
esp_log_writev(ESP_LOG_DEBUG, BLE_MESH_LIB_TRACE_TAG, format, args);
|
||||
esp_log_write(ESP_LOG_DEBUG, BLE_MESH_LIB_TRACE_TAG, BLE_MESH_LOG_FORMAT_END);
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Keep symbols alive.
|
||||
* @note Dummy function to stop the linker from
|
||||
* optimizing away unused code.The dummy
|
||||
* function is discarded after linking,
|
||||
* so it adds zero bytes to the final binary.
|
||||
*/
|
||||
void bt_mesh_lib_ext_func_dummy_call(void)
|
||||
{
|
||||
(void *)bt_hex(NULL, 0);
|
||||
}
|
||||
|
||||
int bt_mesh_v11_ext_init(void)
|
||||
{
|
||||
return bt_mesh_v11_init(&bt_mesh_ext_cfg, sizeof(bt_mesh_ext_cfg),
|
||||
|
||||
Submodule components/bt/esp_ble_mesh/lib/lib updated: d9fe7de9a9...85e64e61f8
@@ -186,6 +186,8 @@ struct esp_ble_mesh_blob_xfer {
|
||||
esp_ble_mesh_blob_xfer_mode_t mode; /*!< BLOB transfer mode. */
|
||||
uint8_t block_size_log; /*!< Logarithmic representation of the block size. */
|
||||
uint16_t chunk_size; /*!< Base chunk size. May be smaller for the last chunk. */
|
||||
/* Enhanced parameters for message context in blob chunks */
|
||||
esp_ble_mesh_msg_enh_params_t chunk_enh_params;
|
||||
};
|
||||
|
||||
/** BLOB transfer data block. */
|
||||
|
||||
@@ -782,6 +782,8 @@ struct esp_ble_mesh_dfu_cli_xfer_blob_params {
|
||||
uint8_t block_size_log;
|
||||
/** Base chunk size. May be smaller for the last chunk. */
|
||||
uint16_t chunk_size;
|
||||
/* Enhanced parameters for message context in blob chunks */
|
||||
esp_ble_mesh_msg_enh_params_t chunk_enh_params;
|
||||
};
|
||||
|
||||
/** Firmware Update Client transfer parameters */
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#define _BLE_MESH_MBT_DEPRECATE_WARN
|
||||
#warning "warning: 'All content in this document, including data structures and APIs, will be deprecated."
|
||||
#endif
|
||||
#endif /* CONFIG_BLE_MESH_MBT_SRV || CONFIG_BLE_MESH_MBT_CLI */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -773,4 +772,5 @@ esp_err_t esp_ble_mesh_mbt_server_get_blob_reception_progress(esp_ble_mesh_model
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_BLE_MESH_MBT_SRV || CONFIG_BLE_MESH_MBT_CLI */
|
||||
#endif /* _ESP_BLE_MESH_MBT_MODEL_API_H_ */
|
||||
|
||||
@@ -19,6 +19,9 @@ extern "C" {
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#define BTC_BLE_MESH_MBT_CLIENT_RESULT_COMPLETE 0x00
|
||||
#define BTC_BLE_MESH_MBT_CLIENT_RESULT_FAIL 0x01
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_ACT_MBT_CLIENT_RETRIEVE_CAPABILITIES,
|
||||
BTC_BLE_MESH_ACT_MBT_CLIENT_TRANSFER_BLOB,
|
||||
@@ -36,6 +39,49 @@ typedef enum {
|
||||
BTC_BLE_MESH_ACT_MBT_CLIENT_MAX,
|
||||
} btc_ble_mesh_mbt_client_act_t;
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_RETRIEVE_CAPABILITIES_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_TRANSFER_BLOB_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SEND_BLOCK_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SEND_DATA_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_DETERMINE_BLOCK_STATUS_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_DETERMINE_TRANSFER_STATUS_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CANCEL_TRANSFER_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SET_TRANSFER_TTL_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CLEAR_TRANSFER_TTL_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SET_APP_IDX_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CLEAR_APP_IDX_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SET_MULTICAST_ADDR_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CLEAR_MULTICAST_ADDR_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_MAX,
|
||||
} btc_ble_mesh_mbt_client_evt_t;
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_INITIALIZE_BLOB_RECEIVE,
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_CANCEL_BLOB_RECEIVE,
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_SET_BLOB_CAPABILITIES,
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_MAX,
|
||||
} btc_ble_mesh_mbt_server_act_t;
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_INITIALIZE_BLOB_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_CANCEL_BLOB_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_SET_BLOB_CAPABILITIES_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_TRANSFER_GET,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_TRANSFER_START,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_TRANSFER_CANCEL,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_BLOCK_GET,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_BLOCK_START,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_CHUNK_TRANSFER,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_INFORMATION_GET,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOCK_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_RECEIVE_TIMEOUT,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_MAX,
|
||||
} btc_ble_mesh_mbt_server_evt_t;
|
||||
|
||||
#if CONFIG_BLE_MESH_MBT_SRV || CONFIG_BLE_MESH_MBT_CLI
|
||||
|
||||
typedef union {
|
||||
esp_ble_mesh_retrieve_capabilities_t retrieve_capabilities;
|
||||
esp_ble_mesh_transfer_blob_t transfer_blob;
|
||||
@@ -67,26 +113,6 @@ typedef union {
|
||||
} clear_multicast_addr;
|
||||
} btc_ble_mesh_mbt_client_args_t;
|
||||
|
||||
#define BTC_BLE_MESH_MBT_CLIENT_RESULT_COMPLETE 0x00
|
||||
#define BTC_BLE_MESH_MBT_CLIENT_RESULT_FAIL 0x01
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_RETRIEVE_CAPABILITIES_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_TRANSFER_BLOB_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SEND_BLOCK_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SEND_DATA_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_DETERMINE_BLOCK_STATUS_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_DETERMINE_TRANSFER_STATUS_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CANCEL_TRANSFER_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SET_TRANSFER_TTL_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CLEAR_TRANSFER_TTL_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SET_APP_IDX_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CLEAR_APP_IDX_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_SET_MULTICAST_ADDR_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_CLEAR_MULTICAST_ADDR_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_CLIENT_MAX,
|
||||
} btc_ble_mesh_mbt_client_evt_t;
|
||||
|
||||
void btc_ble_mesh_mbt_client_call_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_ble_mesh_mbt_client_cb_handler(btc_msg_t *msg);
|
||||
@@ -103,12 +129,6 @@ void btc_ble_mesh_mbt_client_publish_callback(uint32_t opcode,
|
||||
void bt_mesh_mbt_client_cb_evt_to_btc(uint8_t event, uint8_t result,
|
||||
struct bt_mesh_model *model);
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_INITIALIZE_BLOB_RECEIVE,
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_CANCEL_BLOB_RECEIVE,
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_SET_BLOB_CAPABILITIES,
|
||||
BTC_BLE_MESH_ACT_MBT_SERVER_MAX,
|
||||
} btc_ble_mesh_mbt_server_act_t;
|
||||
|
||||
typedef union {
|
||||
esp_ble_mesh_initialize_blob_receive_t initialize_blob_receive;
|
||||
@@ -116,23 +136,6 @@ typedef union {
|
||||
esp_ble_mesh_set_blob_capabilities_t set_blob_capabilities;
|
||||
} btc_ble_mesh_mbt_server_args_t;
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_INITIALIZE_BLOB_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_CANCEL_BLOB_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_SET_BLOB_CAPABILITIES_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_TRANSFER_GET,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_TRANSFER_START,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_TRANSFER_CANCEL,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_BLOCK_GET,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_BLOCK_START,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_CHUNK_TRANSFER,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_INFORMATION_GET,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOCK_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_RECEIVE_COMP,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_BLOB_RECEIVE_TIMEOUT,
|
||||
BTC_BLE_MESH_EVT_MBT_SERVER_MAX,
|
||||
} btc_ble_mesh_mbt_server_evt_t;
|
||||
|
||||
void btc_ble_mesh_mbt_server_call_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_ble_mesh_mbt_server_cb_handler(btc_msg_t *msg);
|
||||
@@ -141,6 +144,8 @@ void bt_mesh_mbt_server_cb_evt_to_btc(uint8_t event,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx);
|
||||
|
||||
#endif /* CONFIG_BLE_MESH_MBT_SRV || CONFIG_BLE_MESH_MBT_CLI */
|
||||
|
||||
#if CONFIG_IDF_CI_BUILD
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
@@ -1236,9 +1236,14 @@ int bt_mesh_dfu_cli_send(struct bt_mesh_dfu_cli *cli,
|
||||
cli->xfer.flags = 0U;
|
||||
|
||||
if (xfer->blob_params) {
|
||||
cli->xfer.flags |= FLAG_SKIP_CAPS_GET;
|
||||
cli->xfer.blob.block_size_log = xfer->blob_params->block_size_log;
|
||||
cli->xfer.blob.chunk_size = xfer->blob_params->chunk_size;
|
||||
if (xfer->blob_params->block_size_log &&
|
||||
xfer->blob_params->chunk_size) {
|
||||
cli->xfer.flags |= FLAG_SKIP_CAPS_GET;
|
||||
cli->xfer.blob.block_size_log = xfer->blob_params->block_size_log;
|
||||
cli->xfer.blob.chunk_size = xfer->blob_params->chunk_size;
|
||||
}
|
||||
memcpy(&cli->xfer.blob.chunk_enh_params, &xfer->blob_params->chunk_enh_params,
|
||||
sizeof(bt_mesh_msg_enh_params_t));
|
||||
}
|
||||
|
||||
/* Phase will be set based on target status messages: */
|
||||
|
||||
@@ -243,6 +243,8 @@ struct bt_mesh_dfu_cli_xfer_blob_params {
|
||||
uint8_t block_size_log;
|
||||
/** Base chunk size. May be smaller for the last chunk. */
|
||||
uint16_t chunk_size;
|
||||
/* Enhanced parameters for message context in blob chunks */
|
||||
bt_mesh_msg_enh_params_t chunk_enh_params;
|
||||
};
|
||||
|
||||
/** Firmware Update Client transfer parameters: */
|
||||
|
||||
@@ -141,6 +141,8 @@ struct bt_mesh_blob_xfer {
|
||||
uint8_t block_size_log;
|
||||
/** Base chunk size. May be smaller for the last chunk. */
|
||||
uint16_t chunk_size;
|
||||
/* Enhanced parameters for message context in blob chunks */
|
||||
bt_mesh_msg_enh_params_t chunk_enh_params;
|
||||
};
|
||||
|
||||
/** BLOB stream interaction mode. */
|
||||
|
||||
@@ -34,19 +34,37 @@
|
||||
#define BLOB_CHUNK_SIZE_MAX(sdu_max) ((sdu_max) - BLOB_CHUNK_SDU_OVERHEAD)
|
||||
#define BLOB_CHUNK_SDU_LEN(chunk_size) (BLOB_CHUNK_SDU_OVERHEAD + (chunk_size))
|
||||
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
#if CONFIG_BLE_MESH_ALIGN_CHUNK_SIZE_TO_MAX_SEGMENT || \
|
||||
CONFIG_BLE_MESH_RX_BLOB_CHUNK_SIZE > BLOB_CHUNK_SIZE_MAX(BLE_MESH_EXT_RX_SDU_MAX)
|
||||
#define BLOB_RX_CHUNK_SIZE BLOB_CHUNK_SIZE_MAX(BLE_MESH_EXT_RX_SDU_MAX)
|
||||
#else
|
||||
#define BLOB_RX_CHUNK_SIZE CONFIG_BLE_MESH_RX_BLOB_CHUNK_SIZE
|
||||
#endif
|
||||
#else // CONFIG_BLE_MESH_LONG_PACKET
|
||||
#if CONFIG_BLE_MESH_ALIGN_CHUNK_SIZE_TO_MAX_SEGMENT || \
|
||||
CONFIG_BLE_MESH_RX_BLOB_CHUNK_SIZE > BLOB_CHUNK_SIZE_MAX(BLE_MESH_RX_SDU_MAX)
|
||||
#define BLOB_RX_CHUNK_SIZE BLOB_CHUNK_SIZE_MAX(BLE_MESH_RX_SDU_MAX)
|
||||
#else
|
||||
#define BLOB_RX_CHUNK_SIZE CONFIG_BLE_MESH_RX_BLOB_CHUNK_SIZE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
#if CONFIG_BLE_MESH_ALIGN_CHUNK_SIZE_TO_MAX_SEGMENT || \
|
||||
CONFIG_BLE_MESH_TX_BLOB_CHUNK_SIZE > BLOB_CHUNK_SIZE_MAX(BLE_MESH_EXT_TX_SDU_MAX)
|
||||
#define BLOB_TX_CHUNK_SIZE BLOB_CHUNK_SIZE_MAX(BLE_MESH_EXT_TX_SDU_MAX)
|
||||
#else
|
||||
#define BLOB_TX_CHUNK_SIZE CONFIG_BLE_MESH_TX_BLOB_CHUNK_SIZE
|
||||
#endif
|
||||
#else // CONFIG_BLE_MESH_LONG_PACKET
|
||||
#if CONFIG_BLE_MESH_ALIGN_CHUNK_SIZE_TO_MAX_SEGMENT || \
|
||||
CONFIG_BLE_MESH_TX_BLOB_CHUNK_SIZE > BLOB_CHUNK_SIZE_MAX(BLE_MESH_TX_SDU_MAX)
|
||||
#define BLOB_TX_CHUNK_SIZE BLOB_CHUNK_SIZE_MAX(BLE_MESH_TX_SDU_MAX)
|
||||
#else
|
||||
#define BLOB_TX_CHUNK_SIZE CONFIG_BLE_MESH_TX_BLOB_CHUNK_SIZE
|
||||
#endif
|
||||
#endif // CONFIG_BLE_MESH_LONG_PACKET
|
||||
|
||||
/* Utility macros for calculating log2 of a number at compile time.
|
||||
* Used to determine the log2 representation of the block size, which
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#if CONFIG_BLE_MESH_BLOB_CLI
|
||||
|
||||
#define CHUNK_SIZE_MAX BLOB_TX_CHUNK_SIZE
|
||||
|
||||
#define TARGETS_FOR_EACH(cli, target) \
|
||||
SYS_SLIST_FOR_EACH_CONTAINER((sys_slist_t *)&(cli)->inputs->targets, \
|
||||
target, n)
|
||||
@@ -49,7 +51,8 @@ _Static_assert((BLOB_BLOCK_STATUS_MSG_MAXLEN + BLE_MESH_MODEL_OP_LEN(BT_MESH_BLO
|
||||
BLE_MESH_MIC_SHORT) <= BLE_MESH_RX_SDU_MAX,
|
||||
"The BLOB Block Status message does not fit into the maximum incoming SDU size.");
|
||||
|
||||
NET_BUF_SIMPLE_DEFINE_STATIC(chunk_buf, BLE_MESH_TX_SDU_MAX);
|
||||
NET_BUF_SIMPLE_DEFINE_STATIC(chunk_buf, BLOB_CHUNK_SDU_LEN(CHUNK_SIZE_MAX));
|
||||
static bool chunk_sending;
|
||||
|
||||
struct block_status {
|
||||
enum bt_mesh_blob_status status;
|
||||
@@ -591,6 +594,12 @@ static int tx(struct bt_mesh_blob_cli *cli, uint16_t addr,
|
||||
.addr = addr,
|
||||
.send_ttl = cli->inputs->ttl,
|
||||
};
|
||||
|
||||
if (chunk_sending) {
|
||||
memcpy(&ctx.enh, &cli->xfer->chunk_enh_params,
|
||||
sizeof(bt_mesh_msg_enh_params_t));
|
||||
}
|
||||
|
||||
int err;
|
||||
|
||||
err = bt_mesh_model_send((struct bt_mesh_model *)cli->mod, &ctx, buf, &end_cb, cli);
|
||||
@@ -615,6 +624,10 @@ static void send_end(int err, void *user_data)
|
||||
{
|
||||
struct bt_mesh_blob_cli *cli = user_data;
|
||||
|
||||
if (chunk_sending) {
|
||||
chunk_sending = false;
|
||||
}
|
||||
|
||||
if (!cli->tx.ctx.is_inited) {
|
||||
return;
|
||||
}
|
||||
@@ -642,7 +655,12 @@ static void xfer_start_tx(struct bt_mesh_blob_cli *cli, uint16_t dst)
|
||||
net_buf_simple_add_le64(&buf, cli->xfer->id);
|
||||
net_buf_simple_add_le32(&buf, cli->xfer->size);
|
||||
net_buf_simple_add_u8(&buf, cli->xfer->block_size_log);
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
/* todo: could let user select methold */
|
||||
net_buf_simple_add_le16(&buf, BLE_MESH_EXT_TX_SDU_MAX);
|
||||
#else
|
||||
net_buf_simple_add_le16(&buf, BLE_MESH_TX_SDU_MAX);
|
||||
#endif
|
||||
|
||||
tx(cli, dst, &buf);
|
||||
}
|
||||
@@ -959,6 +977,8 @@ static void chunk_send(struct bt_mesh_blob_cli *cli)
|
||||
chunk_size(cli->xfer, &cli->block, cli->chunk_idx));
|
||||
|
||||
cli->state = BT_MESH_BLOB_CLI_STATE_BLOCK_SEND;
|
||||
chunk_sending = true;
|
||||
|
||||
blob_cli_broadcast(cli, &ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
|
||||
#if CONFIG_BLE_MESH_BLOB_SRV
|
||||
|
||||
#if CONFIG_BLE_MESH_LONG_PACKET
|
||||
#define MTU_SIZE_MAX (BLE_MESH_EXT_RX_SDU_MAX - BLE_MESH_MIC_SHORT)
|
||||
#else
|
||||
#define MTU_SIZE_MAX (BLE_MESH_RX_SDU_MAX - BLE_MESH_MIC_SHORT)
|
||||
#endif
|
||||
|
||||
/* The Receive BLOB Timeout Timer */
|
||||
#define SERVER_TIMEOUT_SECS(srv) (10 * (1 + (srv)->state.timeout_base))
|
||||
|
||||
@@ -33,13 +33,6 @@ config BT_BTU_TASK_STACK_SIZE
|
||||
help
|
||||
This select btu task stack size
|
||||
|
||||
config BT_BLUEDROID_MEM_DEBUG
|
||||
bool "Bluedroid memory debug"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
default n
|
||||
help
|
||||
Bluedroid memory debug
|
||||
|
||||
config BT_BLUEDROID_ESP_COEX_VSC
|
||||
bool "Enable Espressif Vendor-specific HCI commands for coexist status configuration"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
@@ -377,6 +370,23 @@ config BT_GATTS_APPEARANCE_WRITABLE
|
||||
help
|
||||
Enabling this option allows remote GATT clients to write appearance
|
||||
|
||||
config BT_GATTS_SECURITY_LEVELS_CHAR
|
||||
bool "Enable LE GATT Security Levels Characteristic"
|
||||
depends on BT_GATTS_ENABLE
|
||||
default n
|
||||
help
|
||||
Enable LE GATT Security Levels Characteristic
|
||||
|
||||
config BT_GATTS_KEY_MATERIAL_CHAR
|
||||
bool "Enable Encrypted Data Key Material Characteristic"
|
||||
depends on BT_GATTS_ENABLE
|
||||
default n
|
||||
help
|
||||
Enable the Encrypted Data Key Material characteristic in GAP service.
|
||||
This characteristic allows advertising data to be decrypted and authenticated
|
||||
using the key material (session key + IV) as defined in Bluetooth Core
|
||||
Specification Version 5.4. The characteristic requires encrypted link to read.
|
||||
|
||||
menuconfig BT_GATTC_ENABLE
|
||||
bool "Include GATT client module(GATTC)"
|
||||
depends on BT_BLE_ENABLED
|
||||
@@ -395,7 +405,7 @@ config BT_GATTC_MAX_CACHE_CHAR
|
||||
config BT_GATTC_NOTIF_REG_MAX
|
||||
int "Max gattc notify(indication) register number"
|
||||
depends on BT_GATTC_ENABLE
|
||||
range 1 64
|
||||
range 1 255
|
||||
default 5
|
||||
help
|
||||
Maximum GATTC notify(indication) register number
|
||||
@@ -474,6 +484,48 @@ config BT_BLE_RPA_SUPPORTED
|
||||
For other BLE chips, devices support network privacy mode and device privacy mode,
|
||||
users can switch the two modes according to their own needs. So this option is enabled by default.
|
||||
|
||||
menu "Bluedroid debug option"
|
||||
config BT_BLUEDROID_MEM_DEBUG
|
||||
bool "Bluedroid memory debug"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
default n
|
||||
help
|
||||
Bluedroid memory debug
|
||||
|
||||
config BT_BLUEDROID_MEM_STATS
|
||||
bool "Bluedroid memory statistics"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
depends on !BT_BLUEDROID_MEM_DEBUG
|
||||
default n
|
||||
help
|
||||
Enable Bluedroid memory usage statistics
|
||||
|
||||
config BT_BLUEDROID_THREAD_DEBUG
|
||||
bool "Bluedroid thread debug"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
default n
|
||||
help
|
||||
Enable Bluedroid thread debug mode.
|
||||
Used to debug whether the thread is blocked and
|
||||
dump information about the thread’s related work queue.
|
||||
|
||||
config BT_BLUEDROID_THREAD_BLOCK_TIME
|
||||
int "OSI thread block time (in ms)"
|
||||
depends on BT_BLUEDROID_THREAD_DEBUG
|
||||
default 1000
|
||||
help
|
||||
Indicates how long it takes for the thread to execute an item
|
||||
before it is considered blocked.
|
||||
|
||||
config BT_BLUEDROID_THREAD_BLOCK_MSG
|
||||
int "OSI thread block message count"
|
||||
depends on BT_BLUEDROID_THREAD_DEBUG
|
||||
default 50
|
||||
help
|
||||
Indicates how many messages are added to the queue
|
||||
while the threadis executing an item before it is considered blocked.
|
||||
endmenu #BT debug option
|
||||
|
||||
config BT_STACK_NO_LOG
|
||||
bool "Disable BT debug logs (minimize bin size)"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
@@ -1302,7 +1354,7 @@ config BT_BLE_RPA_TIMEOUT
|
||||
Default is 900 s (15 minutes). Range is 1 s to 1 hour (3600 s).
|
||||
|
||||
menuconfig BT_BLE_50_FEATURES_SUPPORTED
|
||||
bool "Enable BLE 5.0 features(please disable BLE 4.2 if enable BLE 5.0)"
|
||||
bool "Enable BLE 5.0 and above features(please disable BLE 4.2 if enable BLE 5.0)"
|
||||
depends on (BT_BLE_ENABLED && ((BT_CONTROLLER_ENABLED && SOC_BLE_50_SUPPORTED) || BT_CONTROLLER_DISABLED))
|
||||
default y
|
||||
help
|
||||
@@ -1366,36 +1418,15 @@ config BT_BLE_FEAT_CREATE_SYNC_ENH
|
||||
help
|
||||
Enable the create sync enhancements
|
||||
|
||||
menuconfig BT_BLE_42_FEATURES_SUPPORTED
|
||||
bool "Enable BLE 4.2 features(please disable BLE 5.0 if enable BLE 4.2)"
|
||||
depends on BT_BLE_ENABLED
|
||||
default y if IDF_TARGET_ESP32
|
||||
default n
|
||||
config BT_BLE_FEAT_CREATE_SYNC_RETRY_MAX
|
||||
int "Maximum retry count for periodic advertising create sync"
|
||||
depends on BT_BLE_50_EXTEND_SYNC_EN
|
||||
default 3
|
||||
range 0 16
|
||||
help
|
||||
This enables BLE 4.2 features.
|
||||
This option is universally supported by all ESP chips with BLE capabilities.
|
||||
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
|
||||
|
||||
config BT_BLE_42_DTM_TEST_EN
|
||||
bool "Enable BLE 4.2 DTM test"
|
||||
depends on BT_BLE_42_FEATURES_SUPPORTED
|
||||
default y
|
||||
help
|
||||
This enables BLE 4.2 direct test mode
|
||||
|
||||
config BT_BLE_42_ADV_EN
|
||||
bool "Enable BLE 4.2 advertising"
|
||||
depends on BT_BLE_42_FEATURES_SUPPORTED
|
||||
default y
|
||||
help
|
||||
This enables BLE v4.2 advertising
|
||||
|
||||
config BT_BLE_42_SCAN_EN
|
||||
bool "Enable BLE 4.2 scan"
|
||||
depends on BT_BLE_42_FEATURES_SUPPORTED
|
||||
default y
|
||||
help
|
||||
This enables BLE v4.2 scan
|
||||
Set the maximum retry count when periodic advertising create sync fails
|
||||
with error code 0x3E (Connection Failed to be Established).
|
||||
Set to 0 to disable retry. Default is 3.
|
||||
|
||||
menuconfig BT_BLE_FEAT_ISO_EN
|
||||
bool "Enable BLE 5.2 iso feature"
|
||||
@@ -1509,6 +1540,58 @@ config BT_BLE_FEAT_CONN_SUBRATING
|
||||
help
|
||||
Enable BLE connection subrating feature
|
||||
|
||||
config BT_BLE_FEAT_PAWR_EN
|
||||
bool "Enable Periodic Advertisement with Response(PAwR)"
|
||||
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_PAWR_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
|
||||
default n
|
||||
help
|
||||
Enable BLE Periodic Advertisement with Response(PAwR) feature
|
||||
|
||||
config BT_BLE_FEAT_ADV_CODING_SELECTION
|
||||
bool "Enable Advertising Coding Selection"
|
||||
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_ADV_CODING_SELECT_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
|
||||
default n
|
||||
help
|
||||
Enable Advertising Coding Selection
|
||||
|
||||
config BT_BLE_FEAT_CHANNEL_SOUNDING
|
||||
bool "Enable BLE channel sounding"
|
||||
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_CHANNEL_SOUNDING_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
|
||||
default n
|
||||
help
|
||||
Enable BLE channel sounding
|
||||
|
||||
menuconfig BT_BLE_42_FEATURES_SUPPORTED
|
||||
bool "Enable BLE 4.2 features(please disable BLE 5.0 if enable BLE 4.2)"
|
||||
depends on BT_BLE_ENABLED
|
||||
default y if IDF_TARGET_ESP32
|
||||
default n
|
||||
help
|
||||
This enables BLE 4.2 features.
|
||||
This option is universally supported by all ESP chips with BLE capabilities.
|
||||
BLE 4.2 and BLE 5.0 cannot be used simultaneously.
|
||||
|
||||
config BT_BLE_42_DTM_TEST_EN
|
||||
bool "Enable BLE 4.2 DTM test"
|
||||
depends on BT_BLE_42_FEATURES_SUPPORTED
|
||||
default y
|
||||
help
|
||||
This enables BLE 4.2 direct test mode
|
||||
|
||||
config BT_BLE_42_ADV_EN
|
||||
bool "Enable BLE 4.2 advertising"
|
||||
depends on BT_BLE_42_FEATURES_SUPPORTED
|
||||
default y
|
||||
help
|
||||
This enables BLE v4.2 advertising
|
||||
|
||||
config BT_BLE_42_SCAN_EN
|
||||
bool "Enable BLE 4.2 scan"
|
||||
depends on BT_BLE_42_FEATURES_SUPPORTED
|
||||
default y
|
||||
help
|
||||
This enables BLE v4.2 scan
|
||||
|
||||
config BT_BLE_VENDOR_HCI_EN
|
||||
bool "Enable BLE Vendor HCI command and event"
|
||||
depends on BT_BLE_ENABLED
|
||||
|
||||
@@ -37,6 +37,10 @@ esp_err_t esp_ble_iso_create_big(esp_ble_iso_big_creat_params_t *big_creat_param
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (big_creat_param->num_bis > BLE_ISO_BIS_MAX_COUNT) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_ISO_BLE;
|
||||
msg.act = BTC_ISO_ACT_BIG_CREATE;
|
||||
@@ -58,6 +62,10 @@ esp_err_t esp_ble_iso_create_big_test(esp_ble_iso_big_creat_test_params_t *big_c
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (big_creat_test_param->num_bis > BLE_ISO_BIS_MAX_COUNT) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_ISO_BLE;
|
||||
msg.act = BTC_ISO_ACT_BIG_CREATE_TEST;
|
||||
|
||||
@@ -153,6 +153,13 @@ esp_err_t esp_bluedroid_init_with_cfg(esp_bluedroid_config_t *cfg)
|
||||
osi_mem_dbg_init();
|
||||
#endif
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
if (osi_mem_init() != 0) {
|
||||
LOG_ERROR("Bluedroid Initialize Fail");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = bluedroid_config_init(cfg);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
LOG_ERROR("Bluedroid stack initialize fail, ret:%d", ret);
|
||||
@@ -243,6 +250,10 @@ esp_err_t esp_bluedroid_deinit(void)
|
||||
bt_hci_log_deinit();
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
|
||||
#if HEAP_MEMORY_STATS
|
||||
osi_mem_deinit();
|
||||
#endif
|
||||
|
||||
s_bt_host_state = ESP_BLUEDROID_STATUS_UNINITIALIZED;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -440,6 +440,28 @@ esp_err_t esp_ble_gap_get_device_name(void)
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
esp_err_t esp_ble_gap_set_key_material(const uint8_t session_key[16], const uint8_t iv[8])
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (session_key == NULL || iv == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_SET_KEY_MATERIAL;
|
||||
memcpy(arg.set_key_material.session_key, session_key, 16);
|
||||
memcpy(arg.set_key_material.iv, iv, 8);
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gap_get_local_used_addr(esp_bd_addr_t local_used_addr, uint8_t * addr_type)
|
||||
{
|
||||
if(esp_bluedroid_get_status() != (ESP_BLUEDROID_STATUS_ENABLED)) {
|
||||
@@ -502,6 +524,29 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l
|
||||
btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_data_len)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if ((raw_data_len != 0 && raw_data == NULL) || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_CFG_SCAN_RSP_DATA_RAW;
|
||||
arg.cfg_scan_rsp_data_raw.raw_scan_rsp = raw_data;
|
||||
arg.cfg_scan_rsp_data_raw.raw_scan_rsp_len = raw_data_len;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy,
|
||||
btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
|
||||
}
|
||||
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr)
|
||||
@@ -525,28 +570,7 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr)
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_data_len)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if ((raw_data_len != 0 && raw_data == NULL) || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_CFG_SCAN_RSP_DATA_RAW;
|
||||
arg.cfg_scan_rsp_data_raw.raw_scan_rsp = raw_data;
|
||||
arg.cfg_scan_rsp_data_raw.raw_scan_rsp_len = raw_data_len;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy,
|
||||
btc_gap_ble_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
|
||||
}
|
||||
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
|
||||
esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
|
||||
{
|
||||
@@ -614,7 +638,8 @@ esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_e
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
|
||||
void *value, uint8_t len)
|
||||
@@ -1940,6 +1965,10 @@ esp_err_t esp_ble_gap_set_path_loss_reporting_params(esp_ble_path_loss_rpt_param
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (path_loss_rpt_params == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_PATH_LOSS_REPORT_PARAMS;
|
||||
@@ -2006,7 +2035,7 @@ esp_err_t esp_ble_gap_set_default_subrate(esp_ble_default_subrate_param_t *defau
|
||||
}
|
||||
|
||||
if (!default_subrate_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
@@ -2033,7 +2062,7 @@ esp_err_t esp_ble_gap_subrate_request(esp_ble_subrate_req_param_t *subrate_req_p
|
||||
}
|
||||
|
||||
if (!subrate_req_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
@@ -2082,3 +2111,437 @@ esp_err_t esp_ble_gap_set_host_feature(uint16_t bit_num, uint8_t bit_val)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
esp_err_t esp_ble_gap_set_periodic_adv_subevent_data(esp_ble_per_adv_subevent_data_params *subevent_data_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if ((!subevent_data_params) || (!subevent_data_params->subevent_params)) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
if ((subevent_data_params->num_subevents_with_data > 0x0F) || (!subevent_data_params->num_subevents_with_data)) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < subevent_data_params->num_subevents_with_data; i++)
|
||||
{
|
||||
if (subevent_data_params->subevent_params[i].subevent_data_len && (subevent_data_params->subevent_params[i].subevent_data == NULL)) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_PA_SUBEVT_DATA;
|
||||
|
||||
arg.per_adv_subevent_data_params.adv_handle = subevent_data_params->adv_handle;
|
||||
arg.per_adv_subevent_data_params.num_subevents_with_data = subevent_data_params->num_subevents_with_data;
|
||||
arg.per_adv_subevent_data_params.subevent_params = subevent_data_params->subevent_params;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_periodic_adv_response_data(esp_ble_per_adv_response_data_params *rsp_data_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!rsp_data_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
if ((rsp_data_params->response_data == NULL) && rsp_data_params->response_data_len) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_PA_RSP_DATA;
|
||||
|
||||
arg.per_adv_response_data_params.sync_handle = rsp_data_params->sync_handle;
|
||||
arg.per_adv_response_data_params.request_event = rsp_data_params->request_event;
|
||||
arg.per_adv_response_data_params.request_subevent = rsp_data_params->request_subevent;
|
||||
arg.per_adv_response_data_params.response_subevent = rsp_data_params->response_subevent;
|
||||
arg.per_adv_response_data_params.response_slot = rsp_data_params->response_slot;
|
||||
arg.per_adv_response_data_params.response_data_len = rsp_data_params->response_data_len;
|
||||
arg.per_adv_response_data_params.response_data = rsp_data_params->response_data;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_periodic_sync_subevent(esp_ble_per_sync_subevent_params *sync_subevent_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!sync_subevent_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
if ((sync_subevent_params->subevent == NULL) && sync_subevent_params->num_subevents_to_sync) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_PA_SYNC_SUBEVT;
|
||||
|
||||
arg.per_sync_subevent_params.sync_handle = sync_subevent_params->sync_handle;
|
||||
arg.per_sync_subevent_params.periodic_adv_properties = sync_subevent_params->periodic_adv_properties;
|
||||
arg.per_sync_subevent_params.num_subevents_to_sync = sync_subevent_params->num_subevents_to_sync;
|
||||
arg.per_sync_subevent_params.subevent = sync_subevent_params->subevent;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
esp_err_t esp_ble_cs_read_local_supported_capabilities(void)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_READ_LOCAL_SUPPORTED_CAPS;
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_read_remote_supported_capabilities(uint16_t conn_handle)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_READ_REMOTE_SUPPORTED_CAPS;
|
||||
|
||||
arg.cs_read_remote_supp_caps.conn_handle = conn_handle;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_write_cached_remote_supported_capabilities(esp_ble_cs_write_cached_remote_supp_caps_params *cached_remote_supp_caps_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg = {0};
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!cached_remote_supp_caps_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPS;
|
||||
|
||||
arg.cs_write_cached_remote_supp_caps.conn_handle = cached_remote_supp_caps_params->conn_handle;
|
||||
arg.cs_write_cached_remote_supp_caps.num_config_supported = cached_remote_supp_caps_params->num_config_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.max_consecutive_proc_supported = cached_remote_supp_caps_params->max_consecutive_proc_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.num_ant_supported = cached_remote_supp_caps_params->num_ant_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.max_ant_paths_supported = cached_remote_supp_caps_params->max_ant_paths_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.modes_supported = cached_remote_supp_caps_params->modes_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.rtt_capability = cached_remote_supp_caps_params->rtt_capability;
|
||||
arg.cs_write_cached_remote_supp_caps.rtt_aa_only_n = cached_remote_supp_caps_params->rtt_aa_only_n;
|
||||
arg.cs_write_cached_remote_supp_caps.rtt_sounding_n = cached_remote_supp_caps_params->rtt_sounding_n;
|
||||
arg.cs_write_cached_remote_supp_caps.rtt_random_payload_n = cached_remote_supp_caps_params->rtt_random_payload_n;
|
||||
arg.cs_write_cached_remote_supp_caps.NADM_sounding_capability = cached_remote_supp_caps_params->NADM_sounding_capability;
|
||||
arg.cs_write_cached_remote_supp_caps.NADM_random_capability = cached_remote_supp_caps_params->NADM_random_capability;
|
||||
arg.cs_write_cached_remote_supp_caps.subfeatures_supported = cached_remote_supp_caps_params->subfeatures_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.T_IP1_times_supported = cached_remote_supp_caps_params->T_IP1_times_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.T_IP2_times_supported = cached_remote_supp_caps_params->T_IP2_times_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.T_FCS_times_supported = cached_remote_supp_caps_params->T_FCS_times_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.T_PM_times_supported = cached_remote_supp_caps_params->T_PM_times_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.T_SW_times_supported = cached_remote_supp_caps_params->T_SW_times_supported;
|
||||
arg.cs_write_cached_remote_supp_caps.TX_SNR_capability = cached_remote_supp_caps_params->TX_SNR_capability;
|
||||
if (cached_remote_supp_caps_params->initiator_role_supported) {
|
||||
arg.cs_write_cached_remote_supp_caps.roles_supported |= ESP_BLE_CS_INITIATOR_ROLE_SUPPORTED;
|
||||
}
|
||||
if (cached_remote_supp_caps_params->reflector_role_supported) {
|
||||
arg.cs_write_cached_remote_supp_caps.roles_supported |= ESP_BLE_CS_REFLECTOR_ROLE_SUPPORTED;
|
||||
}
|
||||
if (cached_remote_supp_caps_params->cs_sync_2m_phy_supported) {
|
||||
arg.cs_write_cached_remote_supp_caps.cs_sync_phys_supported |= ESP_BLE_CS_SYNC_PHYS_2M_SUPPORTED;
|
||||
}
|
||||
if (cached_remote_supp_caps_params->cs_sync_2m_2bt_phy_supported) {
|
||||
arg.cs_write_cached_remote_supp_caps.cs_sync_phys_supported |= ESP_BLE_CS_SYNC_PHYS_2M_2BT_SUPPORTED;
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_security_enable(uint16_t conn_handle)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_SECURITY_ENABLE;
|
||||
|
||||
arg.cs_security_enable.conn_handle = conn_handle;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_set_default_settings(esp_ble_cs_set_default_settings_params *default_setting_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg = {0};
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!default_setting_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_SET_DEFAULT_SETTINGS;
|
||||
|
||||
arg.cs_set_default_settings_params.conn_handle = default_setting_params->conn_handle;
|
||||
arg.cs_set_default_settings_params.cs_sync_ant_selection = default_setting_params->cs_sync_ant_selection;
|
||||
arg.cs_set_default_settings_params.max_tx_power = default_setting_params->max_tx_power;
|
||||
if (default_setting_params->initiator_role_enable) {
|
||||
arg.cs_set_default_settings_params.role_enable |= ESP_BLE_CS_INITIATOR_ROLE_ENABLED;
|
||||
}
|
||||
if (default_setting_params->reflector_role_enable) {
|
||||
arg.cs_set_default_settings_params.role_enable |= ESP_BLE_CS_REFLECTOR_ROLE_ENABLED;
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_read_remote_fae_table(uint16_t conn_handle)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_READ_REMOTE_FAE_TABLE;
|
||||
|
||||
arg.cs_read_remote_tab.conn_handle = conn_handle;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_write_cached_remote_fae_table(esp_ble_cs_write_cached_remote_fae_table_params *write_cached_remote_fae_tab_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg = {0};
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!write_cached_remote_fae_tab_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_WRITE_CACHED_REMOTE_FAE_TABLE;
|
||||
|
||||
arg.cs_write_cached_remote_fae_table_params.conn_handle = write_cached_remote_fae_tab_params->conn_handle;
|
||||
memcpy(arg.cs_write_cached_remote_fae_table_params.remote_fae_table, write_cached_remote_fae_tab_params->remote_fae_table, sizeof(arg.cs_write_cached_remote_fae_table_params.remote_fae_table));
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_create_config(esp_ble_cs_create_config_params *create_config_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg = {0};
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!create_config_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
arg.cs_create_config_params.conn_handle = create_config_params->conn_handle;
|
||||
arg.cs_create_config_params.config_id = create_config_params->config_id;
|
||||
arg.cs_create_config_params.create_context = create_config_params->create_context;
|
||||
arg.cs_create_config_params.main_mode_type = create_config_params->main_mode_type;
|
||||
arg.cs_create_config_params.sub_mode_type = create_config_params->sub_mode_type;
|
||||
arg.cs_create_config_params.min_main_mode_steps = create_config_params->min_main_mode_steps;
|
||||
arg.cs_create_config_params.max_main_mode_steps = create_config_params->max_main_mode_steps;
|
||||
arg.cs_create_config_params.main_mode_repetition = create_config_params->main_mode_repetition;
|
||||
arg.cs_create_config_params.mode_0_steps = create_config_params->mode_0_steps;
|
||||
arg.cs_create_config_params.role = create_config_params->role;
|
||||
arg.cs_create_config_params.rtt_type = create_config_params->rtt_type;
|
||||
arg.cs_create_config_params.cs_sync_phy = create_config_params->cs_sync_phy;
|
||||
memcpy(arg.cs_create_config_params.channel_map, create_config_params->channel_map, sizeof(arg.cs_create_config_params.channel_map));
|
||||
arg.cs_create_config_params.channel_map_repetition = create_config_params->channel_map_repetition;
|
||||
arg.cs_create_config_params.channel_selection_type = create_config_params->channel_selection_type;
|
||||
arg.cs_create_config_params.ch3c_shape = create_config_params->ch3c_shape;
|
||||
arg.cs_create_config_params.ch3c_jump = create_config_params->ch3c_jump;
|
||||
arg.cs_create_config_params.reserved = create_config_params->reserved;
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_CREATE_CONFIG;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_remove_config(esp_ble_cs_remove_config_params *remove_config_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!remove_config_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_REMOVE_CONFIG;
|
||||
|
||||
arg.cs_remove_config_params.conn_handle = remove_config_params->conn_handle;
|
||||
arg.cs_remove_config_params.config_id = remove_config_params->config_id;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_set_channel_classification(esp_ble_cs_set_channel_class_params *channel_class_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!channel_class_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_SET_CAHNNEL_CLASSIFICATION;
|
||||
|
||||
memcpy(arg.cs_set_channel_class_params.channel_class, channel_class_params->channel_class, sizeof(arg.cs_set_channel_class_params));
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_set_procedure_params(esp_ble_cs_set_proc_params *procedure_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!procedure_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_SET_PROCEDURE_PARAMS;
|
||||
|
||||
arg.cs_set_procedure_params.conn_handle = procedure_params->conn_handle;
|
||||
arg.cs_set_procedure_params.config_id = procedure_params->config_id;
|
||||
arg.cs_set_procedure_params.max_procedure_len = procedure_params->max_procedure_len;
|
||||
arg.cs_set_procedure_params.min_procedure_interval = procedure_params->min_procedure_interval;
|
||||
arg.cs_set_procedure_params.max_procedure_interval = procedure_params->max_procedure_interval;
|
||||
arg.cs_set_procedure_params.max_procedure_count = procedure_params->max_procedure_count;
|
||||
arg.cs_set_procedure_params.min_subevent_len = (procedure_params->min_subevent_len & 0x00FFFFFF);
|
||||
arg.cs_set_procedure_params.max_subevent_len = (procedure_params->max_subevent_len & 0x00FFFFFF);
|
||||
arg.cs_set_procedure_params.tone_ant_config_selection = procedure_params->tone_ant_config_selection;
|
||||
arg.cs_set_procedure_params.phy = procedure_params->phy;
|
||||
arg.cs_set_procedure_params.tx_power_delta = procedure_params->tx_power_delta;
|
||||
arg.cs_set_procedure_params.preferred_peer_antenna = procedure_params->preferred_peer_antenna;
|
||||
arg.cs_set_procedure_params.SNR_control_initiator = procedure_params->SNR_control_initiator;
|
||||
arg.cs_set_procedure_params.SNR_control_reflector = procedure_params->SNR_control_reflector;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_cs_procedure_enable(esp_ble_cs_procedure_enable_params *procedure_enable_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!procedure_enable_params) {
|
||||
return ESP_ERR_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_CS_PROCEDURE_ENABLE;
|
||||
|
||||
arg.cs_procedure_enable_params.conn_handle = procedure_enable_params->conn_handle;
|
||||
arg.cs_procedure_enable_params.config_id = procedure_enable_params->config_id;
|
||||
arg.cs_procedure_enable_params.enable = procedure_enable_params->enable;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -88,6 +88,11 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn
|
||||
arg.open.remote_addr_type = creat_conn_params->remote_addr_type;
|
||||
arg.open.is_direct = creat_conn_params->is_direct;
|
||||
arg.open.is_aux= creat_conn_params->is_aux;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
arg.open.is_pawr_synced = false;
|
||||
arg.open.adv_handle = 0xFF;
|
||||
arg.open.subevent = 0xFF;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
arg.open.own_addr_type = creat_conn_params->own_addr_type;
|
||||
arg.open.phy_mask = creat_conn_params->phy_mask;
|
||||
|
||||
@@ -206,6 +211,106 @@ esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bd
|
||||
}
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
esp_err_t esp_ble_gattc_aux_open_with_pawr_synced(esp_gatt_if_t gattc_if, esp_ble_gatt_pawr_conn_params_t *pawr_conn_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gattc_args_t arg;
|
||||
const esp_ble_conn_params_t *conn_params;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (!pawr_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_OPEN;
|
||||
arg.open.gattc_if = gattc_if;
|
||||
memcpy(arg.open.remote_bda, pawr_conn_params->remote_bda, ESP_BD_ADDR_LEN);
|
||||
arg.open.remote_addr_type = pawr_conn_params->remote_addr_type;
|
||||
arg.open.is_direct = true;
|
||||
arg.open.is_aux = true;
|
||||
arg.open.is_pawr_synced = true;
|
||||
arg.open.adv_handle = pawr_conn_params->adv_handle;
|
||||
arg.open.subevent = pawr_conn_params->subevent;
|
||||
arg.open.own_addr_type = pawr_conn_params->own_addr_type;
|
||||
arg.open.phy_mask = pawr_conn_params->phy_mask;
|
||||
|
||||
if (pawr_conn_params->phy_mask & ESP_BLE_PHY_1M_PREF_MASK) {
|
||||
if (!pawr_conn_params->phy_1m_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
conn_params = pawr_conn_params->phy_1m_conn_params;
|
||||
if (ESP_BLE_IS_VALID_PARAM(conn_params->interval_min, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->interval_max, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->supervision_timeout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
|
||||
(conn_params->latency <= ESP_BLE_CONN_LATENCY_MAX) &&
|
||||
((conn_params->supervision_timeout * 10) >= ((1 + conn_params->latency) * ((conn_params->interval_max * 5) >> 1))) &&
|
||||
(conn_params->interval_min <= conn_params->interval_max)) {
|
||||
memcpy(&arg.open.phy_1m_conn_params, conn_params, sizeof(esp_ble_conn_params_t));
|
||||
} else {
|
||||
LOG_ERROR("%s, invalid 1M PHY connection params: min_int = %d, max_int = %d, latency = %d, timeout = %d", __func__,
|
||||
conn_params->interval_min,
|
||||
conn_params->interval_max,
|
||||
conn_params->latency,
|
||||
conn_params->supervision_timeout);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
if (pawr_conn_params->phy_mask & ESP_BLE_PHY_2M_PREF_MASK) {
|
||||
if (!pawr_conn_params->phy_2m_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
conn_params = pawr_conn_params->phy_2m_conn_params;
|
||||
if (ESP_BLE_IS_VALID_PARAM(conn_params->interval_min, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->interval_max, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->supervision_timeout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
|
||||
(conn_params->latency <= ESP_BLE_CONN_LATENCY_MAX) &&
|
||||
((conn_params->supervision_timeout * 10) >= ((1 + conn_params->latency) * ((conn_params->interval_max * 5) >> 1))) &&
|
||||
(conn_params->interval_min <= conn_params->interval_max)) {
|
||||
memcpy(&arg.open.phy_2m_conn_params, conn_params, sizeof(esp_ble_conn_params_t));
|
||||
} else {
|
||||
LOG_ERROR("%s, invalid 2M PHY connection params: min_int = %d, max_int = %d, latency = %d, timeout = %d", __func__,
|
||||
conn_params->interval_min,
|
||||
conn_params->interval_max,
|
||||
conn_params->latency,
|
||||
conn_params->supervision_timeout);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
if (pawr_conn_params->phy_mask & ESP_BLE_PHY_CODED_PREF_MASK) {
|
||||
if (!pawr_conn_params->phy_coded_conn_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
conn_params = pawr_conn_params->phy_coded_conn_params;
|
||||
if (ESP_BLE_IS_VALID_PARAM(conn_params->interval_min, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->interval_max, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
|
||||
ESP_BLE_IS_VALID_PARAM(conn_params->supervision_timeout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
|
||||
(conn_params->latency <= ESP_BLE_CONN_LATENCY_MAX) &&
|
||||
((conn_params->supervision_timeout * 10) >= ((1 + conn_params->latency) * ((conn_params->interval_max * 5) >> 1))) &&
|
||||
(conn_params->interval_min <= conn_params->interval_max)) {
|
||||
memcpy(&arg.open.phy_coded_conn_params, conn_params, sizeof(esp_ble_conn_params_t));
|
||||
} else {
|
||||
LOG_ERROR("%s, invalid Coded PHY connection params: min_int = %d, max_int = %d, latency = %d, timeout = %d", __func__,
|
||||
conn_params->interval_min,
|
||||
conn_params->interval_max,
|
||||
conn_params->latency,
|
||||
conn_params->supervision_timeout);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gattc_close (esp_gatt_if_t gattc_if, uint16_t conn_id)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
@@ -19,56 +19,44 @@ extern "C" {
|
||||
|
||||
typedef uint16_t esp_a2d_conn_hdl_t; /*!< Connection handle, associate with specific device that connected */
|
||||
|
||||
/**
|
||||
* @brief Media codec types supported by A2DP.
|
||||
*/
|
||||
/* Media codec types supported by A2DP. */
|
||||
#define ESP_A2D_MCT_SBC (0) /*!< SBC */
|
||||
#define ESP_A2D_MCT_M12 (0x01) /*!< MPEG-1, 2 Audio */
|
||||
#define ESP_A2D_MCT_M24 (0x02) /*!< MPEG-2, 4 AAC */
|
||||
#define ESP_A2D_MCT_ATRAC (0x04) /*!< ATRAC family */
|
||||
#define ESP_A2D_MCT_NON_A2DP (0xff) /*!< NON-A2DP */
|
||||
typedef uint8_t esp_a2d_mct_t;
|
||||
typedef uint8_t esp_a2d_mct_t; /*!< Media codec type of A2DP */
|
||||
|
||||
/**
|
||||
* @brief Protocol service capabilities. This value is a mask.
|
||||
*/
|
||||
/* Protocol service capabilities. This value is a mask. */
|
||||
#define ESP_A2D_PSC_DELAY_RPT (1<<0) /*!< Delay Report */
|
||||
typedef uint16_t esp_a2d_psc_t;
|
||||
typedef uint16_t esp_a2d_psc_t; /*!< Protocol service capabilities type */
|
||||
|
||||
/**
|
||||
* @brief A2DP SBC sampling frequency bit mask in CIE
|
||||
*/
|
||||
/* A2DP SBC sampling frequency bit mask in CIE */
|
||||
#define ESP_A2D_SBC_CIE_SF_16K (0x8) /*!< SBC sampling frequency 16kHz */
|
||||
#define ESP_A2D_SBC_CIE_SF_32K (0x4) /*!< SBC sampling frequency 32kHz */
|
||||
#define ESP_A2D_SBC_CIE_SF_44K (0x2) /*!< SBC sampling frequency 44.1kHz */
|
||||
#define ESP_A2D_SBC_CIE_SF_48K (0x1) /*!< SBC sampling frequency 48kHz */
|
||||
|
||||
/**
|
||||
* @brief A2DP SBC channel mode bit mask in CIE
|
||||
*/
|
||||
/* A2DP SBC channel mode bit mask in CIE */
|
||||
#define ESP_A2D_SBC_CIE_CH_MODE_MONO (0x8) /*!< SBC channel mode Mono */
|
||||
#define ESP_A2D_SBC_CIE_CH_MODE_DUAL_CHANNEL (0x4) /*!< SBC channel mode Dual Channel */
|
||||
#define ESP_A2D_SBC_CIE_CH_MODE_STEREO (0x2) /*!< SBC channel mode Stereo */
|
||||
#define ESP_A2D_SBC_CIE_CH_MODE_JOINT_STEREO (0x1) /*!< SBC channel mode Stereo */
|
||||
#define ESP_A2D_SBC_CIE_CH_MODE_JOINT_STEREO (0x1) /*!< SBC channel mode Joint Stereo */
|
||||
|
||||
/**
|
||||
* @brief A2DP SBC block length bit mask in CIE
|
||||
*/
|
||||
/* A2DP SBC block length bit mask in CIE */
|
||||
#define ESP_A2D_SBC_CIE_BLOCK_LEN_4 (0x8) /*!< SBC block length 4 */
|
||||
#define ESP_A2D_SBC_CIE_BLOCK_LEN_8 (0x4) /*!< SBC block length 8 */
|
||||
#define ESP_A2D_SBC_CIE_BLOCK_LEN_12 (0x2) /*!< SBC block length 12 */
|
||||
#define ESP_A2D_SBC_CIE_BLOCK_LEN_16 (0x1) /*!< SBC block length 16 */
|
||||
|
||||
/**
|
||||
* @brief A2DP SBC number of subbands bit mask in CIE
|
||||
*/
|
||||
/* A2DP SBC number of subbands bit mask in CIE */
|
||||
#define ESP_A2D_SBC_CIE_NUM_SUBBANDS_4 (0x2) /*!< SBC number of subbands 4 */
|
||||
#define ESP_A2D_SBC_CIE_NUM_SUBBANDS_8 (0x1) /*!< SBC number of subbands 8 */
|
||||
|
||||
/**
|
||||
* @brief A2DP SBC allocation method bit mask in CIE
|
||||
*/
|
||||
#define ESP_A2D_SBC_CIE_ALLOC_MTHD_SRN (0x2) /*!< SBC allocation method SNR */
|
||||
/* A2DP SBC allocation method bit mask in CIE */
|
||||
#define ESP_A2D_SBC_CIE_ALLOC_MTHD_SNR (0x2) /*!< SBC allocation method SNR */
|
||||
/*!< @deprecated Renamed to ESP_A2D_SBC_CIE_ALLOC_MTHD_SNR */
|
||||
#define ESP_A2D_SBC_CIE_ALLOC_MTHD_SRN _Pragma("GCC warning \"'ESP_A2D_SBC_CIE_ALLOC_MTHD_SRN' macro is deprecated, use 'ESP_A2D_SBC_CIE_ALLOC_MTHD_SNR'\"") ESP_A2D_SBC_CIE_ALLOC_MTHD_SNR
|
||||
#define ESP_A2D_SBC_CIE_ALLOC_MTHD_LOUDNESS (0x1) /*!< SBC allocation method Loudness */
|
||||
|
||||
/**
|
||||
@@ -136,10 +124,10 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
esp_a2d_mct_t type; /*!< A2DP media codec type */
|
||||
#define ESP_A2D_CIE_LEN_SBC (4)
|
||||
#define ESP_A2D_CIE_LEN_M12 (4)
|
||||
#define ESP_A2D_CIE_LEN_M24 (6)
|
||||
#define ESP_A2D_CIE_LEN_ATRAC (7)
|
||||
#define ESP_A2D_CIE_LEN_SBC (4) /*!< SBC cie length */
|
||||
#define ESP_A2D_CIE_LEN_M12 (4) /*!< MPEG-1,2 cie length */
|
||||
#define ESP_A2D_CIE_LEN_M24 (6) /*!< MPEG-2,4 AAC cie length */
|
||||
#define ESP_A2D_CIE_LEN_ATRAC (7) /*!< ATRAC family cie length */
|
||||
union {
|
||||
uint8_t sbc[ESP_A2D_CIE_LEN_SBC] __attribute__((deprecated)); /*!< SBC codec capabilities, deprecated, use sbc_info instead */
|
||||
uint8_t m12[ESP_A2D_CIE_LEN_M12] __attribute__((deprecated)); /*!< MPEG-1,2 audio codec capabilities, deprecated, use m12_info instead */
|
||||
@@ -206,7 +194,7 @@ typedef enum {
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_A2D_DEINIT_SUCCESS = 0, /*!< A2DP profile deinit successful event */
|
||||
ESP_A2D_INIT_SUCCESS /*!< A2DP profile deinit successful event */
|
||||
ESP_A2D_INIT_SUCCESS /*!< A2DP profile init successful event */
|
||||
} esp_a2d_init_state_t;
|
||||
|
||||
/**
|
||||
@@ -245,7 +233,7 @@ typedef enum {
|
||||
ESP_A2D_AUDIO_CFG_EVT, /*!< audio codec is configured */
|
||||
ESP_A2D_MEDIA_CTRL_ACK_EVT, /*!< acknowledge event in response to media control commands */
|
||||
ESP_A2D_PROF_STATE_EVT, /*!< indicate a2dp init&deinit complete */
|
||||
ESP_A2D_SEP_REG_STATE_EVT, /*!< indicate a2dp steam endpoint register status */
|
||||
ESP_A2D_SEP_REG_STATE_EVT, /*!< indicate a2dp stream endpoint register status */
|
||||
ESP_A2D_SNK_PSC_CFG_EVT, /*!< protocol service capabilities configured,only used for A2DP SINK */
|
||||
ESP_A2D_SNK_SET_DELAY_VALUE_EVT, /*!< indicate a2dp sink set delay report value complete, only used for A2DP SINK */
|
||||
ESP_A2D_SNK_GET_DELAY_VALUE_EVT, /*!< indicate a2dp sink get delay report value complete, only used for A2DP SINK */
|
||||
@@ -353,9 +341,9 @@ typedef union {
|
||||
/**
|
||||
* @brief A2DP profile callback function type
|
||||
*
|
||||
* @param event : Event type
|
||||
* @param[in] event : Event type
|
||||
*
|
||||
* @param param : Pointer to callback parameter
|
||||
* @param[in] param : Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_a2d_cb_t)(esp_a2d_cb_event_t event, esp_a2d_cb_param_t *param);
|
||||
|
||||
@@ -602,7 +590,7 @@ esp_err_t esp_a2d_source_register_stream_endpoint(uint8_t seid, const esp_a2d_mc
|
||||
esp_err_t esp_a2d_source_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Send a audio buff with encoded audio data to sink, the audio data len shall not bigger than
|
||||
* @brief Send an audio buffer with encoded audio data to sink. The audio data length shall not be bigger than
|
||||
* audio connection mtu (retrieved from ESP_A2D_CONNECTION_STATE_EVT). if the return value is
|
||||
* ESP_OK, then the audio buff is consumed, otherwise, audio buff can be reused by user.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -18,9 +18,9 @@ extern "C" {
|
||||
|
||||
#define ESP_AVRC_TRANS_LABEL_MAX 15 /*!< max transaction label */
|
||||
|
||||
#define ESP_AVRC_CA_IMAGE_HANDLE_LEN 7 /* The image handle length is fixed to 7, specified by Basic Image Profile */
|
||||
#define ESP_AVRC_CA_MTU_MIN 255 /* Minimal MTU can be used in Cover Art OBEX connection */
|
||||
#define ESP_AVRC_CA_MTU_MAX 1691 /* Maximum MTU can be used in Cover Art OBEX connection */
|
||||
#define ESP_AVRC_CA_IMAGE_HANDLE_LEN 7 /*!< The image handle length is fixed to 7, specified by Basic Image Profile */
|
||||
#define ESP_AVRC_CA_MTU_MIN 255 /*!< Minimal MTU can be used in Cover Art OBEX connection */
|
||||
#define ESP_AVRC_CA_MTU_MAX 1691 /*!< Maximum MTU can be used in Cover Art OBEX connection */
|
||||
|
||||
/// AVRC feature bit mask
|
||||
typedef enum {
|
||||
@@ -113,7 +113,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
ESP_AVRC_PSTH_FILTER_ALLOWED_CMD = 0, /*!< all of the PASSTHROUGH commands that can possibly be used, immutable */
|
||||
ESP_AVRC_PSTH_FILTER_SUPPORTED_CMD = 1, /*!< PASSTHROUGH commands selectively supported according to the current configuration */
|
||||
ESP_AVRC_PSTH_FILTER_SUPPORT_MAX,
|
||||
ESP_AVRC_PSTH_FILTER_SUPPORT_MAX, /*!< Maximum value for PASSTHROUGH command filter */
|
||||
} esp_avrc_psth_filter_t;
|
||||
|
||||
/// AVRC passthrough command bit mask
|
||||
@@ -121,6 +121,7 @@ typedef struct {
|
||||
uint16_t bits[8]; /*!< bit mask representation of PASSTHROUGH commands */
|
||||
} esp_avrc_psth_bit_mask_t;
|
||||
|
||||
/// AVRC operation code bit mask
|
||||
typedef enum {
|
||||
ESP_AVRC_BIT_MASK_OP_TEST = 0, /*!< operation code to test a specific bit */
|
||||
ESP_AVRC_BIT_MASK_OP_SET = 1, /*!< operation code to set a specific bit */
|
||||
@@ -186,14 +187,14 @@ typedef enum {
|
||||
ESP_AVRC_RN_ADDRESSED_PLAYER_CHANGE = 0x0b, /*!< the addressed player changed */
|
||||
ESP_AVRC_RN_UIDS_CHANGE = 0x0c, /*!< UIDs changed */
|
||||
ESP_AVRC_RN_VOLUME_CHANGE = 0x0d, /*!< volume changed locally on TG */
|
||||
ESP_AVRC_RN_MAX_EVT
|
||||
ESP_AVRC_RN_MAX_EVT /*!< maximum value for notification event */
|
||||
} esp_avrc_rn_event_ids_t;
|
||||
|
||||
/// AVRC target notification event notification capability
|
||||
typedef enum {
|
||||
ESP_AVRC_RN_CAP_ALLOWED_EVT = 0, /*!< all of the notification events that can possibly be supported, immutable */
|
||||
ESP_AVRC_RN_CAP_SUPPORTED_EVT = 1, /*!< notification events selectively supported according to the current configuration */
|
||||
ESP_AVRC_RN_CAP_MAX,
|
||||
ESP_AVRC_RN_CAP_MAX, /*!< maximum value for the notification event capability */
|
||||
} esp_avrc_rn_evt_cap_t;
|
||||
|
||||
/// AVRC target notification event capability bit mask
|
||||
@@ -213,7 +214,7 @@ typedef enum {
|
||||
ESP_AVRC_PS_REPEAT_MODE = 0x02, /*!< repeat mode */
|
||||
ESP_AVRC_PS_SHUFFLE_MODE = 0x03, /*!< shuffle mode */
|
||||
ESP_AVRC_PS_SCAN_MODE = 0x04, /*!< scan mode on or off */
|
||||
ESP_AVRC_PS_MAX_ATTR
|
||||
ESP_AVRC_PS_MAX_ATTR /*!< Maximum value for player setting attribute ids*/
|
||||
} esp_avrc_ps_attr_ids_t;
|
||||
|
||||
/// AVRC equalizer modes
|
||||
@@ -232,9 +233,9 @@ typedef enum {
|
||||
|
||||
/// AVRC shuffle modes
|
||||
typedef enum {
|
||||
ESP_AVRC_PS_SHUFFLE_OFF = 0x1, /*<! shuffle off */
|
||||
ESP_AVRC_PS_SHUFFLE_ALL = 0x2, /*<! shuffle all tracks */
|
||||
ESP_AVRC_PS_SHUFFLE_GROUP = 0x3 /*<! group shuffle */
|
||||
ESP_AVRC_PS_SHUFFLE_OFF = 0x1, /*!< shuffle off */
|
||||
ESP_AVRC_PS_SHUFFLE_ALL = 0x2, /*!< shuffle all tracks */
|
||||
ESP_AVRC_PS_SHUFFLE_GROUP = 0x3 /*!< group shuffle */
|
||||
} esp_avrc_ps_shf_value_ids_t;
|
||||
|
||||
/// AVRC scan modes
|
||||
@@ -511,7 +512,7 @@ esp_err_t esp_avrc_ct_register_callback(esp_avrc_ct_cb_t callback);
|
||||
* @brief Initialize the bluetooth AVRCP controller module, This function should be called
|
||||
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
|
||||
* AVRC should be used along with A2DP and AVRC should be initialized before A2DP.
|
||||
* ESP_AVRC_CT_PROF_STATE_EVT with ESP_AVRC_INIT_SUCCESS will reported to the APP layer.
|
||||
* `ESP_AVRC_CT_PROF_STATE_EVT` with `ESP_AVRC_INIT_SUCCESS` will be reported to the APP layer.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
@@ -524,9 +525,9 @@ esp_err_t esp_avrc_ct_init(void);
|
||||
/**
|
||||
*
|
||||
* @brief De-initialize AVRCP controller module. This function should be called after
|
||||
* after esp_bluedroid_enable() completes successfully. Note: AVRC cannot work independently,
|
||||
* `esp_bluedroid_enable()` completes successfully. Note: AVRC cannot work independently,
|
||||
* AVRC should be used along with A2DP and AVRC should be deinitialized before A2DP.
|
||||
* ESP_AVRC_CT_PROF_STATE_EVT with ESP_AVRC_DEINIT_SUCCESS will reported to the APP layer.
|
||||
* `ESP_AVRC_CT_PROF_STATE_EVT` with `ESP_AVRC_DEINIT_SUCCESS` will be reported to the APP layer.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
@@ -702,6 +703,10 @@ esp_err_t esp_avrc_tg_deinit(void);
|
||||
* passthrough commands selected to be supported according to current configuration. The
|
||||
* configuration can be changed using esp_avrc_tg_set_psth_cmd_filter().
|
||||
*
|
||||
* @param[in] filter : The type of filter to retrieve.
|
||||
* @param[out] cmd_set : A pointer to a bit mask that will be populated with the passthrough commands according to the filter type.
|
||||
* Each bit in the mask corresponds to a specific passthrough command. This parameter should not be NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC TG is not initialized
|
||||
@@ -725,6 +730,9 @@ esp_err_t esp_avrc_tg_get_psth_cmd_filter(esp_avrc_psth_filter_t filter, esp_avr
|
||||
*
|
||||
* Filter type "ESP_AVRC_PSTH_FILTER_ALLOWED_CMD" does not apply to this function.
|
||||
*
|
||||
* @param[in] filter : The type of filter to set.
|
||||
* @param[in] cmd_set : A pointer to the bit mask of passthrough commands to support.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled
|
||||
@@ -765,6 +773,10 @@ bool esp_avrc_psth_bit_mask_operation(esp_avrc_bit_mask_op_t op, esp_avrc_psth_b
|
||||
* events selected to be supported under current configuration, The configuration can be
|
||||
* changed using esp_avrc_tg_set_rn_evt_cap().
|
||||
*
|
||||
* @param[in] cap : The type of capability to retrieve
|
||||
* @param[out] evt_set : A pointer to a bit mask that will store the event notification capabilities.
|
||||
* Each bit in the mask corresponds to a specific event. This parameter should not be NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled or AVRC TG is not initialized
|
||||
@@ -779,6 +791,9 @@ esp_err_t esp_avrc_tg_get_rn_evt_cap(esp_avrc_rn_evt_cap_t cap, esp_avrc_rn_evt_
|
||||
* bit mask representation in evt_set and must be a subset of allowed event IDs with current
|
||||
* implementation. This function should be called after esp_avrc_tg_init().
|
||||
*
|
||||
* @param[in] evt_set : A pointer to a bit mask representing the event notification capabilities to be set.
|
||||
* Each bit in the mask corresponds to a specific event. This parameter cannot be NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not enabled
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -16,7 +16,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/// RSSI threshold
|
||||
/** @deprecated This macro will be deprecated in future versions */
|
||||
#define ESP_BT_GAP_RSSI_HIGH_THRLD -20 /*!< High RSSI threshold */
|
||||
/** @deprecated This macro will be deprecated in future versions */
|
||||
#define ESP_BT_GAP_RSSI_LOW_THRLD -45 /*!< Low RSSI threshold */
|
||||
|
||||
/// Class of device
|
||||
@@ -38,16 +40,16 @@ typedef enum {
|
||||
ESP_BT_SET_COD_RESERVED_2 = 0x10, /*!< overwrite the two least significant bits reserved_2 whose default value is 0b00; other values of reserved_2 are invalid according to Bluetooth Core Specification 5.4 */
|
||||
} esp_bt_cod_mode_t;
|
||||
|
||||
#define ESP_BT_GAP_AFH_CHANNELS_LEN 10
|
||||
typedef uint8_t esp_bt_gap_afh_channels[ESP_BT_GAP_AFH_CHANNELS_LEN];
|
||||
#define ESP_BT_GAP_AFH_CHANNELS_LEN 10 /*!< length of AFH channel map in bytes */
|
||||
typedef uint8_t esp_bt_gap_afh_channels[ESP_BT_GAP_AFH_CHANNELS_LEN]; /*!< AFH channels */
|
||||
|
||||
|
||||
/// Discoverability and Connectability mode
|
||||
/// Connectability mode
|
||||
typedef enum {
|
||||
ESP_BT_NON_CONNECTABLE, /*!< Non-connectable */
|
||||
ESP_BT_CONNECTABLE, /*!< Connectable */
|
||||
} esp_bt_connection_mode_t;
|
||||
|
||||
/// Discoverability mode
|
||||
typedef enum {
|
||||
ESP_BT_NON_DISCOVERABLE, /*!< Non-discoverable */
|
||||
ESP_BT_LIMITED_DISCOVERABLE, /*!< Limited Discoverable */
|
||||
@@ -75,7 +77,7 @@ typedef struct {
|
||||
void *val; /*!< Device property value */
|
||||
} esp_bt_gap_dev_prop_t;
|
||||
|
||||
/// Extended Inquiry Response data type
|
||||
/* Extended Inquiry Response data type */
|
||||
#define ESP_BT_EIR_TYPE_FLAGS 0x01 /*!< Flag with information such as BR/EDR and LE support */
|
||||
#define ESP_BT_EIR_TYPE_INCMPL_16BITS_UUID 0x02 /*!< Incomplete list of 16-bit service UUIDs */
|
||||
#define ESP_BT_EIR_TYPE_CMPL_16BITS_UUID 0x03 /*!< Complete list of 16-bit service UUIDs */
|
||||
@@ -90,50 +92,50 @@ typedef struct {
|
||||
#define ESP_BT_EIR_TYPE_MANU_SPECIFIC 0xff /*!< Manufacturer specific data */
|
||||
#define ESP_BT_EIR_TYPE_MAX_NUM 12 /*!< MAX number of EIR type */
|
||||
|
||||
typedef uint8_t esp_bt_eir_type_t;
|
||||
typedef uint8_t esp_bt_eir_type_t; /*!< EIR type */
|
||||
|
||||
/* ACL Packet Types */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM1 0x0008
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH1 0x0010
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM3 0x0400
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH3 0x0800
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM5 0x4000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH5 0x8000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH1 0x0002
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH1 0x0004
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH3 0x0100
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH3 0x0200
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 0x1000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 0x2000
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM1 0x0008 /*!< DM1 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH1 0x0010 /*!< DH1 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM3 0x0400 /*!< DM3 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH3 0x0800 /*!< DH3 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DM5 0x4000 /*!< DM5 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_DH5 0x8000 /*!< DH5 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH1 0x0002 /*!< No 2-DH1 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH1 0x0004 /*!< No 3-DH1 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH3 0x0100 /*!< No 2-DH3 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH3 0x0200 /*!< No 3-DH3 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 0x1000 /*!< No 2-DH5 packet type mask */
|
||||
#define ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 0x2000 /*!< No 3-DH5 packet type mask */
|
||||
|
||||
// DM1 can not be disabled. All options are mandatory to include DM1.
|
||||
#define ESP_BT_ACL_DM1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM1 | 0x330e) /* 0x330e */
|
||||
#define ESP_BT_ACL_DH1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH1 | 0x330e) /* 0x331e */
|
||||
#define ESP_BT_ACL_DM3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM3 | 0x330e) /* 0x370e */
|
||||
#define ESP_BT_ACL_DH3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH3 | 0x330e) /* 0x3b0e */
|
||||
#define ESP_BT_ACL_DM5_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM5 | 0x330e) /* 0x730e */
|
||||
#define ESP_BT_ACL_DH5_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH5 | 0x330e) /* 0xb30e */
|
||||
#define ESP_BT_ACL_2_DH1_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH1 & 0x330e) /* 0x330c */
|
||||
#define ESP_BT_ACL_3_DH1_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH1 & 0x330e) /* 0x330a */
|
||||
#define ESP_BT_ACL_2_DH3_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH3 & 0x330e) /* 0x320e */
|
||||
#define ESP_BT_ACL_3_DH3_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH3 & 0x330e) /* 0x310e */
|
||||
#define ESP_BT_ACL_2_DH5_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 & 0x330e) /* 0x230e */
|
||||
#define ESP_BT_ACL_3_DH5_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 & 0x330e) /* 0x130e */
|
||||
/* DM1 can not be disabled. All options are mandatory to include DM1. */
|
||||
#define ESP_BT_ACL_DM1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM1 | 0x330e) /*!< 0x330e */
|
||||
#define ESP_BT_ACL_DH1_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH1 | 0x330e) /*!< 0x331e */
|
||||
#define ESP_BT_ACL_DM3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM3 | 0x330e) /*!< 0x370e */
|
||||
#define ESP_BT_ACL_DH3_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH3 | 0x330e) /*!< 0x3b0e */
|
||||
#define ESP_BT_ACL_DM5_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DM5 | 0x330e) /*!< 0x730e */
|
||||
#define ESP_BT_ACL_DH5_ONLY (ESP_BT_ACL_PKT_TYPES_MASK_DH5 | 0x330e) /*!< 0xb30e */
|
||||
#define ESP_BT_ACL_2_DH1_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH1 & 0x330e) /*!< 0x330c */
|
||||
#define ESP_BT_ACL_3_DH1_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH1 & 0x330e) /*!< 0x330a */
|
||||
#define ESP_BT_ACL_2_DH3_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH3 & 0x330e) /*!< 0x320e */
|
||||
#define ESP_BT_ACL_3_DH3_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH3 & 0x330e) /*!< 0x310e */
|
||||
#define ESP_BT_ACL_2_DH5_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_2_DH5 & 0x330e) /*!< 0x230e */
|
||||
#define ESP_BT_ACL_3_DH5_ONLY (~ESP_BT_ACL_PKT_TYPES_MASK_NO_3_DH5 & 0x330e) /*!< 0x130e */
|
||||
|
||||
typedef uint16_t esp_bt_acl_pkt_type_t;
|
||||
typedef uint16_t esp_bt_acl_pkt_type_t; /*!< ACL packet type */
|
||||
|
||||
/* Range of encryption key size */
|
||||
#define ESP_BT_ENC_KEY_SIZE_CTRL_MAX (16)
|
||||
#define ESP_BT_ENC_KEY_SIZE_CTRL_MIN (7)
|
||||
#define ESP_BT_ENC_KEY_SIZE_CTRL_MAX (16) /*!< Maximum of encryption key size */
|
||||
#define ESP_BT_ENC_KEY_SIZE_CTRL_MIN (7) /*!< Minimum of encryption key size */
|
||||
|
||||
/* ESP_BT_EIR_FLAG bit definition */
|
||||
#define ESP_BT_EIR_FLAG_LIMIT_DISC (0x01 << 0)
|
||||
#define ESP_BT_EIR_FLAG_GEN_DISC (0x01 << 1)
|
||||
#define ESP_BT_EIR_FLAG_BREDR_NOT_SPT (0x01 << 2)
|
||||
#define ESP_BT_EIR_FLAG_DMT_CONTROLLER_SPT (0x01 << 3)
|
||||
#define ESP_BT_EIR_FLAG_DMT_HOST_SPT (0x01 << 4)
|
||||
#define ESP_BT_EIR_FLAG_LIMIT_DISC (0x01 << 0) /*!< Limited discoverable flag */
|
||||
#define ESP_BT_EIR_FLAG_GEN_DISC (0x01 << 1) /*!< General discoverable flag */
|
||||
#define ESP_BT_EIR_FLAG_BREDR_NOT_SPT (0x01 << 2) /*!< BR/EDR not supported flag */
|
||||
#define ESP_BT_EIR_FLAG_DMT_CONTROLLER_SPT (0x01 << 3) /*!< DMT controller supported flag */
|
||||
#define ESP_BT_EIR_FLAG_DMT_HOST_SPT (0x01 << 4) /*!< DMT host supported flag */
|
||||
|
||||
#define ESP_BT_EIR_MAX_LEN 240
|
||||
#define ESP_BT_EIR_MAX_LEN 240 /*!< Maximum of EIR length */
|
||||
/// EIR data content, according to "Supplement to the Bluetooth Core Specification"
|
||||
typedef struct {
|
||||
bool fec_required; /*!< FEC is required or not, true by default */
|
||||
@@ -161,6 +163,7 @@ typedef enum {
|
||||
ESP_BT_COD_SRVC_INFORMATION = 0x400, /*!< Information, e.g., WEB-server, WAP-server */
|
||||
} esp_bt_cod_srvc_t;
|
||||
|
||||
/// Pin type
|
||||
typedef enum{
|
||||
ESP_BT_PIN_TYPE_VARIABLE = 0, /*!< Refer to BTM_PIN_TYPE_VARIABLE */
|
||||
ESP_BT_PIN_TYPE_FIXED = 1, /*!< Refer to BTM_PIN_TYPE_FIXED */
|
||||
@@ -169,29 +172,27 @@ typedef enum{
|
||||
#define ESP_BT_PIN_CODE_LEN 16 /*!< Max pin code length */
|
||||
typedef uint8_t esp_bt_pin_code_t[ESP_BT_PIN_CODE_LEN]; /*!< Pin Code (upto 128 bits) MSB is 0 */
|
||||
|
||||
/// SP parameter type
|
||||
typedef enum {
|
||||
ESP_BT_SP_IOCAP_MODE = 0, /*!< Set IO mode */
|
||||
//ESP_BT_SP_OOB_DATA, //TODO /*!< Set OOB data */
|
||||
} esp_bt_sp_param_t;
|
||||
|
||||
/* relate to BTM_IO_CAP_xxx in stack/btm_api.h */
|
||||
#define ESP_BT_IO_CAP_OUT 0 /*!< DisplayOnly */ /* relate to BTM_IO_CAP_OUT in stack/btm_api.h */
|
||||
#define ESP_BT_IO_CAP_IO 1 /*!< DisplayYesNo */ /* relate to BTM_IO_CAP_IO in stack/btm_api.h */
|
||||
#define ESP_BT_IO_CAP_IN 2 /*!< KeyboardOnly */ /* relate to BTM_IO_CAP_IN in stack/btm_api.h */
|
||||
#define ESP_BT_IO_CAP_NONE 3 /*!< NoInputNoOutput */ /* relate to BTM_IO_CAP_NONE in stack/btm_api.h */
|
||||
/* Input/Output capabilities */
|
||||
#define ESP_BT_IO_CAP_OUT 0 /*!< DisplayOnly */
|
||||
#define ESP_BT_IO_CAP_IO 1 /*!< DisplayYesNo */
|
||||
#define ESP_BT_IO_CAP_IN 2 /*!< KeyboardOnly */
|
||||
#define ESP_BT_IO_CAP_NONE 3 /*!< NoInputNoOutput */
|
||||
typedef uint8_t esp_bt_io_cap_t; /*!< Combination of the IO Capability */
|
||||
|
||||
|
||||
/* BTM Power manager modes */
|
||||
/* BT Power manager modes */
|
||||
#define ESP_BT_PM_MD_ACTIVE 0x00 /*!< Active mode */
|
||||
#define ESP_BT_PM_MD_HOLD 0x01 /*!< Hold mode */
|
||||
#define ESP_BT_PM_MD_SNIFF 0x02 /*!< Sniff mode */
|
||||
#define ESP_BT_PM_MD_PARK 0x03 /*!< Park state */
|
||||
typedef uint8_t esp_bt_pm_mode_t;
|
||||
typedef uint8_t esp_bt_pm_mode_t; /*!< BT Power manager mode type */
|
||||
|
||||
|
||||
|
||||
/// Bits of major service class field
|
||||
/* Bits of major service class field */
|
||||
#define ESP_BT_COD_SRVC_BIT_MASK (0xffe000) /*!< Major service bit mask */
|
||||
#define ESP_BT_COD_SRVC_BIT_OFFSET (13) /*!< Major service bit offset */
|
||||
|
||||
@@ -199,9 +200,9 @@ typedef uint8_t esp_bt_pm_mode_t;
|
||||
typedef enum {
|
||||
ESP_BT_COD_MAJOR_DEV_MISC = 0, /*!< Miscellaneous */
|
||||
ESP_BT_COD_MAJOR_DEV_COMPUTER = 1, /*!< Computer */
|
||||
ESP_BT_COD_MAJOR_DEV_PHONE = 2, /*!< Phone(cellular, cordless, pay phone, modem */
|
||||
ESP_BT_COD_MAJOR_DEV_PHONE = 2, /*!< Phone (cellular, cordless, pay phone, modem) */
|
||||
ESP_BT_COD_MAJOR_DEV_LAN_NAP = 3, /*!< LAN, Network Access Point */
|
||||
ESP_BT_COD_MAJOR_DEV_AV = 4, /*!< Audio/Video(headset, speaker, stereo, video display, VCR */
|
||||
ESP_BT_COD_MAJOR_DEV_AV = 4, /*!< Audio/Video (headset, speaker, stereo, video display, VCR) */
|
||||
ESP_BT_COD_MAJOR_DEV_PERIPHERAL = 5, /*!< Peripheral(mouse, joystick, keyboard) */
|
||||
ESP_BT_COD_MAJOR_DEV_IMAGING = 6, /*!< Imaging(printer, scanner, camera, display */
|
||||
ESP_BT_COD_MAJOR_DEV_WEARABLE = 7, /*!< Wearable */
|
||||
@@ -232,20 +233,19 @@ typedef enum {
|
||||
ESP_BT_COD_MINOR_PERIPHERAL_HAND_GESTURAL_INPUT = 0x09, /*!< Hand Gestural Input */
|
||||
} esp_bt_cod_minor_peripheral_t;
|
||||
|
||||
/// Bits of major device class field
|
||||
/* Bits of major device class field */
|
||||
#define ESP_BT_COD_MAJOR_DEV_BIT_MASK (0x1f00) /*!< Major device bit mask */
|
||||
#define ESP_BT_COD_MAJOR_DEV_BIT_OFFSET (8) /*!< Major device bit offset */
|
||||
|
||||
/// Bits of minor device class field
|
||||
/* Bits of minor device class field */
|
||||
#define ESP_BT_COD_MINOR_DEV_BIT_MASK (0xfc) /*!< Minor device bit mask */
|
||||
#define ESP_BT_COD_MINOR_DEV_BIT_OFFSET (2) /*!< Minor device bit offset */
|
||||
|
||||
/// Bits of format type
|
||||
/* Bits of format type */
|
||||
#define ESP_BT_COD_FORMAT_TYPE_BIT_MASK (0x03) /*!< Format type bit mask */
|
||||
#define ESP_BT_COD_FORMAT_TYPE_BIT_OFFSET (0) /*!< Format type bit offset */
|
||||
|
||||
/// Class of device format type 1
|
||||
#define ESP_BT_COD_FORMAT_TYPE_1 (0x00)
|
||||
#define ESP_BT_COD_FORMAT_TYPE_1 (0x00) /*!< Class of device format type 1 */
|
||||
|
||||
/** Bluetooth Device Discovery state */
|
||||
typedef enum {
|
||||
@@ -253,7 +253,7 @@ typedef enum {
|
||||
ESP_BT_GAP_DISCOVERY_STARTED, /*!< Device discovery started */
|
||||
} esp_bt_gap_discovery_state_t;
|
||||
|
||||
/// Type of link key
|
||||
/* Type of link key */
|
||||
#define ESP_BT_LINK_KEY_COMB (0x00) /*!< Combination Key */
|
||||
#define ESP_BT_LINK_KEY_DBG_COMB (0x03) /*!< Debug Combination Key */
|
||||
#define ESP_BT_LINK_KEY_UNAUTHED_COMB_P192 (0x04) /*!< Unauthenticated Combination Key generated from P-192 */
|
||||
@@ -261,13 +261,13 @@ typedef enum {
|
||||
#define ESP_BT_LINK_KEY_CHG_COMB (0x06) /*!< Changed Combination Key */
|
||||
#define ESP_BT_LINK_KEY_UNAUTHED_COMB_P256 (0x07) /*!< Unauthenticated Combination Key generated from P-256 */
|
||||
#define ESP_BT_LINK_KEY_AUTHED_COMB_P256 (0x08) /*!< Authenticated Combination Key generated from P-256 */
|
||||
typedef uint8_t esp_bt_link_key_type_t;
|
||||
typedef uint8_t esp_bt_link_key_type_t; /*!< Link key type */
|
||||
|
||||
/// Type of encryption
|
||||
/* Type of encryption */
|
||||
#define ESP_BT_ENC_MODE_OFF (0x00) /*!< Link Level Encryption is OFF */
|
||||
#define ESP_BT_ENC_MODE_E0 (0x01) /*!< Link Level Encryption is ON with E0 */
|
||||
#define ESP_BT_ENC_MODE_AES (0x02) /*!< Link Level Encryption is ON with AES-CCM */
|
||||
typedef uint8_t esp_bt_enc_mode_t;
|
||||
typedef uint8_t esp_bt_enc_mode_t; /*!< encryption mode type */
|
||||
|
||||
/// BT GAP callback events
|
||||
typedef enum {
|
||||
@@ -284,7 +284,7 @@ typedef enum {
|
||||
ESP_BT_GAP_CONFIG_EIR_DATA_EVT, /*!< Config EIR data event */
|
||||
ESP_BT_GAP_SET_AFH_CHANNELS_EVT, /*!< Set AFH channels event */
|
||||
ESP_BT_GAP_READ_REMOTE_NAME_EVT, /*!< Read Remote Name event */
|
||||
ESP_BT_GAP_MODE_CHG_EVT,
|
||||
ESP_BT_GAP_MODE_CHG_EVT, /*!< Mode change event */
|
||||
ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< remove bond device complete event */
|
||||
ESP_BT_GAP_QOS_CMPL_EVT, /*!< QOS complete event */
|
||||
ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT, /*!< ACL connection complete status event */
|
||||
@@ -304,11 +304,11 @@ typedef enum {
|
||||
ESP_BT_INQ_MODE_LIMITED_INQUIRY, /*!< Limited inquiry mode */
|
||||
} esp_bt_inq_mode_t;
|
||||
|
||||
/** Minimum and Maximum inquiry length*/
|
||||
/* Minimum and Maximum inquiry length */
|
||||
#define ESP_BT_GAP_MIN_INQ_LEN (0x01) /*!< Minimum inquiry duration, unit is 1.28s */
|
||||
#define ESP_BT_GAP_MAX_INQ_LEN (0x30) /*!< Maximum inquiry duration, unit is 1.28s */
|
||||
|
||||
/** Minimum, Default and Maximum poll interval **/
|
||||
/* Minimum, Default and Maximum poll interval */
|
||||
#define ESP_BT_GAP_TPOLL_MIN (0x0006) /*!< Minimum poll interval, unit is 625 microseconds */
|
||||
#define ESP_BT_GAP_TPOLL_DFT (0x0028) /*!< Default poll interval, unit is 625 microseconds */
|
||||
#define ESP_BT_GAP_TPOLL_MAX (0x1000) /*!< Maximum poll interval, unit is 625 microseconds */
|
||||
@@ -358,16 +358,16 @@ typedef union {
|
||||
} rmt_srvc_rec; /*!< specific service record from remote device parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_READ_RSSI_DELTA_EVT *
|
||||
* @brief ESP_BT_GAP_READ_RSSI_DELTA_EVT
|
||||
*/
|
||||
struct read_rssi_delta_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_status_t stat; /*!< read rssi status */
|
||||
int8_t rssi_delta; /*!< rssi delta value range -128 ~127, The value zero indicates that the RSSI is inside the Golden Receive Power Range, the Golden Receive Power Range is from ESP_BT_GAP_RSSI_LOW_THRLD to ESP_BT_GAP_RSSI_HIGH_THRLD */
|
||||
int8_t rssi_delta; /*!< rssi delta value range -128 ~127, The value zero indicates that the RSSI is inside the Golden Receive Power Range */
|
||||
} read_rssi_delta; /*!< read rssi parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_CONFIG_EIR_DATA_EVT *
|
||||
* @brief ESP_BT_GAP_CONFIG_EIR_DATA_EVT
|
||||
*/
|
||||
struct config_eir_data_param {
|
||||
esp_bt_status_t stat; /*!< config EIR status:
|
||||
@@ -609,6 +609,8 @@ static inline bool esp_bt_gap_is_valid_cod(uint32_t cod)
|
||||
/**
|
||||
* @brief register callback function. This function should be called after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @param[in] callback : callback function
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_FAIL: others
|
||||
@@ -668,6 +670,8 @@ esp_err_t esp_bt_gap_cancel_discovery(void);
|
||||
* @brief Start SDP to get remote services. This function should be called after esp_bluedroid_enable() completes successfully.
|
||||
* esp_bt_gap_cb_t will be called with ESP_BT_GAP_RMT_SRVCS_EVT after service discovery ends.
|
||||
*
|
||||
* @param[in] remote_bda : remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@@ -680,6 +684,10 @@ esp_err_t esp_bt_gap_get_remote_services(esp_bd_addr_t remote_bda);
|
||||
* esp_bluedroid_enable() completes successfully.
|
||||
*
|
||||
* esp_bt_gap_cb_t will be called with ESP_BT_GAP_RMT_SRVC_REC_EVT after service discovery ends
|
||||
*
|
||||
* @param[in] remote_bda : remote bluetooth device address
|
||||
* @param[in] uuid : uuid
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@@ -956,6 +964,9 @@ esp_err_t esp_bt_gap_get_page_timeout(void);
|
||||
* An ESP_BT_GAP_SET_ACL_PPKT_TYPES_EVT event will reported to
|
||||
* the APP layer.
|
||||
*
|
||||
* @param[in] remote_bda : remote bluetooth device address
|
||||
* @param[in] pkt_types : packet type
|
||||
*
|
||||
* @return - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - other: failed
|
||||
@@ -965,6 +976,8 @@ esp_err_t esp_bt_gap_set_acl_pkt_types(esp_bd_addr_t remote_bda, esp_bt_acl_pkt_
|
||||
/**
|
||||
* @brief Set the minimal size of encryption key
|
||||
*
|
||||
* @param[in] key_size : the size of encryption key
|
||||
*
|
||||
* @return - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - other: failed
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -695,6 +695,19 @@ typedef struct {
|
||||
const esp_ble_conn_params_t *phy_coded_conn_params; /*!< Connection parameters for the LE Coded PHY */
|
||||
} esp_ble_gatt_creat_conn_params_t;
|
||||
|
||||
/** @brief Represents a creat connection element. */
|
||||
typedef struct {
|
||||
esp_bd_addr_t remote_bda; /*!< The Bluetooth address of the remote device */
|
||||
esp_ble_addr_type_t remote_addr_type; /*!< Address type of the remote device */
|
||||
esp_ble_addr_type_t own_addr_type; /*!< Specifies the address type used in the connection request. Set to 0xFF if the address type is unknown. */
|
||||
uint8_t adv_handle; /*!< Advertising_Handle identifying the periodic advertising train. Range: 0x00 to 0xEF or 0xFF */
|
||||
uint8_t subevent; /*!< Subevent where the connection request is to be sent. Range: 0x00 to 0x7F or 0xFF */
|
||||
esp_ble_phy_mask_t phy_mask; /*!< Indicates which PHY connection parameters will be used. When is_aux is false, only the connection params for 1M PHY can be specified */
|
||||
const esp_ble_conn_params_t *phy_1m_conn_params; /*!< Connection parameters for the LE 1M PHY */
|
||||
const esp_ble_conn_params_t *phy_2m_conn_params; /*!< Connection parameters for the LE 2M PHY */
|
||||
const esp_ble_conn_params_t *phy_coded_conn_params; /*!< Connection parameters for the LE Coded PHY */
|
||||
} esp_ble_gatt_pawr_conn_params_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -17,29 +17,29 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* features masks of HF AG */
|
||||
#define ESP_HF_PEER_FEAT_3WAY 0x01 /* Three-way calling */
|
||||
#define ESP_HF_PEER_FEAT_ECNR 0x02 /* Echo cancellation and/or noise reduction */
|
||||
#define ESP_HF_PEER_FEAT_VREC 0x04 /* Voice recognition */
|
||||
#define ESP_HF_PEER_FEAT_INBAND 0x08 /* In-band ring tone */
|
||||
#define ESP_HF_PEER_FEAT_VTAG 0x10 /* Attach a phone number to a voice tag */
|
||||
#define ESP_HF_PEER_FEAT_REJECT 0x20 /* Ability to reject incoming call */
|
||||
#define ESP_HF_PEER_FEAT_ECS 0x40 /* Enhanced Call Status */
|
||||
#define ESP_HF_PEER_FEAT_ECC 0x80 /* Enhanced Call Control */
|
||||
#define ESP_HF_PEER_FEAT_EXTERR 0x100 /* Extended error codes */
|
||||
#define ESP_HF_PEER_FEAT_CODEC 0x200 /* Codec Negotiation */
|
||||
#define ESP_HF_PEER_FEAT_3WAY 0x01 /*!< Three-way calling */
|
||||
#define ESP_HF_PEER_FEAT_ECNR 0x02 /*!< Echo cancellation and/or noise reduction */
|
||||
#define ESP_HF_PEER_FEAT_VREC 0x04 /*!< Voice recognition */
|
||||
#define ESP_HF_PEER_FEAT_INBAND 0x08 /*!< In-band ring tone */
|
||||
#define ESP_HF_PEER_FEAT_VTAG 0x10 /*!< Attach a phone number to a voice tag */
|
||||
#define ESP_HF_PEER_FEAT_REJECT 0x20 /*!< Ability to reject incoming call */
|
||||
#define ESP_HF_PEER_FEAT_ECS 0x40 /*!< Enhanced Call Status */
|
||||
#define ESP_HF_PEER_FEAT_ECC 0x80 /*!< Enhanced Call Control */
|
||||
#define ESP_HF_PEER_FEAT_EXTERR 0x100 /*!< Extended error codes */
|
||||
#define ESP_HF_PEER_FEAT_CODEC 0x200 /*!< Codec Negotiation */
|
||||
/* HFP 1.7+ */
|
||||
#define ESP_HF_PEER_FEAT_HF_IND 0x400 /* HF Indicators */
|
||||
#define ESP_HF_PEER_FEAT_ESCO_S4 0x800 /* eSCO S4 Setting Supported */
|
||||
#define ESP_HF_PEER_FEAT_HF_IND 0x400 /*!< HF Indicators */
|
||||
#define ESP_HF_PEER_FEAT_ESCO_S4 0x800 /*!< eSCO S4 Setting Supported */
|
||||
|
||||
|
||||
/* CHLD feature masks of HF AG */
|
||||
#define ESP_HF_CHLD_FEAT_REL 0x01 /* 0 Release waiting call or held calls */
|
||||
#define ESP_HF_CHLD_FEAT_REL_ACC 0x02 /* 1 Release active calls and accept other waiting or held call */
|
||||
#define ESP_HF_CHLD_FEAT_REL_X 0x04 /* 1x Release specified active call only */
|
||||
#define ESP_HF_CHLD_FEAT_HOLD_ACC 0x08 /* 2 Active calls on hold and accept other waiting or held call */
|
||||
#define ESP_HF_CHLD_FEAT_PRIV_X 0x10 /* 2x Request private mode with specified call(put the rest on hold) */
|
||||
#define ESP_HF_CHLD_FEAT_MERGE 0x20 /* 3 Add held call to multiparty */
|
||||
#define ESP_HF_CHLD_FEAT_MERGE_DETACH 0x40 /* 4 Connect two calls and leave(disconnect from multiparty) */
|
||||
#define ESP_HF_CHLD_FEAT_REL 0x01 /*!< 0 Release waiting call or held calls */
|
||||
#define ESP_HF_CHLD_FEAT_REL_ACC 0x02 /*!< 1 Release active calls and accept other waiting or held call */
|
||||
#define ESP_HF_CHLD_FEAT_REL_X 0x04 /*!< 1x Release specified active call only */
|
||||
#define ESP_HF_CHLD_FEAT_HOLD_ACC 0x08 /*!< 2 Active calls on hold and accept other waiting or held call */
|
||||
#define ESP_HF_CHLD_FEAT_PRIV_X 0x10 /*!< 2x Request private mode with specified call(put the rest on hold) */
|
||||
#define ESP_HF_CHLD_FEAT_MERGE 0x20 /*!< 3 Add held call to multiparty */
|
||||
#define ESP_HF_CHLD_FEAT_MERGE_DETACH 0x40 /*!< 4 Connect two calls and leave(disconnect from multiparty) */
|
||||
|
||||
/// HF callback events
|
||||
typedef enum
|
||||
@@ -60,7 +60,7 @@ typedef enum
|
||||
|
||||
ESP_HF_ATA_RESPONSE_EVT, /*!< Answer an Incoming Call */
|
||||
ESP_HF_CHUP_RESPONSE_EVT, /*!< Reject an Incoming Call */
|
||||
ESP_HF_DIAL_EVT, /*!< Origin an outgoing call with specific number or the dial the last number */
|
||||
ESP_HF_DIAL_EVT, /*!< Originate an outgoing call with specific number or dial the last number */
|
||||
ESP_HF_WBS_RESPONSE_EVT, /*!< Codec Status */
|
||||
ESP_HF_BCS_RESPONSE_EVT, /*!< Final Codec Choice */
|
||||
ESP_HF_PKT_STAT_NUMS_GET_EVT, /*!< Request number of packet different status */
|
||||
@@ -90,7 +90,7 @@ typedef union
|
||||
* @brief ESP_HF_CONNECTION_STATE_EVT
|
||||
*/
|
||||
struct hf_conn_stat_param {
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote Bluetooth device address */
|
||||
esp_hf_connection_state_t state; /*!< Connection state */
|
||||
uint32_t peer_feat; /*!< HF supported features */
|
||||
uint32_t chld_feat; /*!< AG supported features on call hold and multiparty services */
|
||||
@@ -228,10 +228,10 @@ typedef union
|
||||
uint32_t rx_total; /*!< the total number of packets received */
|
||||
uint32_t rx_correct; /*!< the total number of packets data correctly received */
|
||||
uint32_t rx_err; /*!< the total number of packets data with possible invalid */
|
||||
uint32_t rx_none; /*!< the total number of packets data no received */
|
||||
uint32_t rx_none; /*!< the total number of packets data not received */
|
||||
uint32_t rx_lost; /*!< the total number of packets data partially lost */
|
||||
uint32_t tx_total; /*!< the total number of packets send */
|
||||
uint32_t tx_discarded; /*!< the total number of packets send lost */
|
||||
uint32_t tx_total; /*!< the total number of packets sent */
|
||||
uint32_t tx_discarded; /*!< the total number of packets sent and lost */
|
||||
} pkt_nums; /*!< AG callback param of ESP_HF_PKT_STAT_NUMS_GET_EVT */
|
||||
|
||||
/**
|
||||
@@ -246,9 +246,9 @@ typedef union
|
||||
/**
|
||||
* @brief HF AG callback function type
|
||||
*
|
||||
* @param event : Event type
|
||||
* @param[in] event : Event type
|
||||
*
|
||||
* @param param : Pointer to callback parameter
|
||||
* @param[in] param : Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_hf_cb_t) (esp_hf_cb_event_t event, esp_hf_cb_param_t *param);
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_BT_HF_CLIENT_NUMBER_LEN (32)
|
||||
#define ESP_BT_HF_CLIENT_OPERATOR_NAME_LEN (16)
|
||||
#define ESP_BT_HF_AT_SEND_XAPL_LEN (14)
|
||||
#define ESP_BT_HF_CLIENT_NUMBER_LEN (32) /*!< Maximum length of the phone number string in HFP Client */
|
||||
#define ESP_BT_HF_CLIENT_OPERATOR_NAME_LEN (16) /*!< Maximum length of the operator name string in HFP Client */
|
||||
#define ESP_BT_HF_AT_SEND_XAPL_LEN (14) /*!< Length of the XAPL string in AT command for HFP Client */
|
||||
|
||||
/// Bluetooth HFP RFCOMM connection and service level connection status
|
||||
typedef enum {
|
||||
@@ -26,7 +26,7 @@ typedef enum {
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_CONNECTING, /*!< connecting remote device on the RFCOMM data link*/
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_CONNECTED, /*!< RFCOMM connection established */
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_SLC_CONNECTED, /*!< service level connection established */
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTING, /*!< disconnecting with remote device on the RFCOMM dat link*/
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTING, /*!< disconnecting with remote device on the RFCOMM data link*/
|
||||
} esp_hf_client_connection_state_t;
|
||||
|
||||
/// Bluetooth HFP audio connection status
|
||||
@@ -53,35 +53,35 @@ typedef struct {
|
||||
} esp_hf_client_profile_status_t;
|
||||
|
||||
/* features masks of AG */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_3WAY 0x01 /* Three-way calling */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECNR 0x02 /* Echo cancellation and/or noise reduction */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_VREC 0x04 /* Voice recognition */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_INBAND 0x08 /* In-band ring tone */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_VTAG 0x10 /* Attach a phone number to a voice tag */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_REJECT 0x20 /* Ability to reject incoming call */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECS 0x40 /* Enhanced Call Status */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECC 0x80 /* Enhanced Call Control */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_EXTERR 0x100 /* Extended error codes */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_CODEC 0x200 /* Codec Negotiation */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_3WAY 0x01 /*!< Three-way calling */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECNR 0x02 /*!< Echo cancellation and/or noise reduction */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_VREC 0x04 /*!< Voice recognition */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_INBAND 0x08 /*!< In-band ring tone */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_VTAG 0x10 /*!< Attach a phone number to a voice tag */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_REJECT 0x20 /*!< Ability to reject incoming call */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECS 0x40 /*!< Enhanced Call Status */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECC 0x80 /*!< Enhanced Call Control */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_EXTERR 0x100 /*!< Extended error codes */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_CODEC 0x200 /*!< Codec Negotiation */
|
||||
/* HFP 1.7+ */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_HF_IND 0x400 /* HF Indicators */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ESCO_S4 0x800 /* eSCO S4 Setting Supported */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_HF_IND 0x400 /*!< HF Indicators */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ESCO_S4 0x800 /*!< eSCO S4 Setting Supported */
|
||||
|
||||
/* CHLD feature masks of AG */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL 0x01 /* 0 Release waiting call or held calls */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL_ACC 0x02 /* 1 Release active calls and accept other waiting or held call */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL_X 0x04 /* 1x Release specified active call only */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_HOLD_ACC 0x08 /* 2 Active calls on hold and accept other waiting or held call */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_PRIV_X 0x10 /* 2x Request private mode with specified call(put the rest on hold) */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_MERGE 0x20 /* 3 Add held call to multiparty */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_MERGE_DETACH 0x40 /* 4 Connect two calls and leave(disconnect from multiparty) */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL 0x01 /*!< 0 Release waiting call or held calls */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL_ACC 0x02 /*!< 1 Release active calls and accept other waiting or held call */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL_X 0x04 /*!< 1x Release specified active call only */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_HOLD_ACC 0x08 /*!< 2 Active calls on hold and accept other waiting or held call */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_PRIV_X 0x10 /*!< 2x Request private mode with specified call(put the rest on hold) */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_MERGE 0x20 /*!< 3 Add held call to multiparty */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_MERGE_DETACH 0x40 /*!< 4 Connect two calls and leave(disconnect from multiparty) */
|
||||
|
||||
/* XAPL feature masks*/
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_RESERVED 0x01 /* reserved */
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_BATTERY_REPORT 0x02 /* The accessory supports battery reporting (reserved only for battery operated accessories) */
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_DOCKED 0x04 /* The accessory is docked or powered (reserved only for battery operated accessories). */
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_SIRI_STATUS_REPORT 0x08 /* The accessory supports Siri status reporting */
|
||||
#define ESP_HF_CLIENT_XAPL_NR_STATUS_REPORT 0x10 /* the accessory supports noise reduction (NR) status reporting */
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_RESERVED 0x01 /*!< reserved */
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_BATTERY_REPORT 0x02 /*!< The accessory supports battery reporting (reserved only for battery operated accessories) */
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_DOCKED 0x04 /*!< The accessory is docked or powered (reserved only for battery operated accessories). */
|
||||
#define ESP_HF_CLIENT_XAPL_FEAT_SIRI_STATUS_REPORT 0x08 /*!< The accessory supports Siri status reporting */
|
||||
#define ESP_HF_CLIENT_XAPL_NR_STATUS_REPORT 0x10 /*!< The accessory supports noise reduction (NR) status reporting */
|
||||
|
||||
/// HF CLIENT callback events
|
||||
typedef enum {
|
||||
@@ -186,7 +186,7 @@ typedef union {
|
||||
*/
|
||||
struct hf_client_call_setup_ind_param {
|
||||
esp_hf_call_setup_status_t status; /*!< call setup status indicator */
|
||||
} call_setup; /*!< HF callback param of ESP_HF_CLIENT_BVRA_EVT */
|
||||
} call_setup; /*!< HF callback param of `ESP_HF_CLIENT_CIND_CALL_SETUP_EVT` */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_CALL_HELD_EVT
|
||||
@@ -200,7 +200,7 @@ typedef union {
|
||||
*/
|
||||
struct hf_client_btrh_param {
|
||||
esp_hf_btrh_status_t status; /*!< call hold and response status result code */
|
||||
} btrh; /*!< HF callback param of ESP_HF_CLIENT_BRTH_EVT */
|
||||
} btrh; /*!< HF callback param of ESP_HF_CLIENT_BTRH_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CLIP_EVT
|
||||
@@ -214,7 +214,7 @@ typedef union {
|
||||
*/
|
||||
struct hf_client_ccwa_param {
|
||||
const char *number; /*!< phone number string of waiting call */
|
||||
} ccwa; /*!< HF callback param of ESP_HF_CLIENT_BVRA_EVT */
|
||||
} ccwa; /*!< HF callback param of ESP_HF_CLIENT_CCWA_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CLCC_EVT
|
||||
@@ -304,9 +304,9 @@ typedef void (* esp_hf_client_audio_data_cb_t)(esp_hf_sync_conn_hdl_t sync_conn_
|
||||
/**
|
||||
* @brief HFP client callback function type
|
||||
*
|
||||
* @param event : Event type
|
||||
* @param[in] event : Event type
|
||||
*
|
||||
* @param param : Pointer to callback parameter
|
||||
* @param[in] param : Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_hf_client_cb_t)(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_t *param);
|
||||
|
||||
@@ -599,7 +599,7 @@ esp_err_t esp_hf_client_send_dtmf(char code);
|
||||
*
|
||||
* @brief Send command to enable Vendor specific feature to indicate battery level
|
||||
* and docker status
|
||||
* This is Apple-specific commands, but used by most device, including Android and Windows
|
||||
* This is an Apple-specific command, but used by most devices, including Android and Windows
|
||||
*
|
||||
* @param[in] information: XAPL vendorID-productID-version, such as "0505-1995-0610"
|
||||
* vendorID: A string representation of the hex value of the vendor ID from the manufacturer, without the 0x prefix.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -13,7 +13,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef uint16_t esp_hf_sync_conn_hdl_t;
|
||||
typedef uint16_t esp_hf_sync_conn_hdl_t; /*!< HFP synchronous connection handle */
|
||||
|
||||
/// profile states
|
||||
typedef enum {
|
||||
@@ -27,8 +27,8 @@ typedef enum {
|
||||
|
||||
/// in-band ring tone state
|
||||
typedef enum {
|
||||
ESP_HF_IN_BAND_RINGTONE_NOT_PROVIDED = 0,
|
||||
ESP_HF_IN_BAND_RINGTONE_PROVIDED,
|
||||
ESP_HF_IN_BAND_RINGTONE_NOT_PROVIDED = 0, /*!< Indicates that the in-band ringtone is not provided by the Hands-Free device */
|
||||
ESP_HF_IN_BAND_RINGTONE_PROVIDED, /*!< Indicates that the in-band ringtone is provided by the Hands-Free device */
|
||||
} esp_hf_in_band_ring_state_t;
|
||||
|
||||
/// voice recognition state
|
||||
@@ -51,16 +51,17 @@ typedef enum {
|
||||
ESP_HF_AUDIO_STATE_CONNECTED_MSBC, /*!< mSBC audio connection is established */
|
||||
} esp_hf_audio_state_t;
|
||||
|
||||
/// Bluetooth HFP audio volume type
|
||||
typedef enum {
|
||||
ESP_HF_VOLUME_TYPE_SPK = 0,
|
||||
ESP_HF_VOLUME_TYPE_MIC
|
||||
ESP_HF_VOLUME_TYPE_SPK = 0, /*!< speaker */
|
||||
ESP_HF_VOLUME_TYPE_MIC /*!< microphone */
|
||||
} esp_hf_volume_type_t;
|
||||
|
||||
/// +CIND network service availability status
|
||||
typedef enum
|
||||
{
|
||||
ESP_HF_NETWORK_STATE_NOT_AVAILABLE = 0,
|
||||
ESP_HF_NETWORK_STATE_AVAILABLE
|
||||
ESP_HF_NETWORK_STATE_NOT_AVAILABLE = 0, /*!< Indicates that the network service is not available */
|
||||
ESP_HF_NETWORK_STATE_AVAILABLE /*!< Indicates that the network service is available */
|
||||
} esp_hf_network_state_t;
|
||||
|
||||
/// +CIEV report type
|
||||
@@ -77,8 +78,8 @@ typedef enum {
|
||||
/** +CIEV Service type */
|
||||
typedef enum
|
||||
{
|
||||
ESP_HF_SERVICE_TYPE_HOME = 0,
|
||||
ESP_HF_SERVICE_TYPE_ROAMING
|
||||
ESP_HF_SERVICE_TYPE_HOME = 0, /*!< Indicates the service is in the home */
|
||||
ESP_HF_SERVICE_TYPE_ROAMING /*!< Indicates the service is in roaming */
|
||||
} esp_hf_service_type_t;
|
||||
|
||||
/// +CIND call status indicator values
|
||||
@@ -133,9 +134,9 @@ typedef enum {
|
||||
|
||||
/// +CLCC call mode
|
||||
typedef enum {
|
||||
ESP_HF_CURRENT_CALL_MODE_VOICE = 0,
|
||||
ESP_HF_CURRENT_CALL_MODE_DATA = 1,
|
||||
ESP_HF_CURRENT_CALL_MODE_FAX = 2,
|
||||
ESP_HF_CURRENT_CALL_MODE_VOICE = 0, /*!< the current call is a voice call */
|
||||
ESP_HF_CURRENT_CALL_MODE_DATA = 1, /*!< the current call is a data call */
|
||||
ESP_HF_CURRENT_CALL_MODE_FAX = 2, /*!< the current call is a fax call */
|
||||
} esp_hf_current_call_mode_t;
|
||||
|
||||
/// +CLCC address type
|
||||
@@ -168,22 +169,22 @@ typedef enum {
|
||||
/* +NREC */
|
||||
typedef enum
|
||||
{
|
||||
ESP_HF_NREC_STOP = 0,
|
||||
ESP_HF_NREC_START
|
||||
ESP_HF_NREC_STOP = 0, /*!< Stop the NREC */
|
||||
ESP_HF_NREC_START /*!< Start the NREC */
|
||||
} esp_hf_nrec_t;
|
||||
|
||||
///+CCWA response status
|
||||
typedef enum {
|
||||
ESP_HF_CALL_WAITING_INACTIVE,
|
||||
ESP_HF_CALL_WAITING_ACTIVE,
|
||||
ESP_HF_CALL_WAITING_INACTIVE, /*!< inactive call waiting */
|
||||
ESP_HF_CALL_WAITING_ACTIVE, /*!< active call waiting */
|
||||
} esp_hf_call_waiting_status_t;
|
||||
|
||||
/* WBS codec setting */
|
||||
typedef enum
|
||||
{
|
||||
ESP_HF_WBS_NONE,
|
||||
ESP_HF_WBS_NO,
|
||||
ESP_HF_WBS_YES
|
||||
ESP_HF_WBS_NONE, /*!< No Wideband Speech (WBS) codec support */
|
||||
ESP_HF_WBS_NO, /*!< Wideband Speech (WBS) codec is not enabled */
|
||||
ESP_HF_WBS_YES /*!< Wideband Speech (WBS) codec is enabled */
|
||||
}esp_hf_wbs_config_t;
|
||||
|
||||
/// Bluetooth HFP RFCOMM connection and service level connection status
|
||||
@@ -198,11 +199,11 @@ typedef enum {
|
||||
/// AT+CHLD command values
|
||||
typedef enum {
|
||||
ESP_HF_CHLD_TYPE_REL = 0, /*!< <0>, Terminate all held or set UDUB("busy") to a waiting call */
|
||||
ESP_HF_CHLD_TYPE_REL_ACC, /*!< <1>, Terminate all active calls and accepts a waiting/held call */
|
||||
ESP_HF_CHLD_TYPE_HOLD_ACC, /*!< <2>, Hold all active calls and accepts a waiting/held call */
|
||||
ESP_HF_CHLD_TYPE_REL_ACC, /*!< <1>, Terminate all active calls and accept a waiting/held call */
|
||||
ESP_HF_CHLD_TYPE_HOLD_ACC, /*!< <2>, Hold all active calls and accept a waiting/held call */
|
||||
ESP_HF_CHLD_TYPE_MERGE, /*!< <3>, Add all held calls to a conference */
|
||||
ESP_HF_CHLD_TYPE_MERGE_DETACH, /*!< <4>, connect the two calls and disconnects the subscriber from both calls */
|
||||
ESP_HF_CHLD_TYPE_REL_X, /*!< <1x>, releases specified calls only */
|
||||
ESP_HF_CHLD_TYPE_MERGE_DETACH, /*!< <4>, connect the two calls and disconnect the subscriber from both calls */
|
||||
ESP_HF_CHLD_TYPE_REL_X, /*!< <1x>, release specified calls only */
|
||||
ESP_HF_CHLD_TYPE_PRIV_X, /*!< <2x>, request private consultation mode with specified call */
|
||||
} esp_hf_chld_type_t;
|
||||
|
||||
@@ -220,8 +221,8 @@ typedef enum {
|
||||
|
||||
/* AT response code - OK/Error */
|
||||
typedef enum {
|
||||
ESP_HF_AT_RESPONSE_ERROR = 0,
|
||||
ESP_HF_AT_RESPONSE_OK
|
||||
ESP_HF_AT_RESPONSE_ERROR = 0, /*!< error in the AT command response */
|
||||
ESP_HF_AT_RESPONSE_OK /*!< successful AT command response */
|
||||
} esp_hf_at_response_t;
|
||||
|
||||
/// Extended Audio Gateway Error Result Code Response
|
||||
@@ -242,7 +243,7 @@ typedef enum {
|
||||
ESP_HF_CME_MEMORY_FULL = 20, /*!< memory full */
|
||||
ESP_HF_CME_INVALID_INDEX = 21, /*!< invalid index */
|
||||
ESP_HF_CME_MEMORY_FAILURE = 23, /*!< memory failure */
|
||||
ESP_HF_CME_TEXT_STRING_TOO_LONG = 24, /*!< test string too long */
|
||||
ESP_HF_CME_TEXT_STRING_TOO_LONG = 24, /*!< text string too long */
|
||||
ESP_HF_CME_INVALID_CHARACTERS_IN_TEXT_STRING = 25, /*!< invalid characters in text string */
|
||||
ESP_HF_CME_DIAL_STRING_TOO_LONG = 26, /*!< dial string too long*/
|
||||
ESP_HF_CME_INVALID_CHARACTERS_IN_DIAL_STRING = 27, /*!< invalid characters in dial string */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -16,7 +16,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// subclass of hid device
|
||||
/* subclass of hid device */
|
||||
#define ESP_HID_CLASS_UNKNOWN (0x00<<2) /*!< unknown HID device subclass */
|
||||
#define ESP_HID_CLASS_JOS (0x01<<2) /*!< joystick */
|
||||
#define ESP_HID_CLASS_GPD (0x02<<2) /*!< game pad */
|
||||
@@ -57,9 +57,9 @@ typedef enum {
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_HIDD_CONN_STATE_CONNECTED, /*!< HID connection established */
|
||||
ESP_HIDD_CONN_STATE_CONNECTING, /*!< connection to remote Bluetooth device */
|
||||
ESP_HIDD_CONN_STATE_CONNECTING, /*!< connecting to remote Bluetooth device */
|
||||
ESP_HIDD_CONN_STATE_DISCONNECTED, /*!< connection released */
|
||||
ESP_HIDD_CONN_STATE_DISCONNECTING, /*!< disconnecting to remote Bluetooth device*/
|
||||
ESP_HIDD_CONN_STATE_DISCONNECTING, /*!< disconnecting from remote Bluetooth device*/
|
||||
ESP_HIDD_CONN_STATE_UNKNOWN, /*!< unknown connection state */
|
||||
} esp_hidd_connection_state_t;
|
||||
|
||||
@@ -116,32 +116,35 @@ typedef struct {
|
||||
* @brief HID device callback function events
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_HIDD_INIT_EVT = 0, /*!< When HID device is initialized, the event comes */
|
||||
ESP_HIDD_DEINIT_EVT, /*!< When HID device is deinitialized, the event comes */
|
||||
ESP_HIDD_REGISTER_APP_EVT, /*!< When HID device application registered, the event comes */
|
||||
ESP_HIDD_UNREGISTER_APP_EVT, /*!< When HID device application unregistered, the event comes */
|
||||
ESP_HIDD_OPEN_EVT, /*!< When HID device connection to host opened, the event comes */
|
||||
ESP_HIDD_CLOSE_EVT, /*!< When HID device connection to host closed, the event comes */
|
||||
ESP_HIDD_SEND_REPORT_EVT, /*!< When HID device send report to lower layer, the event comes */
|
||||
ESP_HIDD_REPORT_ERR_EVT, /*!< When HID device report handshanke error to lower layer, the event comes */
|
||||
ESP_HIDD_GET_REPORT_EVT, /*!< When HID device receives GET_REPORT request from host, the event comes */
|
||||
ESP_HIDD_SET_REPORT_EVT, /*!< When HID device receives SET_REPORT request from host, the event comes */
|
||||
ESP_HIDD_SET_PROTOCOL_EVT, /*!< When HID device receives SET_PROTOCOL request from host, the event comes */
|
||||
ESP_HIDD_INTR_DATA_EVT, /*!< When HID device receives DATA from host on intr, the event comes */
|
||||
ESP_HIDD_VC_UNPLUG_EVT, /*!< When HID device initiates Virtual Cable Unplug, the event comes */
|
||||
ESP_HIDD_API_ERR_EVT /*!< When HID device has API error, the event comes */
|
||||
ESP_HIDD_INIT_EVT = 0, /*!< HID device initialized. */
|
||||
ESP_HIDD_DEINIT_EVT, /*!< HID device deinitialized. */
|
||||
ESP_HIDD_REGISTER_APP_EVT, /*!< HID device application registered. */
|
||||
ESP_HIDD_UNREGISTER_APP_EVT, /*!< HID device application unregistered. */
|
||||
ESP_HIDD_OPEN_EVT, /*!< HID device connection to host opened. */
|
||||
ESP_HIDD_CLOSE_EVT, /*!< HID device connection to host closed. */
|
||||
ESP_HIDD_SEND_REPORT_EVT, /*!< HID device sent report to lower layer. */
|
||||
ESP_HIDD_REPORT_ERR_EVT, /*!< HID device reported handshake error to lower layer. */
|
||||
ESP_HIDD_GET_REPORT_EVT, /*!< HID device received GET_REPORT request from host. */
|
||||
ESP_HIDD_SET_REPORT_EVT, /*!< HID device received SET_REPORT request from host. */
|
||||
ESP_HIDD_SET_PROTOCOL_EVT, /*!< HID device received SET_PROTOCOL request from host. */
|
||||
ESP_HIDD_INTR_DATA_EVT, /*!< HID device received DATA from host on interrupt channel. */
|
||||
ESP_HIDD_VC_UNPLUG_EVT, /*!< HID device initiated Virtual Cable Unplug. */
|
||||
ESP_HIDD_API_ERR_EVT /*!< HID device had API error. */
|
||||
} esp_hidd_cb_event_t;
|
||||
|
||||
/**
|
||||
* @brief HID device status
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_HIDD_SUCCESS,
|
||||
ESP_HIDD_ERROR, /*!< general ESP HD error */
|
||||
ESP_HIDD_SUCCESS, /*!< successful */
|
||||
ESP_HIDD_ERROR, /*!< general ESP HID error */
|
||||
ESP_HIDD_NO_RES, /*!< out of system resources */
|
||||
ESP_HIDD_BUSY, /*!< Temporarily can not handle this request. */
|
||||
ESP_HIDD_NO_DATA, /*!< No data. */
|
||||
ESP_HIDD_NEED_INIT, /*!< HIDD module shall init first */
|
||||
ESP_HIDD_NEED_DEINIT, /*!< HIDD module shall deinit first */
|
||||
ESP_HIDD_NEED_REG, /*!< HIDD module shall register first */
|
||||
ESP_HIDD_NEED_DEREG, /*!< HIDD module shall deregister first */
|
||||
ESP_HIDD_NEED_INIT, /*!< HIDD module must be initialized first. */
|
||||
ESP_HIDD_NEED_DEINIT, /*!< HIDD module must be deinitialized first. */
|
||||
ESP_HIDD_NEED_REG, /*!< HIDD module must be registered first. */
|
||||
ESP_HIDD_NEED_DEREG, /*!< HIDD module must be deregistered first. */
|
||||
ESP_HIDD_NO_CONNECTION, /*!< connection may have been closed */
|
||||
} esp_hidd_status_t;
|
||||
|
||||
@@ -270,8 +273,8 @@ typedef union {
|
||||
|
||||
/**
|
||||
* @brief HID device callback function type.
|
||||
* @param event: Event type
|
||||
* @param param: Point to callback parameter, currently is union type
|
||||
* @param[in] event: Event type
|
||||
* @param[in] param: Point to callback parameter, currently is union type
|
||||
*/
|
||||
typedef void (*esp_hd_cb_t)(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ typedef enum {
|
||||
ESP_HIDH_BUSY, /*!< vendor-defined: temporarily can not handle this request */
|
||||
ESP_HIDH_NO_DATA, /*!< vendor-defined: no data. */
|
||||
ESP_HIDH_NEED_INIT, /*!< vendor-defined: HIDH module shall initialize first */
|
||||
ESP_HIDH_NEED_DEINIT, /*!< vendor-defined: HIDH module shall de-deinitialize first */
|
||||
ESP_HIDH_NEED_DEINIT, /*!< vendor-defined: HIDH module shall deinitialize first */
|
||||
ESP_HIDH_NO_CONNECTION, /*!< vendor-defined: connection may have been closed */
|
||||
} esp_hidh_status_t;
|
||||
|
||||
@@ -309,8 +309,8 @@ typedef union {
|
||||
|
||||
/**
|
||||
* @brief HID host callback function type
|
||||
* @param event: Event type
|
||||
* @param param: Point to callback parameter, currently is union type
|
||||
* @param[in] event: Event type
|
||||
* @param[in] param: Point to callback parameter, currently is union type
|
||||
*/
|
||||
typedef void (*esp_hh_cb_t)(esp_hidh_cb_event_t event, esp_hidh_cb_param_t *param);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -28,17 +28,18 @@ typedef enum {
|
||||
ESP_BT_L2CAP_NO_SERVER, /*!< No server */
|
||||
} esp_bt_l2cap_status_t;
|
||||
|
||||
/**
|
||||
* @brief Security Setting Mask. Use these three mask mode:
|
||||
* 1. ESP_BT_L2CAP_SEC_NONE
|
||||
* 2. ESP_BT_L2CAP_SEC_AUTHENTICATE
|
||||
* 3. (ESP_BT_L2CAP_SEC_ENCRYPT|ESP_BT_L2CAP_SEC_AUTHENTICATE)
|
||||
/*
|
||||
* Security setting mask for L2CAP.
|
||||
* - Use one of the following mask modes:
|
||||
* 1. `ESP_BT_L2CAP_SEC_NONE`
|
||||
* 2. `ESP_BT_L2CAP_SEC_AUTHENTICATE`
|
||||
* 3. (`ESP_BT_L2CAP_SEC_ENCRYPT` | `ESP_BT_L2CAP_SEC_AUTHENTICATE`)
|
||||
*/
|
||||
#define ESP_BT_L2CAP_SEC_NONE 0x0000 /*!< No security */
|
||||
#define ESP_BT_L2CAP_SEC_AUTHORIZE 0x0001 /*!< Authorization required */
|
||||
#define ESP_BT_L2CAP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required */
|
||||
#define ESP_BT_L2CAP_SEC_ENCRYPT 0x0024 /*!< Encryption required */
|
||||
typedef uint32_t esp_bt_l2cap_cntl_flags_t;
|
||||
typedef uint32_t esp_bt_l2cap_cntl_flags_t; /*!< L2CAP control flags type */
|
||||
|
||||
/**
|
||||
* @brief L2CAP status parameters
|
||||
@@ -146,8 +147,8 @@ typedef union {
|
||||
/**
|
||||
* @brief L2CAP callback function type.
|
||||
*
|
||||
* @param event: Event type
|
||||
* @param param: Point to callback parameter, currently is union type
|
||||
* @param[in] event: Event type
|
||||
* @param[in] param: Point to callback parameter, currently is union type
|
||||
*/
|
||||
typedef void (* esp_bt_l2cap_cb_t)(esp_bt_l2cap_cb_event_t event, esp_bt_l2cap_cb_param_t *param);
|
||||
|
||||
@@ -203,11 +204,12 @@ esp_err_t esp_bt_l2cap_deinit(void);
|
||||
esp_err_t esp_bt_l2cap_connect(esp_bt_l2cap_cntl_flags_t cntl_flag, uint16_t remote_psm, esp_bd_addr_t peer_bd_addr);
|
||||
|
||||
/**
|
||||
* @brief This function create a L2CAP server and starts listening for an
|
||||
* L2CAP connection request from a remote Bluetooth device.
|
||||
* When the server is started successfully, the callback is called with ESP_BT_L2CAP_START_EVT.
|
||||
* When the connection is established, the callback is called with ESP_BT_L2CAP_OPEN_EVT.
|
||||
* This function must be called after esp_bt_l2cap_init() successful and before esp_bt_l2cap_deinit().
|
||||
* @brief Create an L2CAP server and start listening for connection requests.
|
||||
*
|
||||
* @note
|
||||
* - When the server is started successfully, the callback is called with `ESP_BT_L2CAP_START_EVT`.
|
||||
* - When the connection is established, the callback is called with `ESP_BT_L2CAP_OPEN_EVT`.
|
||||
* - This function must be called after `esp_bt_l2cap_init()` and before `esp_bt_l2cap_deinit()`.
|
||||
*
|
||||
* @param[in] cntl_flag: Lower 16-bit security settings mask.
|
||||
* @param[in] local_psm: Dynamic PSM.
|
||||
|
||||
@@ -25,9 +25,13 @@ extern "C" {
|
||||
#define ESP_SDP_UUID_SAP 0x112D /*!< SIM Access Profile UUID */
|
||||
#define ESP_SDP_UUID_DIP 0x1200 /*!< Device Identification Profile UUID */
|
||||
|
||||
/// Build a Bluetooth UUID16
|
||||
#define ESP_SDP_BUILD_BT_UUID16(uuid16_val) \
|
||||
(esp_bt_uuid_t) { .len = ESP_UUID_LEN_16, .uuid = {.uuid16 = (uint16_t)(uuid16_val),}, }
|
||||
|
||||
/**
|
||||
* @brief SDP status parameters
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_SDP_SUCCESS = 0, /*!< Successful operation. */
|
||||
ESP_SDP_FAILURE, /*!< Generic failure. */
|
||||
@@ -233,8 +237,8 @@ typedef union {
|
||||
/**
|
||||
* @brief SDP callback function type.
|
||||
*
|
||||
* @param event: Event type
|
||||
* @param param: Point to callback parameter, currently is union type
|
||||
* @param[in] event: Event type
|
||||
* @param[in] param: Point to callback parameter, currently is union type
|
||||
*/
|
||||
typedef void (* esp_sdp_cb_t)(esp_sdp_cb_event_t event, esp_sdp_cb_param_t *param);
|
||||
|
||||
@@ -275,7 +279,7 @@ esp_err_t esp_sdp_init(void);
|
||||
esp_err_t esp_sdp_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief This function is called to performs service discovery for the services provided by the given peer device.
|
||||
* @brief Perform service discovery for the services provided by the given peer device.
|
||||
* When the operation is completed, the callback function will be called with ESP_SDP_SEARCH_COMP_EVT.
|
||||
* This function must be called after esp_sdp_init() successful and before esp_sdp_deinit().
|
||||
*
|
||||
@@ -302,7 +306,7 @@ esp_err_t esp_sdp_search_record(esp_bd_addr_t bd_addr, esp_bt_uuid_t uuid);
|
||||
esp_err_t esp_sdp_create_record(esp_bluetooth_sdp_record_t *record);
|
||||
|
||||
/**
|
||||
* @brief This function is called to remove a SDP record.
|
||||
* @brief Remove an SDP record.
|
||||
* When the operation is completed, the callback function will be called with ESP_SDP_REMOVE_RECORD_COMP_EVT.
|
||||
* This function must be called after esp_sdp_init() successful and before esp_sdp_deinit().
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -42,15 +42,18 @@ Due to certain limitations, do not use these mask modes:
|
||||
2. ESP_SPP_SEC_MODE4_LEVEL4
|
||||
3. ESP_SPP_SEC_MITM
|
||||
*/
|
||||
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta/bta_api.h */
|
||||
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. relate to BTA_SEC_AUTHENTICATE in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_ENCRYPT 0x0024 /*!< Encryption required. relate to BTA_SEC_ENCRYPT in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_MODE4_LEVEL4 0x0040 /*!< Mode 4 level 4 service, i.e. incoming/outgoing MITM and P-256 encryption relate to BTA_SEC_MODE4_LEVEL4 in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_MITM 0x3000 /*!< Man-In-The_Middle protection relate to BTA_SEC_MITM in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_IN_16_DIGITS 0x4000 /*!< Min 16 digit for pin code relate to BTA_SEC_IN_16_DIGITS in bta/bta_api.h*/
|
||||
typedef uint16_t esp_spp_sec_t;
|
||||
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. */
|
||||
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) */
|
||||
#define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. */
|
||||
#define ESP_SPP_SEC_ENCRYPT 0x0024 /*!< Encryption required. */
|
||||
#define ESP_SPP_SEC_MODE4_LEVEL4 0x0040 /*!< Mode 4 level 4 service, i.e. incoming/outgoing MITM and P-256 encryption. */
|
||||
#define ESP_SPP_SEC_MITM 0x3000 /*!< Man-In-The-Middle protection. */
|
||||
#define ESP_SPP_SEC_IN_16_DIGITS 0x4000 /*!< Min 16 digit for pin code. */
|
||||
typedef uint16_t esp_spp_sec_t; /*!< SPP security type */
|
||||
|
||||
/**
|
||||
* @brief SPP status type.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_SPP_SUCCESS = 0, /*!< Successful operation. */
|
||||
ESP_SPP_FAILURE, /*!< Generic failure. */
|
||||
@@ -63,11 +66,17 @@ typedef enum {
|
||||
ESP_SPP_NO_SERVER, /*!< No SPP server */
|
||||
} esp_spp_status_t;
|
||||
|
||||
/**
|
||||
* @brief SPP role type.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_SPP_ROLE_MASTER = 0, /*!< Role: master */
|
||||
ESP_SPP_ROLE_SLAVE = 1, /*!< Role: slave */
|
||||
} esp_spp_role_t;
|
||||
|
||||
/**
|
||||
* @brief SPP mode type.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_SPP_MODE_CB = 0, /*!< When data is coming, a callback will come with data */
|
||||
ESP_SPP_MODE_VFS = 1, /*!< Use VFS to write/read data */
|
||||
@@ -318,7 +327,7 @@ esp_err_t esp_spp_deinit(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is called to performs service discovery for the services provided by the given peer device.
|
||||
* @brief Perform service discovery for the services provided by the given peer device.
|
||||
* When the operation is completed, the callback function will be called with ESP_SPP_DISCOVERY_COMP_EVT.
|
||||
* This function must be called after esp_spp_init()/esp_spp_enhanced_init() successful and before esp_spp_deinit().
|
||||
*
|
||||
|
||||
@@ -763,7 +763,7 @@ static void bta_av_api_reg_sep(tBTA_AV_DATA *p_data)
|
||||
sep_reg.seid = p_data->api_reg_sep.seid;
|
||||
sep_reg.reg_state = BTA_AV_FAIL;
|
||||
|
||||
if (index > BTA_AV_MAX_SEPS || p_data->hdr.layer_specific != BTA_AV_CHNL_AUDIO) {
|
||||
if (index >= BTA_AV_MAX_SEPS || p_data->hdr.layer_specific != BTA_AV_CHNL_AUDIO) {
|
||||
(*bta_av_cb.p_cback)(BTA_AV_SEP_REG_EVT, (tBTA_AV *)&sep_reg);
|
||||
APPL_TRACE_WARNING("%s invalid parameter: seid %d, ch %d", __FUNCTION__, index, p_data->hdr.layer_specific);
|
||||
return;
|
||||
@@ -815,6 +815,7 @@ static void bta_av_api_reg_sep(tBTA_AV_DATA *p_data)
|
||||
p_scb->seps[index].codec_type = codec_type;
|
||||
p_scb->seps[index].tsep = cs.tsep;
|
||||
p_scb->seps[index].p_app_data_cback = p_data->api_reg_sep.p_data_cback;
|
||||
sep_reg.reg_state = BTA_AV_SUCCESS;
|
||||
} else {
|
||||
APPL_TRACE_WARNING("%s fail to create sep", __FUNCTION__);
|
||||
break;
|
||||
@@ -826,7 +827,6 @@ static void bta_av_api_reg_sep(tBTA_AV_DATA *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
sep_reg.reg_state = BTA_AV_SUCCESS;
|
||||
(*bta_av_cb.p_cback)(BTA_AV_SEP_REG_EVT, (tBTA_AV *)&sep_reg);
|
||||
#endif
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -42,11 +42,15 @@
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
tBTA_DM_CB bta_dm_cb;
|
||||
tBTA_DM_SEARCH_CB bta_dm_search_cb;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
tBTA_DM_DI_CB bta_dm_di_cb;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#else
|
||||
tBTA_DM_CB *bta_dm_cb_ptr;
|
||||
tBTA_DM_SEARCH_CB *bta_dm_search_cb_ptr;
|
||||
tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
SemaphoreHandle_t deinit_semaphore;
|
||||
#endif
|
||||
|
||||
@@ -90,9 +94,6 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_dm_acl_change, /* BTA_DM_ACL_CHANGE_EVT */
|
||||
bta_dm_add_device, /* BTA_DM_API_ADD_DEVICE_EVT */
|
||||
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
bta_dm_close_acl, /* BTA_DM_API_REMOVE_ACL_EVT */
|
||||
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
/* security API events */
|
||||
bta_dm_bond, /* BTA_DM_API_BOND_EVT */
|
||||
@@ -134,42 +135,28 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_ble_passkey_reply, /* BTA_DM_API_BLE_PASSKEY_REPLY_EVT */
|
||||
bta_dm_ble_set_static_passkey, /* BTA_DM_API_BLE_SET_STATIC_PASSKEY_EVT */
|
||||
bta_dm_ble_confirm_reply, /* BTA_DM_API_BLE_CONFIRM_REPLY_EVT */
|
||||
bta_dm_security_grant,
|
||||
bta_dm_security_grant, /* BTA_DM_API_BLE_SEC_GRANT_EVT */
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
bta_dm_ble_set_bg_conn_type,
|
||||
#if (BLE_GATT_BGCONN == TRUE)
|
||||
bta_dm_ble_set_bg_conn_type, /* BTA_DM_API_BLE_SET_BG_CONN_TYPE */
|
||||
#endif // (BLE_GATT_BGCONN == TRUE)
|
||||
bta_dm_ble_set_conn_params, /* BTA_DM_API_BLE_CONN_PARAM_EVT */
|
||||
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
bta_dm_ble_set_conn_scan_params, /* BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT */
|
||||
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
|
||||
bta_dm_ble_set_scan_params, /* BTA_DM_API_BLE_SCAN_PARAM_EVT */
|
||||
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
bta_dm_ble_set_scan_fil_params, /* BTA_DM_API_BLE_SCAN_FIL_PARAM_EVT */
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
|
||||
bta_dm_ble_observe, /* BTA_DM_API_BLE_OBSERVE_EVT */
|
||||
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
bta_dm_ble_scan, /* BTA_DM_API_BLE_SCAN_EVT */
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
bta_dm_ble_update_conn_params, /* BTA_DM_API_UPDATE_CONN_PARAM_EVT */
|
||||
/* This handler function added by
|
||||
Yulong at 2016/9/9 to support the
|
||||
random address setting for the APP */
|
||||
bta_dm_ble_set_rand_address, /* BTA_DM_API_SET_RAND_ADDR_EVT*/
|
||||
bta_dm_ble_clear_rand_address, /* BTA_DM_API_CLEAR_RAND_ADDR_EVT */
|
||||
/* This handler function added by
|
||||
Yulong at 2016/10/19 to support
|
||||
stop the ble advertising setting
|
||||
by the APP */
|
||||
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
bta_dm_ble_stop_advertising, /* BTA_DM_API_BLE_STOP_ADV_EVT */
|
||||
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
#if BLE_PRIVACY_SPT == TRUE
|
||||
bta_dm_ble_config_local_privacy, /* BTA_DM_API_LOCAL_PRIVACY_EVT */
|
||||
#endif
|
||||
bta_dm_ble_config_local_icon, /* BTA_DM_API_LOCAL_ICON_EVT */
|
||||
#if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
bta_dm_ble_set_key_material, /* BTA_DM_API_KEY_MATERIAL_EVT */
|
||||
#endif
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
bta_dm_ble_set_adv_params_all, /* BTA_DM_API_BLE_ADV_PARAM_All_EVT */
|
||||
bta_dm_ble_set_adv_config, /* BTA_DM_API_BLE_SET_ADV_CONFIG_EVT */
|
||||
@@ -180,58 +167,20 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
/* New function to allow set raw scan
|
||||
response data to HCI */
|
||||
bta_dm_ble_set_scan_rsp_raw, /* BTA_DM_API_BLE_SET_SCAN_RSP_RAW_EVT */
|
||||
bta_dm_ble_broadcast, /* BTA_DM_API_BLE_BROADCAST_EVT */
|
||||
bta_dm_ble_advstop, /* BTA_DM_API_BLE_ADVSTOP_EVT */
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
bta_dm_ble_set_data_length, /* BTA_DM_API_SET_DATA_LENGTH_EVT */
|
||||
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
bta_dm_cfg_filter_cond, /* BTA_DM_API_CFG_FILTER_COND_EVT */
|
||||
bta_dm_scan_filter_param_setup, /* BTA_DM_API_SCAN_FILTER_SETUP_EVT */
|
||||
bta_dm_enable_scan_filter, /* BTA_DM_API_SCAN_FILTER_ENABLE_EVT */
|
||||
#endif
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
bta_dm_ble_multi_adv_enb, /* BTA_DM_API_BLE_MULTI_ADV_ENB_EVT */
|
||||
bta_dm_ble_multi_adv_upd_param, /* BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT */
|
||||
bta_dm_ble_multi_adv_data, /* BTA_DM_API_BLE_MULTI_ADV_DATA_EVT */
|
||||
btm_dm_ble_multi_adv_disable, /* BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT */
|
||||
#endif // BLE_HOST_BLE_MULTI_ADV_EN
|
||||
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
bta_dm_ble_setup_storage, /* BTA_DM_API_BLE_SETUP_STORAGE_EVT */
|
||||
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
bta_dm_ble_enable_batch_scan, /* BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT */
|
||||
bta_dm_ble_disable_batch_scan, /* BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT */
|
||||
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
bta_dm_ble_read_scan_reports, /* BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT */
|
||||
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
bta_dm_ble_track_advertiser, /* BTA_DM_API_BLE_TRACK_ADVERTISER_EVT */
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
bta_dm_ble_get_energy_info, /* BTA_DM_API_BLE_ENERGY_INFO_EVT */
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
bta_dm_ble_disconnect, /* BTA_DM_API_BLE_DISCONNECT_EVT */
|
||||
#endif
|
||||
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
|
||||
bta_dm_enable_test_mode, /* BTA_DM_API_ENABLE_TEST_MODE_EVT */
|
||||
bta_dm_disable_test_mode, /* BTA_DM_API_DISABLE_TEST_MODE_EVT */
|
||||
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
|
||||
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
bta_dm_execute_callback, /* BTA_DM_API_EXECUTE_CBACK_EVT */
|
||||
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
bta_dm_remove_all_acl, /* BTA_DM_API_REMOVE_ALL_ACL_EVT */
|
||||
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
bta_dm_remove_device, /* BTA_DM_API_REMOVE_DEVICE_EVT */
|
||||
bta_dm_ble_set_channels, /* BTA_DM_API_BLE_SET_CHANNELS_EVT */
|
||||
bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */
|
||||
bta_dm_clear_white_list, /* BTA_DM_API_CLEAR_WHITE_LIST_EVT */
|
||||
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */
|
||||
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
bta_dm_read_rssi, /* BTA_DM_API_READ_RSSI_EVT */
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */
|
||||
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
#endif
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
bta_dm_ble_gap_read_phy, /* BTA_DM_API_READ_PHY_EVT */
|
||||
@@ -344,6 +293,25 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
bta_dm_ble_set_host_feature, /* BTA_DM_API_SET_HOST_FEATURE_EVT */
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
bta_dm_api_set_periodic_adv_subevt_data, /* BTA_DM_API_SET_PA_SUBEVT_DATA */
|
||||
bta_dm_api_set_periodic_adv_response_data, /* BTA_DM_API_SET_PA_RSP_DATA */
|
||||
bta_dm_api_set_periodic_sync_subevt, /* BTA_DM_API_SET_PA_SYNC_SUBEVT */
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
bta_dm_api_cs_read_local_supported_caps, /* BTA_DM_API_CS_READ_LOCAL_SUPPORTED_CAPS */
|
||||
bta_dm_api_cs_read_remote_supported_caps, /* BTA_DM_API_CS_READ_REMOTE_SUPPORTED_CAPS */
|
||||
bta_dm_api_cs_write_cached_remote_supported_caps, /* BTA_DM_API_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPS */
|
||||
bta_dm_api_cs_security_enable, /* BTA_DM_API_CS_SECURITY_ENABLE */
|
||||
bta_dm_api_cs_set_default_settings, /* BTA_DM_API_CS_SET_DEFAULT_SETTINGS */
|
||||
bta_dm_api_cs_read_remote_fae_table, /* BTA_DM_API_CS_READ_REMOTE_FAE_TABLE */
|
||||
bta_dm_api_cs_write_cached_remote_fae_table, /* BTA_DM_API_CS_WRITE_CACHED_REMOTE_FAE_TABLE */
|
||||
bta_dm_api_cs_create_config, /* BTA_DM_API_CS_CREATE_CONFIG */
|
||||
bta_dm_api_cs_remove_config, /* BTA_DM_API_CS_REMOVE_CONFIG */
|
||||
bta_dm_api_cs_set_channel_classification, /* BTA_DM_API_CS_SET_CAHNNEL_CLASSIFICATION */
|
||||
bta_dm_api_cs_set_procedure_params, /* BTA_DM_API_CS_SET_PROCEDURE_PARAMS */
|
||||
bta_dm_api_cs_procedure_enable, /* BTA_DM_API_CS_PROCEDURE_ENABLE */
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
};
|
||||
|
||||
|
||||
@@ -550,11 +518,15 @@ void bta_dm_sm_deinit(void)
|
||||
{
|
||||
memset(&bta_dm_cb, 0, sizeof(tBTA_DM_CB));
|
||||
memset(&bta_dm_search_cb, 0, sizeof(tBTA_DM_SEARCH_CB));
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
memset(&bta_dm_di_cb, 0, sizeof(tBTA_DM_DI_CB));
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if BTA_DYNAMIC_MEMORY
|
||||
FREE_AND_RESET(bta_dm_cb_ptr);
|
||||
FREE_AND_RESET(bta_dm_search_cb_ptr);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
FREE_AND_RESET(bta_dm_di_cb_ptr);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#endif /* #if BTA_DYNAMIC_MEMORY */
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "stack/btm_api.h"
|
||||
#include "osi/allocator.h"
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
tBTA_DM_CONNECTED_SRVCS bta_dm_conn_srvcs;
|
||||
#else
|
||||
@@ -1171,3 +1173,5 @@ tBTA_DM_CONTRL_STATE bta_dm_pm_obtain_controller_state(void)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
@@ -80,9 +80,6 @@ enum {
|
||||
|
||||
BTA_DM_ACL_CHANGE_EVT,
|
||||
BTA_DM_API_ADD_DEVICE_EVT,
|
||||
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
BTA_DM_API_REMOVE_ACL_EVT,
|
||||
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
/* security API events */
|
||||
BTA_DM_API_BOND_EVT,
|
||||
@@ -126,22 +123,15 @@ enum {
|
||||
BTA_DM_API_BLE_CONFIRM_REPLY_EVT,
|
||||
BTA_DM_API_BLE_SEC_GRANT_EVT,
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if (BLE_GATT_BGCONN == TRUE)
|
||||
BTA_DM_API_BLE_SET_BG_CONN_TYPE,
|
||||
#endif // (BLE_GATT_BGCONN == TRUE)
|
||||
BTA_DM_API_BLE_CONN_PARAM_EVT,
|
||||
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT,
|
||||
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
|
||||
BTA_DM_API_BLE_SCAN_PARAM_EVT,
|
||||
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
|
||||
/*******This event added by Yulong at 2016/10/25 to
|
||||
support the scan filter setting for the APP******/
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
BTA_DM_API_BLE_SCAN_FIL_PARAM_EVT,
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
|
||||
BTA_DM_API_BLE_OBSERVE_EVT,
|
||||
#endif // #if (BLE_HOST_BLE_OBSERVE_EN == TRUE)
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
BTA_DM_API_BLE_SCAN_EVT,
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
@@ -150,15 +140,13 @@ enum {
|
||||
support the random address setting for the APP******/
|
||||
BTA_DM_API_SET_RAND_ADDR_EVT,
|
||||
BTA_DM_API_CLEAR_RAND_ADDR_EVT,
|
||||
/*******This event added by Yulong at 2016/10/19 to
|
||||
support stop the ble advertising setting by the APP******/
|
||||
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
BTA_DM_API_BLE_STOP_ADV_EVT,
|
||||
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
#if BLE_PRIVACY_SPT == TRUE
|
||||
BTA_DM_API_LOCAL_PRIVACY_EVT,
|
||||
#endif
|
||||
BTA_DM_API_LOCAL_ICON_EVT,
|
||||
#if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
BTA_DM_API_KEY_MATERIAL_EVT,
|
||||
#endif
|
||||
|
||||
/*******This event added by Yulong at 2016/10/20 to
|
||||
support setting the ble advertising param by the APP******/
|
||||
@@ -170,59 +158,22 @@ enum {
|
||||
BTA_DM_API_BLE_SET_SCAN_RSP_EVT,
|
||||
/* Add for set raw scan response data */
|
||||
BTA_DM_API_BLE_SET_SCAN_RSP_RAW_EVT,
|
||||
BTA_DM_API_BLE_BROADCAST_EVT,
|
||||
BTA_DM_API_BLE_ADVSTOP_EVT,
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
BTA_DM_API_SET_DATA_LENGTH_EVT,
|
||||
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
BTA_DM_API_CFG_FILTER_COND_EVT,
|
||||
BTA_DM_API_SCAN_FILTER_SETUP_EVT,
|
||||
BTA_DM_API_SCAN_FILTER_ENABLE_EVT,
|
||||
#endif
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
BTA_DM_API_BLE_MULTI_ADV_ENB_EVT,
|
||||
BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT,
|
||||
BTA_DM_API_BLE_MULTI_ADV_DATA_EVT,
|
||||
BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT,
|
||||
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
BTA_DM_API_BLE_SETUP_STORAGE_EVT,
|
||||
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT,
|
||||
BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT,
|
||||
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT,
|
||||
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
BTA_DM_API_BLE_TRACK_ADVERTISER_EVT,
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
BTA_DM_API_BLE_ENERGY_INFO_EVT,
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
|
||||
BTA_DM_API_BLE_DISCONNECT_EVT,
|
||||
|
||||
#endif
|
||||
#if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
|
||||
BTA_DM_API_ENABLE_TEST_MODE_EVT,
|
||||
BTA_DM_API_DISABLE_TEST_MODE_EVT,
|
||||
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
|
||||
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
BTA_DM_API_EXECUTE_CBACK_EVT,
|
||||
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
BTA_DM_API_REMOVE_ALL_ACL_EVT,
|
||||
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
BTA_DM_API_REMOVE_DEVICE_EVT,
|
||||
BTA_DM_API_BLE_SET_CHANNELS_EVT,
|
||||
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
|
||||
BTA_DM_API_CLEAR_WHITE_LIST_EVT,
|
||||
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
|
||||
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
BTA_DM_API_READ_RSSI_EVT,
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
|
||||
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
#endif
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTA_DM_API_READ_PHY_EVT,
|
||||
@@ -335,6 +286,25 @@ enum {
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTA_DM_API_SET_HOST_FEATURE_EVT,
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
BTA_DM_API_SET_PA_SUBEVT_DATA,
|
||||
BTA_DM_API_SET_PA_RSP_DATA,
|
||||
BTA_DM_API_SET_PA_SYNC_SUBEVT,
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
BTA_DM_API_CS_READ_LOCAL_SUPPORTED_CAPS,
|
||||
BTA_DM_API_CS_READ_REMOTE_SUPPORTED_CAPS,
|
||||
BTA_DM_API_CS_WRITE_CACHED_REMOTE_SUPPORTED_CAPS,
|
||||
BTA_DM_API_CS_SECURITY_ENABLE,
|
||||
BTA_DM_API_CS_SET_DEFAULT_SETTINGS,
|
||||
BTA_DM_API_CS_READ_REMOTE_FAE_TABLE,
|
||||
BTA_DM_API_CS_WRITE_CACHED_REMOTE_FAE_TABLE,
|
||||
BTA_DM_API_CS_CREATE_CONFIG,
|
||||
BTA_DM_API_CS_REMOVE_CONFIG,
|
||||
BTA_DM_API_CS_SET_CAHNNEL_CLASSIFICATION,
|
||||
BTA_DM_API_CS_SET_PROCEDURE_PARAMS,
|
||||
BTA_DM_API_CS_PROCEDURE_ENABLE,
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
|
||||
@@ -467,6 +437,7 @@ typedef struct {
|
||||
tBTA_UPDATE_WHITELIST_CBACK *update_wl_cb;
|
||||
}tBTA_DM_API_UPDATE_WHITE_LIST;
|
||||
|
||||
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 subcode;
|
||||
@@ -474,13 +445,7 @@ typedef struct {
|
||||
BD_ADDR device_info;
|
||||
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *exceptional_list_cb;
|
||||
}tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST;
|
||||
|
||||
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_CMPL_CB *read_tx_power_cb;
|
||||
}tBTA_DM_API_READ_ADV_TX_POWER;
|
||||
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
|
||||
@@ -743,15 +708,6 @@ typedef struct {
|
||||
UINT8 transport;
|
||||
} tBTA_DM_API_REMOVE_DEVICE;
|
||||
|
||||
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
/* data type for BTA_DM_API_EXECUTE_CBACK_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
void *p_param;
|
||||
tBTA_DM_EXEC_CBACK *p_exec_cback;
|
||||
} tBTA_DM_API_EXECUTE_CBACK;
|
||||
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
|
||||
/* data type for tBTA_DM_API_SET_ENCRYPTION */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@@ -834,6 +790,14 @@ typedef struct {
|
||||
uint16_t icon;
|
||||
} tBTA_DM_API_LOCAL_ICON;
|
||||
|
||||
#if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
uint8_t session_key[16];
|
||||
uint8_t iv[8];
|
||||
} tBTA_DM_API_KEY_MATERIAL;
|
||||
#endif
|
||||
|
||||
/* set scan parameter for BLE connections */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@@ -856,15 +820,6 @@ typedef struct {
|
||||
tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback;
|
||||
} tBTA_DM_API_BLE_SCAN_FILTER_PARAMS;
|
||||
|
||||
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
/* set scan parameter for BLE connections */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 scan_int;
|
||||
UINT16 scan_window;
|
||||
} tBTA_DM_API_BLE_CONN_SCAN_PARAMS;
|
||||
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
|
||||
/* Data type for start/stop observe */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@@ -941,35 +896,6 @@ typedef struct {
|
||||
|
||||
} tBTA_DM_API_BLE_FEATURE;
|
||||
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
/* multi adv data structure */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_BLE_MULTI_ADV_CBACK *p_cback;
|
||||
void *p_ref;
|
||||
tBTA_BLE_ADV_PARAMS *p_params;
|
||||
} tBTA_DM_API_BLE_MULTI_ADV_ENB;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 inst_id;
|
||||
tBTA_BLE_ADV_PARAMS *p_params;
|
||||
} tBTA_DM_API_BLE_MULTI_ADV_PARAM;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 inst_id;
|
||||
BOOLEAN is_scan_rsp;
|
||||
tBTA_BLE_AD_MASK data_mask;
|
||||
tBTA_BLE_ADV_DATA *p_data;
|
||||
} tBTA_DM_API_BLE_MULTI_ADV_DATA;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 inst_id;
|
||||
} tBTA_DM_API_BLE_MULTI_ADV_DISABLE;
|
||||
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 data_mask;
|
||||
@@ -986,59 +912,6 @@ typedef struct {
|
||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback;
|
||||
} tBTA_DM_API_SET_ADV_CONFIG_RAW;
|
||||
|
||||
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 batch_scan_full_max;
|
||||
UINT8 batch_scan_trunc_max;
|
||||
UINT8 batch_scan_notify_threshold;
|
||||
tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback;
|
||||
tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback;
|
||||
tBTA_BLE_SCAN_REP_CBACK *p_read_rep_cback;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
} tBTA_DM_API_SET_STORAGE_CONFIG;
|
||||
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_BLE_BATCH_SCAN_MODE scan_mode;
|
||||
UINT32 scan_int;
|
||||
UINT32 scan_window;
|
||||
tBTA_BLE_DISCARD_RULE discard_rule;
|
||||
tBLE_ADDR_TYPE addr_type;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
} tBTA_DM_API_ENABLE_SCAN;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
} tBTA_DM_API_DISABLE_SCAN;
|
||||
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_BLE_BATCH_SCAN_MODE scan_type;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
} tBTA_DM_API_READ_SCAN_REPORTS;
|
||||
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback;
|
||||
} tBTA_DM_API_TRACK_ADVERTISER;
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_BLE_ENERGY_INFO_CBACK *p_energy_info_cback;
|
||||
} tBTA_DM_API_ENERGY_INFO;
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR remote_bda;
|
||||
@@ -1156,28 +1029,169 @@ typedef struct {
|
||||
} tBTA_DM_API_SET_HOST_FEATURE;
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
typedef struct {
|
||||
UINT8 subevent;
|
||||
UINT8 response_slot_start;
|
||||
UINT8 response_slot_count;
|
||||
UINT8 subevent_data_len;
|
||||
UINT8 *subevent_data;
|
||||
} tBTA_BLE_SUBEVENT_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
UINT8 subevent;
|
||||
UINT8 response_slot_start;
|
||||
UINT8 response_slot_count;
|
||||
UINT8 subevent_data_len;
|
||||
UINT8 subevent_data[251];
|
||||
} tBTA_DM_API_BLE_SUBEVENT_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 adv_handle;
|
||||
UINT8 num_subevents_with_data;
|
||||
tBTA_DM_API_BLE_SUBEVENT_PARAMS *subevent_params;
|
||||
} tBTA_DM_API_BLE_PA_SUBEVENT_DATA;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 sync_handle;
|
||||
UINT16 request_event;
|
||||
UINT8 request_subevent;
|
||||
UINT8 rsp_subevent;
|
||||
UINT8 rsp_slot;
|
||||
UINT8 rsp_data_len;
|
||||
UINT8 *rsp_data;
|
||||
} tBTA_DM_API_BLE_PA_RSP_DATA;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 sync_handle;
|
||||
UINT16 periodic_adv_properties;
|
||||
UINT8 num_subevents_to_sync;
|
||||
UINT8 *subevent;
|
||||
} tBTA_DM_API_BLE_PA_SYNC_SUBEVT;
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_DM_API_CS_READ_LOCAL_SUPP_CAPS;
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
} tBTA_DM_API_CS_READ_REMOTE_SUPP_CAPS;
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
UINT8 num_config_supported;
|
||||
UINT16 max_consecutive_proc_supported;
|
||||
UINT8 num_ant_supported;
|
||||
UINT8 max_ant_paths_supported;
|
||||
UINT8 roles_supported;
|
||||
UINT8 modes_supported;
|
||||
UINT8 rtt_capability;
|
||||
UINT8 rtt_aa_only_n;
|
||||
UINT8 rtt_sounding_n;
|
||||
UINT8 rtt_random_payload_n;
|
||||
UINT16 NADM_sounding_capability;
|
||||
UINT16 NADM_random_capability;
|
||||
UINT8 cs_sync_phys_supported;
|
||||
UINT16 subfeatures_supported;
|
||||
UINT16 T_IP1_times_supported;
|
||||
UINT16 T_IP2_times_supported;
|
||||
UINT16 T_FCS_times_supported;
|
||||
UINT16 T_PM_times_supported;
|
||||
UINT8 T_SW_times_supported;
|
||||
UINT8 TX_SNR_capability;
|
||||
} tBTA_DM_API_CS_WRITE_CACHED_REMOTE_SUPP_CAPS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
} tBTA_DM_API_CS_SECURITY_ENABLE;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
UINT8 role_enable;
|
||||
UINT8 cs_sync_ant_selection;
|
||||
INT8 max_tx_power;
|
||||
} tBTA_DM_API_CS_SET_DEFAULT_SETTING_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
} tBTA_DM_API_CS_READ_REMOTE_TAB;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
UINT8 remote_fae_table[72];
|
||||
} tBTA_DM_API_CS_WRITE_CACHED_REMOTE_FAE_TAB_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
UINT8 config_id;
|
||||
UINT8 create_context;
|
||||
UINT8 main_mode_type;
|
||||
UINT8 sub_mode_type;
|
||||
UINT8 min_main_mode_steps;
|
||||
UINT8 max_main_mode_steps;
|
||||
UINT8 main_mode_repetition;
|
||||
UINT8 mode_0_steps;
|
||||
UINT8 role;
|
||||
UINT8 rtt_type;
|
||||
UINT8 cs_sync_phy;
|
||||
UINT8 channel_map[10];
|
||||
UINT8 channel_map_repetition;
|
||||
UINT8 channel_selection_type;
|
||||
UINT8 ch3c_shape;
|
||||
UINT8 ch3c_jump;
|
||||
UINT8 reserved;
|
||||
} tBTA_DM_API_CS_CREATE_CONFIG_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
UINT8 config_id;
|
||||
} tBTA_DM_API_CS_REMOVE_CONFIG_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 channel_class[10];
|
||||
} tBTA_DM_API_CS_SET_CHANNEL_CLASS_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
UINT8 config_id;
|
||||
UINT16 max_procedure_len;
|
||||
UINT16 min_procedure_interval;
|
||||
UINT16 max_procedure_interval;
|
||||
UINT16 max_procedure_count;
|
||||
UINT32 min_subevent_len;
|
||||
UINT32 max_subevent_len;
|
||||
UINT8 tone_ant_config_selection;
|
||||
UINT8 phy;
|
||||
UINT8 tx_power_delta;
|
||||
UINT8 preferred_peer_antenna;
|
||||
UINT8 SNR_control_initiator;
|
||||
UINT8 SNR_control_reflector;
|
||||
} tBTA_DM_API_CS_SET_PROC_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_handle;
|
||||
UINT8 config_id;
|
||||
UINT8 enable;
|
||||
} tBTA_DM_API_CS_PROC_ENABLE_PARAMS;
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
/* data type for BTA_DM_API_REMOVE_ACL_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
BOOLEAN remove_dev;
|
||||
tBTA_TRANSPORT transport;
|
||||
|
||||
} tBTA_DM_API_REMOVE_ACL;
|
||||
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
/* data type for BTA_DM_API_REMOVE_ALL_ACL_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_DM_LINK_TYPE link_type;
|
||||
|
||||
} tBTA_DM_API_REMOVE_ALL_ACL;
|
||||
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
@@ -1187,35 +1201,6 @@ typedef struct {
|
||||
UINT16 timeout;
|
||||
} tBTA_DM_API_UPDATE_CONN_PARAM;
|
||||
|
||||
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_DM_BLE_SCAN_COND_OP action;
|
||||
tBTA_DM_BLE_PF_COND_TYPE cond_type;
|
||||
tBTA_DM_BLE_PF_FILT_INDEX filt_index;
|
||||
tBTA_DM_BLE_PF_COND_PARAM *p_cond_param;
|
||||
tBTA_DM_BLE_PF_CFG_CBACK *p_filt_cfg_cback;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
} tBTA_DM_API_CFG_FILTER_COND;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 action;
|
||||
tBTA_DM_BLE_PF_STATUS_CBACK *p_filt_status_cback;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
} tBTA_DM_API_ENABLE_SCAN_FILTER;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 action;
|
||||
tBTA_DM_BLE_PF_FILT_INDEX filt_index;
|
||||
tBTA_DM_BLE_PF_FILT_PARAMS filt_params;
|
||||
tBLE_BD_ADDR *p_target;
|
||||
tBTA_DM_BLE_PF_PARAM_CBACK *p_filt_param_cback;
|
||||
tBTA_DM_BLE_REF_VALUE ref_value;
|
||||
} tBTA_DM_API_SCAN_FILTER_PARAM_SETUP;
|
||||
#endif
|
||||
|
||||
#if (BLE_50_DTM_TEST_EN == TRUE)
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@@ -1624,12 +1609,14 @@ typedef union {
|
||||
tBTA_DM_API_CFG_COEX_STATUS cfg_coex_status;
|
||||
#endif
|
||||
tBTA_DM_API_SEND_VENDOR_HCI_CMD vendor_hci_cmd;
|
||||
#if CLASSIC_BT_INCLUDED
|
||||
tBTA_DM_API_CONFIG_EIR config_eir;
|
||||
|
||||
tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels;
|
||||
tBTA_DM_API_PAGE_TO_SET set_page_timeout;
|
||||
tBTA_DM_API_PAGE_TO_GET get_page_timeout;
|
||||
tBTA_DM_API_SET_ACL_PKT_TYPES set_acl_pkt_types;
|
||||
#endif /* CLASSIC_BT_INCLUDED */
|
||||
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
|
||||
tBTA_DM_API_SET_MIN_ENC_KEY_SIZE set_min_enc_key_size;
|
||||
#endif
|
||||
@@ -1640,9 +1627,6 @@ typedef union {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBTA_DM_API_BLE_SET_CHANNELS ble_set_channels;
|
||||
tBTA_DM_API_UPDATE_WHITE_LIST white_list;
|
||||
#if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
tBTA_DM_API_READ_ADV_TX_POWER read_tx_power;
|
||||
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
tBTA_DM_API_READ_RSSI rssi;
|
||||
|
||||
@@ -1695,9 +1679,6 @@ typedef union {
|
||||
#endif /* #if (BTA_DM_QOS_INCLUDED == TRUE) */
|
||||
|
||||
tBTA_DM_API_DI_DISC di_disc;
|
||||
#if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
tBTA_DM_API_EXECUTE_CBACK exec_cback;
|
||||
#endif // #if (BLE_HOST_EXECUTE_CBACK_EN == TRUE)
|
||||
tBTA_DM_API_SET_ENCRYPTION set_encryption;
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
@@ -1708,59 +1689,28 @@ typedef union {
|
||||
tBTA_DM_API_BLE_SEC_GRANT ble_sec_grant;
|
||||
tBTA_DM_API_BLE_SET_BG_CONN_TYPE ble_set_bd_conn_type;
|
||||
tBTA_DM_API_BLE_CONN_PARAMS ble_set_conn_params;
|
||||
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
tBTA_DM_API_BLE_CONN_SCAN_PARAMS ble_set_conn_scan_params;
|
||||
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
#if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
|
||||
tBTA_DM_API_BLE_SCAN_PARAMS ble_set_scan_params;
|
||||
#endif // #if (BLE_HOST_BLE_SCAN_PARAM_UNUSED == TRUE)
|
||||
tBTA_DM_API_BLE_SCAN_FILTER_PARAMS ble_set_scan_fil_params;
|
||||
tBTA_DM_API_BLE_OBSERVE ble_observe;
|
||||
tBTA_DM_API_BLE_SCAN ble_scan;
|
||||
tBTA_DM_API_ENABLE_PRIVACY ble_remote_privacy;
|
||||
tBTA_DM_API_LOCAL_PRIVACY ble_local_privacy;
|
||||
tBTA_DM_API_LOCAL_ICON ble_local_icon;
|
||||
#if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
tBTA_DM_API_KEY_MATERIAL ble_key_material;
|
||||
#endif
|
||||
tBTA_DM_API_BLE_ADV_PARAMS_ALL ble_set_adv_params_all;
|
||||
tBTA_DM_API_SET_ADV_CONFIG ble_set_adv_data;
|
||||
tBTA_DM_API_SET_ADV_CONFIG_RAW ble_set_adv_data_raw;
|
||||
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
tBTA_DM_API_SCAN_FILTER_PARAM_SETUP ble_scan_filt_param_setup;
|
||||
tBTA_DM_API_CFG_FILTER_COND ble_cfg_filter_cond;
|
||||
tBTA_DM_API_ENABLE_SCAN_FILTER ble_enable_scan_filt;
|
||||
#endif
|
||||
tBTA_DM_API_UPDATE_CONN_PARAM ble_update_conn_params;
|
||||
tBTA_DM_API_BLE_SET_DATA_LENGTH ble_set_data_length;
|
||||
tBTA_DM_APT_SET_DEV_ADDR set_addr;
|
||||
tBTA_DM_APT_CLEAR_ADDR clear_addr;
|
||||
tBTA_DM_API_SET_RPA_TIMEOUT set_rpa_timeout;
|
||||
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST add_dev_to_resolving_list;
|
||||
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
tBTA_DM_API_BLE_MULTI_ADV_ENB ble_multi_adv_enb;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_DISABLE ble_multi_adv_disable;
|
||||
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
tBTA_DM_API_SET_STORAGE_CONFIG ble_set_storage;
|
||||
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
tBTA_DM_API_ENABLE_SCAN ble_enable_scan;
|
||||
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
#if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
tBTA_DM_API_READ_SCAN_REPORTS ble_read_reports;
|
||||
#endif // #if (BLE_HOST_READ_SCAN_REPORTS_EN == TRUE)
|
||||
#if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
tBTA_DM_API_DISABLE_SCAN ble_disable_scan;
|
||||
#endif // #if (BLE_HOST_BATCH_SCAN_EN == TRUE)
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
tBTA_DM_API_TRACK_ADVERTISER ble_track_advert;
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
tBTA_DM_API_ENERGY_INFO ble_energy_info;
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
tBTA_DM_API_BLE_DISCONNECT ble_disconnect;
|
||||
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST ble_duplicate_exceptional_list;
|
||||
#endif // ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
tBTA_DM_API_READ_PHY ble_read_phy;
|
||||
tBTA_DM_API_SET_PER_DEF_PHY ble_set_per_def_phy;
|
||||
@@ -1812,13 +1762,6 @@ typedef union {
|
||||
tBTA_DM_API_BLE_SET_CSA_SUPPORT ble_set_csa_support;
|
||||
tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK ble_set_vendor_evt_mask;
|
||||
#endif
|
||||
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
tBTA_DM_API_REMOVE_ACL remove_acl;
|
||||
#endif // #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
|
||||
#if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
tBTA_DM_API_REMOVE_ALL_ACL remove_all_acl;
|
||||
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
|
||||
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
|
||||
tBTA_DM_API_BIG_CREATE big_creat;
|
||||
@@ -1876,6 +1819,25 @@ typedef union {
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
tBTA_DM_API_SET_HOST_FEATURE set_host_feat;
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
tBTA_DM_API_BLE_PA_SUBEVENT_DATA pa_subevt_data;
|
||||
tBTA_DM_API_BLE_PA_RSP_DATA pa_rsp_data;
|
||||
tBTA_DM_API_BLE_PA_SYNC_SUBEVT pa_sync_subevt;
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
tBTA_DM_API_CS_READ_LOCAL_SUPP_CAPS read_local_supp_caps;
|
||||
tBTA_DM_API_CS_READ_REMOTE_SUPP_CAPS read_remote_supp_caps;
|
||||
tBTA_DM_API_CS_WRITE_CACHED_REMOTE_SUPP_CAPS write_cached_remote_caps;
|
||||
tBTA_DM_API_CS_SECURITY_ENABLE security_enable;
|
||||
tBTA_DM_API_CS_SET_DEFAULT_SETTING_PARAMS set_default_setting_params;
|
||||
tBTA_DM_API_CS_READ_REMOTE_TAB read_remote_tab;
|
||||
tBTA_DM_API_CS_WRITE_CACHED_REMOTE_FAE_TAB_PARAMS write_cached_remote_fae_tab_params;
|
||||
tBTA_DM_API_CS_CREATE_CONFIG_PARAMS create_config_params;
|
||||
tBTA_DM_API_CS_REMOVE_CONFIG_PARAMS remove_config_params;
|
||||
tBTA_DM_API_CS_SET_CHANNEL_CLASS_PARAMS set_channel_class_params;
|
||||
tBTA_DM_API_CS_SET_PROC_PARAMS set_proc_params;
|
||||
tBTA_DM_API_CS_PROC_ENABLE_PARAMS proc_enable_params;
|
||||
#endif
|
||||
} tBTA_DM_MSG;
|
||||
|
||||
|
||||
@@ -1984,24 +1946,9 @@ typedef struct {
|
||||
BOOLEAN is_bta_dm_active;
|
||||
tBTA_DM_ACTIVE_LINK device_list;
|
||||
tBTA_DM_SEC_CBACK *p_sec_cback;
|
||||
#if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
|
||||
tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback;
|
||||
tBTA_DM_BLE_PF_CFG_CBACK *p_scan_filt_cfg_cback;
|
||||
tBTA_DM_BLE_PF_STATUS_CBACK *p_scan_filt_status_cback;
|
||||
tBTA_DM_BLE_PF_PARAM_CBACK *p_scan_filt_param_cback;
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
tBTA_BLE_MULTI_ADV_CBACK *p_multi_adv_cback;
|
||||
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
tBTA_BLE_ENERGY_INFO_CBACK *p_energy_info_cback;
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
#endif
|
||||
UINT16 state;
|
||||
BOOLEAN disabling;
|
||||
TIMER_LIST_ENT disable_timer;
|
||||
UINT32 wbt_sdp_handle; /* WIDCOMM Extensions SDP record handle */
|
||||
UINT8 wbt_scn; /* WIDCOMM Extensions SCN */
|
||||
UINT8 num_master_only;
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
UINT8 pm_id;
|
||||
tBTA_PM_TIMER pm_timer[BTA_DM_NUM_PM_TIMER];
|
||||
@@ -2009,7 +1956,9 @@ typedef struct {
|
||||
UINT32 role_policy_mask; /* the bits set indicates the modules that wants to remove role switch from the default link policy */
|
||||
UINT16 cur_policy; /* current default link policy */
|
||||
UINT16 rs_event; /* the event waiting for role switch */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
UINT8 cur_av_count; /* current AV connections */
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BOOLEAN disable_pair_mode; /* disable pair mode or not */
|
||||
BOOLEAN conn_paired_only; /* allow connectable to paired device only or not */
|
||||
tBTA_DM_API_SEARCH search_msg;
|
||||
@@ -2040,7 +1989,9 @@ typedef struct {
|
||||
|
||||
|
||||
tBTA_DM_ENCRYPT_CBACK *p_encrypt_cback;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
TIMER_LIST_ENT switch_delay_timer[BTA_DM_NUM_PEER_DEVICE];
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
} tBTA_DM_CB;
|
||||
|
||||
@@ -2210,8 +2161,10 @@ extern tBTA_DM_SEARCH_CB *bta_dm_search_cb_ptr;
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_DM_DI_CB bta_dm_di_cb;
|
||||
#else
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
|
||||
#define bta_dm_di_cb (*bta_dm_di_cb_ptr)
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
extern SemaphoreHandle_t deinit_semaphore;
|
||||
#endif
|
||||
|
||||
@@ -2288,9 +2241,6 @@ extern void bta_dm_ble_set_bg_conn_type (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_scan_fil_params(tBTA_DM_MSG *p_data);
|
||||
#if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
extern void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BLE_HOST_CONN_SCAN_PARAM_EN == TRUE)
|
||||
#if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
|
||||
extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data);
|
||||
#endif /* ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE) */
|
||||
@@ -2300,27 +2250,22 @@ extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_clear_rand_address(tBTA_DM_MSG *p_data);
|
||||
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
extern void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_config_local_icon (tBTA_DM_MSG *p_data);
|
||||
#if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
extern void bta_dm_ble_set_key_material (tBTA_DM_MSG *p_data);
|
||||
#endif
|
||||
extern void bta_dm_ble_set_adv_params_all(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_adv_config_raw (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_advstop (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data);
|
||||
#if SMP_INCLUDED == TRUE
|
||||
extern void bta_dm_co_security_param_init(void);
|
||||
#endif
|
||||
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data);
|
||||
#endif
|
||||
extern void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data);
|
||||
@@ -2351,21 +2296,8 @@ extern void bta_dm_ble_gap_set_ext_scan_params(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_ext_scan(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_set_prefer_ext_conn_params(tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
extern void bta_dm_ble_setup_storage(tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BLE_HOST_SETUP_STORAGE_EN == TRUE)
|
||||
extern void bta_dm_ble_enable_batch_scan(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_disable_batch_scan(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data);
|
||||
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
extern void bta_dm_ble_track_advertiser(tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
extern void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
|
||||
#endif
|
||||
extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_confirm(tBTA_DM_MSG *p_data);
|
||||
@@ -2428,7 +2360,6 @@ extern void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_execute_callback(tBTA_DM_MSG *p_data);
|
||||
|
||||
|
||||
extern void bta_dm_remove_all_acl(tBTA_DM_MSG *p_data);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data);
|
||||
|
||||
@@ -2543,4 +2474,23 @@ void bta_dm_api_subrate_request(tBTA_DM_MSG *p_data);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void bta_dm_ble_set_host_feature(tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
void bta_dm_api_set_periodic_adv_subevt_data(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_set_periodic_adv_response_data(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_set_periodic_sync_subevt(tBTA_DM_MSG *p_data);
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
void bta_dm_api_cs_read_local_supported_caps(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_read_remote_supported_caps(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_write_cached_remote_supported_caps(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_security_enable(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_set_default_settings(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_read_remote_fae_table(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_write_cached_remote_fae_table(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_create_config(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_remove_config(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_set_channel_classification(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_set_procedure_params(tBTA_DM_MSG *p_data);
|
||||
void bta_dm_api_cs_procedure_enable(tBTA_DM_MSG *p_data);
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
#endif /* BTA_DM_INT_H */
|
||||
|
||||
@@ -511,6 +511,10 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
tGATT_TCB *p_tcb;
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
|
||||
|
||||
BOOLEAN is_pawr_synced = FALSE;
|
||||
UINT8 adv_handle = 0xFF;
|
||||
UINT8 subevent = 0xFF;
|
||||
|
||||
if (!p_clcb || !p_data) {
|
||||
return;
|
||||
}
|
||||
@@ -545,10 +549,15 @@ void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
APPL_TRACE_ERROR("Unknown Device, setting rejected");
|
||||
}
|
||||
}
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
is_pawr_synced = p_data->api_conn.is_pawr_synced;
|
||||
adv_handle = p_data->api_conn.adv_handle;
|
||||
subevent = p_data->api_conn.subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
/* open/hold a connection */
|
||||
if (!GATT_Connect(p_clcb->p_rcb->client_if, p_data->api_conn.remote_bda, p_data->api_conn.remote_addr_type,
|
||||
TRUE, p_data->api_conn.transport, p_data->api_conn.is_aux)) {
|
||||
TRUE, p_data->api_conn.transport, p_data->api_conn.is_aux, is_pawr_synced,
|
||||
adv_handle, subevent)) {
|
||||
APPL_TRACE_ERROR("Connection open failure");
|
||||
|
||||
bta_gattc_sm_execute(p_clcb, BTA_GATTC_INT_OPEN_FAIL_EVT, p_data);
|
||||
@@ -585,7 +594,7 @@ void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg
|
||||
/* always call open to hold a connection */
|
||||
if (!GATT_Connect(p_data->client_if, p_data->remote_bda,
|
||||
p_data->remote_addr_type, FALSE,
|
||||
p_data->transport, p_data->is_aux)) {
|
||||
p_data->transport, p_data->is_aux, FALSE, 0xFF, 0xFF)) {
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
uint8_t *bda = (uint8_t *)p_data->remote_bda;
|
||||
#endif
|
||||
@@ -727,6 +736,7 @@ void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
#if (GATTC_CACHE_NVS == TRUE)
|
||||
p_clcb->p_srcb->state = BTA_GATTC_SERV_LOAD;
|
||||
if (bta_gattc_cache_load(p_clcb)) {
|
||||
APPL_TRACE_DEBUG("%s found gattc cache", __func__);
|
||||
p_clcb->p_srcb->state = BTA_GATTC_SERV_IDLE;
|
||||
bta_gattc_reset_discover_st(p_clcb->p_srcb, BTA_GATT_OK);
|
||||
//register service change
|
||||
@@ -734,6 +744,7 @@ void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
} else
|
||||
#endif
|
||||
{ /* cache is building */
|
||||
APPL_TRACE_DEBUG("%s cache not found, start discovery %u", __func__, bta_gattc_cb.auto_disc);
|
||||
if (bta_gattc_cb.auto_disc) {
|
||||
p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC;
|
||||
/* cache load failure, start discovery */
|
||||
@@ -753,10 +764,12 @@ void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
}
|
||||
|
||||
if (p_clcb->p_rcb) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* there is no RM for GATT */
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_conn_open(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
tBTA_GATT_STATUS status = BTA_GATT_OK;
|
||||
if (p_data && p_data->int_conn.already_connect) {
|
||||
//clear already_connect
|
||||
@@ -859,11 +872,11 @@ void bta_gattc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
cb_data.close.reason = p_clcb->reason;
|
||||
cb_data.close.status = p_clcb->status;
|
||||
bdcpy(cb_data.close.remote_bda, p_clcb->bda);
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_conn_close( BTA_ID_GATTC , BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (p_data->hdr.event == BTA_GATTC_API_CLOSE_EVT) {
|
||||
cb_data.close.status = GATT_Disconnect(p_data->hdr.layer_specific);
|
||||
} else if (p_data->hdr.event == BTA_GATTC_INT_DISCONN_EVT) {
|
||||
@@ -1327,11 +1340,13 @@ void bta_gattc_confirm(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
!= GATT_SUCCESS) {
|
||||
APPL_TRACE_ERROR("bta_gattc_confirm to handle [0x%04x] failed", handle);
|
||||
} else {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
bta_sys_idle(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
@@ -1847,6 +1862,8 @@ void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
|
||||
UINT8 i;
|
||||
UNUSED(p_cb);
|
||||
|
||||
APPL_TRACE_DEBUG("%s", __func__);
|
||||
|
||||
if (p_srvc_cb != NULL) {
|
||||
/* try to find a CLCB */
|
||||
if (p_srvc_cb->connected && p_srvc_cb->num_clcb != 0) {
|
||||
@@ -1965,6 +1982,8 @@ void bta_gattc_process_api_cache_clean(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_m
|
||||
tBTA_GATTC_SERV *p_srvc_cb = bta_gattc_find_srvr_cache(p_msg->api_clean.remote_bda);
|
||||
UNUSED(p_cb);
|
||||
|
||||
APPL_TRACE_DEBUG("%s", __func__);
|
||||
|
||||
if (p_srvc_cb != NULL && p_srvc_cb->p_srvc_cache != NULL) {
|
||||
//mark it and delete the cache */
|
||||
list_free(p_srvc_cb->p_srvc_cache);
|
||||
@@ -2187,13 +2206,13 @@ static void bta_gattc_cmpl_cback(UINT16 conn_id, tGATTC_OPTYPE op, tGATT_STATUS
|
||||
APPL_TRACE_ERROR("bta_gattc_cmpl_cback unknown conn_id = %d, ignore data", conn_id);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (p_clcb->transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
bta_sys_idle(BTA_ID_GATTC, BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_gattc_cmpl_sendmsg(conn_id, op, status, p_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ void BTA_GATTC_AppDeregister(tBTA_GATTC_IF client_if)
|
||||
*******************************************************************************/
|
||||
void BTA_GATTC_Enh_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_TYPE remote_addr_type,
|
||||
BOOLEAN is_direct, tBTA_GATT_TRANSPORT transport, BOOLEAN is_aux, tBTA_ADDR_TYPE own_addr_type,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent,
|
||||
UINT8 phy_mask, tBTA_BLE_CONN_PARAMS *phy_1m_conn_params, tBTA_BLE_CONN_PARAMS *phy_2m_conn_params,
|
||||
tBTA_BLE_CONN_PARAMS *phy_coded_conn_params)
|
||||
{
|
||||
@@ -156,6 +157,11 @@ void BTA_GATTC_Enh_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_T
|
||||
p_buf->is_direct = is_direct;
|
||||
p_buf->transport = transport;
|
||||
p_buf->is_aux = is_aux;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
p_buf->is_pawr_synced = is_pawr_synced;
|
||||
p_buf->adv_handle = adv_handle;
|
||||
p_buf->subevent = subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
p_buf->remote_addr_type = remote_addr_type;
|
||||
p_buf->own_addr_type = own_addr_type;
|
||||
p_buf->phy_mask = phy_mask;
|
||||
|
||||
@@ -444,6 +444,8 @@ void bta_gattc_co_cache_addr_init(void)
|
||||
|
||||
void bta_gattc_co_cache_addr_deinit(void)
|
||||
{
|
||||
APPL_TRACE_DEBUG("%s is_open=%d", __func__, cache_env->is_open);
|
||||
|
||||
if(!cache_env->is_open) {
|
||||
return;
|
||||
}
|
||||
@@ -553,7 +555,7 @@ void bta_gattc_co_cache_addr_save(BD_ADDR bd_addr, hash_key_t hash_key)
|
||||
memcpy(cache_env->cache_addr[new_index].addr, bd_addr, sizeof(BD_ADDR));
|
||||
memcpy(cache_env->cache_addr[new_index].hash_key, hash_key, sizeof(hash_key_t));
|
||||
cache_env->num_addr++;
|
||||
APPL_TRACE_DEBUG("%s(), num = %d", __func__, cache_env->num_addr);
|
||||
APPL_TRACE_DEBUG("%s bd_addr="MACSTR" num=%d", __func__, MAC2STR(bd_addr), cache_env->num_addr);
|
||||
}
|
||||
|
||||
nvs_handle_t *fp = &cache_env->addr_fp;
|
||||
|
||||
@@ -327,6 +327,8 @@ void bta_gattc_clcb_dealloc_by_conn_id(UINT16 conn_id)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
APPL_TRACE_DEBUG("%s conn_id=%u p_clcb=%p", __func__, conn_id, p_clcb);
|
||||
|
||||
if (p_clcb) {
|
||||
tBTA_GATTC_RCB *p_clreg = p_clcb->p_rcb;
|
||||
bta_gattc_clcb_dealloc(p_clcb);
|
||||
@@ -523,10 +525,82 @@ BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
cmd_data->api_write.p_value = (UINT8 *)(cmd_data + 1);
|
||||
memcpy(cmd_data->api_write.p_value, p_data->api_write.p_value, len);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, size %d, no memory. free=%d, largest_block=%d", __func__, __LINE__,
|
||||
sizeof(tBTA_GATTC_DATA) + len, heap_caps_get_free_size(MALLOC_CAP_DEFAULT), heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT));
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, no memory.", __func__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
} else if (p_data->hdr.event == BTA_GATTC_API_SEARCH_EVT) {
|
||||
/*
|
||||
* Fix for Use-After-Free (UAF) bug in service search with filter_uuid.
|
||||
*
|
||||
* Problem Description:
|
||||
* ====================
|
||||
* In BTA_GATTC_ServiceSearchRequest(), memory is allocated as:
|
||||
* [tBTA_GATTC_API_SEARCH structure][tBT_UUID data]
|
||||
*
|
||||
* The p_srvc_uuid pointer points to the tBT_UUID data located right after
|
||||
* the structure:
|
||||
* p_buf->p_srvc_uuid = (tBT_UUID *)(p_buf + 1);
|
||||
*
|
||||
* When this command is enqueued (e.g., during DISCOVER_ST state), the original
|
||||
* code only performed a shallow copy:
|
||||
* - Only sizeof(tBTA_GATTC_DATA) was allocated for cmd_data
|
||||
* - memcpy copied the pointer VALUE (not the pointed data)
|
||||
* - After the original message is freed by bta_sys_event(), the p_srvc_uuid
|
||||
* pointer becomes a dangling pointer pointing to freed memory
|
||||
*
|
||||
* Memory layout before fix:
|
||||
*
|
||||
* Original (p_data): Copy (cmd_data):
|
||||
* +------------------+----------+ +------------------+
|
||||
* | API_SEARCH | tBT_UUID | | API_SEARCH |
|
||||
* | p_srvc_uuid: --------► | | p_srvc_uuid: --------► (dangling!)
|
||||
* +------------------+----------+ +------------------+
|
||||
* ↑
|
||||
* After free(), this memory may be
|
||||
* overwritten by other allocations
|
||||
*
|
||||
* Solution:
|
||||
* =========
|
||||
* For BTA_GATTC_API_SEARCH_EVT with non-NULL p_srvc_uuid, we need to:
|
||||
* 1. Allocate extra space for tBT_UUID
|
||||
* 2. Copy the structure
|
||||
* 3. Update p_srvc_uuid to point to the new location
|
||||
* 4. Copy the tBT_UUID data
|
||||
*
|
||||
* Memory layout after fix:
|
||||
*
|
||||
* Copy (cmd_data):
|
||||
* +------------------+----------+
|
||||
* | API_SEARCH | tBT_UUID |
|
||||
* | p_srvc_uuid: --------► | (points to its own copy)
|
||||
* +------------------+----------+
|
||||
*/
|
||||
if (p_data->api_search.p_srvc_uuid != NULL) {
|
||||
/* Allocate space for structure + UUID data (deep copy) */
|
||||
len = sizeof(tBTA_GATTC_DATA) + sizeof(tBT_UUID);
|
||||
if ((cmd_data = (tBTA_GATTC_DATA *)osi_malloc(len)) != NULL) {
|
||||
memset(cmd_data, 0, len);
|
||||
/* Copy the structure */
|
||||
memcpy(cmd_data, p_data, sizeof(tBTA_GATTC_DATA));
|
||||
/* Update pointer to point to the space after the structure */
|
||||
cmd_data->api_search.p_srvc_uuid = (tBT_UUID *)(cmd_data + 1);
|
||||
/* Copy the UUID data */
|
||||
memcpy(cmd_data->api_search.p_srvc_uuid,
|
||||
p_data->api_search.p_srvc_uuid, sizeof(tBT_UUID));
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, no memory.", __func__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
/* p_srvc_uuid is NULL, no extra space needed (search all services) */
|
||||
if ((cmd_data = (tBTA_GATTC_DATA *)osi_malloc(sizeof(tBTA_GATTC_DATA))) != NULL) {
|
||||
memset(cmd_data, 0, sizeof(tBTA_GATTC_DATA));
|
||||
memcpy(cmd_data, p_data, sizeof(tBTA_GATTC_DATA));
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, no memory.", __func__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((cmd_data = (tBTA_GATTC_DATA *)osi_malloc(sizeof(tBTA_GATTC_DATA))) != NULL) {
|
||||
memset(cmd_data, 0, sizeof(tBTA_GATTC_DATA));
|
||||
|
||||
@@ -695,12 +695,13 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||
p_msg->api_indicate.len,
|
||||
p_msg->api_indicate.value);
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTS, BTA_ALL_APP_ID, remote_bda);
|
||||
bta_sys_idle(BTA_ID_GATTS, BTA_ALL_APP_ID, remote_bda);
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
} else {
|
||||
APPL_TRACE_ERROR("Unknown connection ID: %d fail sending notification",
|
||||
p_msg->api_indicate.hdr.layer_specific);
|
||||
@@ -757,7 +758,7 @@ void bta_gatts_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||
if ((p_rcb = bta_gatts_find_app_rcb_by_app_if(p_msg->api_open.server_if)) != NULL) {
|
||||
/* should always get the connection ID */
|
||||
if (GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, BLE_ADDR_UNKNOWN_TYPE,
|
||||
p_msg->api_open.is_direct, p_msg->api_open.transport, FALSE)) {
|
||||
p_msg->api_open.is_direct, p_msg->api_open.transport, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
status = BTA_GATT_OK;
|
||||
|
||||
if (GATT_GetConnIdIfConnected(p_rcb->gatt_if, p_msg->api_open.remote_bda,
|
||||
@@ -839,10 +840,11 @@ void bta_gatts_close (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
||||
|
||||
if (p_rcb && p_rcb->p_cback) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_conn_close( BTA_ID_GATTS , BTA_ALL_APP_ID, remote_bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
close.status = status;
|
||||
close.conn_id = p_msg->hdr.layer_specific;
|
||||
(*p_rcb->p_cback)(BTA_GATTS_CLOSE_EVT, (tBTA_GATTS *)&close);
|
||||
@@ -925,12 +927,13 @@ static void bta_gatts_send_request_cback (UINT16 conn_id,
|
||||
conn_id, trans_id, req_type);
|
||||
|
||||
if (p_rcb && p_rcb->p_cback) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
bta_sys_busy(BTA_ID_GATTS, BTA_ALL_APP_ID, cb_data.req_data.remote_bda);
|
||||
bta_sys_idle(BTA_ID_GATTS, BTA_ALL_APP_ID, cb_data.req_data.remote_bda);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
cb_data.req_data.conn_id = conn_id;
|
||||
cb_data.req_data.trans_id = trans_id;
|
||||
cb_data.req_data.p_data = (tBTA_GATTS_REQ_DATA *)p_data;
|
||||
@@ -980,6 +983,7 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
|
||||
p_reg = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
||||
|
||||
if (p_reg && p_reg->p_cback) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/* there is no RM for GATT */
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
if (connected) {
|
||||
@@ -988,6 +992,7 @@ static void bta_gatts_conn_cback (tGATT_IF gatt_if, BD_ADDR bda, UINT16 conn_id,
|
||||
bta_sys_conn_close( BTA_ID_GATTS , BTA_ALL_APP_ID, bda);
|
||||
}
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if(evt == BTA_GATTS_CONNECT_EVT) {
|
||||
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bda, BT_TRANSPORT_LE);
|
||||
if(p_lcb != NULL) {
|
||||
|
||||
@@ -130,6 +130,11 @@ typedef struct {
|
||||
tBTA_GATTC_IF client_if;
|
||||
BOOLEAN is_direct;
|
||||
BOOLEAN is_aux;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
BOOLEAN is_pawr_synced;
|
||||
UINT8 adv_handle;
|
||||
UINT8 subevent;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
tBTA_TRANSPORT transport;
|
||||
tBTA_ADDR_TYPE own_addr_type;
|
||||
UINT8 phy_mask;
|
||||
|
||||
@@ -2603,10 +2603,11 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB *p_cb, BOOLEAN check_bond)
|
||||
!p_cb->in_bg_conn && to_add) {
|
||||
/* add device into BG connection to accept remote initiated connection */
|
||||
BTA_GATTC_Enh_Open(bta_hh_cb.gatt_if, p_cb->addr, BLE_ADDR_UNKNOWN_TYPE, FALSE,
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE, 0, NULL, NULL);
|
||||
BTA_GATT_TRANSPORT_LE, FALSE, BLE_ADDR_UNKNOWN_TYPE, false, 0xFF, 0xFF, 0, NULL, NULL);
|
||||
p_cb->in_bg_conn = TRUE;
|
||||
|
||||
#if (BLE_GATT_BGCONN == TRUE)
|
||||
BTA_DmBleSetBgConnType(BTA_DM_BLE_CONN_AUTO, NULL);
|
||||
#endif // (BLE_GATT_BGCONN == TRUE)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -293,9 +293,6 @@ typedef struct {
|
||||
BOOLEAN report_dup; /* report duplicated inquiry response with higher RSSI value */
|
||||
tBTA_DM_INQ_FILT filter_type; /* Filter condition type. */
|
||||
tBTA_DM_INQ_COND filter_cond; /* Filter condition data. */
|
||||
#if (defined(BTA_HOST_INTERLEAVE_SEARCH) && BTA_HOST_INTERLEAVE_SEARCH == TRUE)
|
||||
UINT8 intl_duration[4];/*duration array storing the interleave scan's time portions*/
|
||||
#endif
|
||||
} tBTA_DM_INQ;
|
||||
|
||||
/* Config EIR callback */
|
||||
@@ -514,13 +511,6 @@ typedef struct {
|
||||
tBTA_BLE_SERVICE service;
|
||||
} tBTA_BLE_INQ_DATA;
|
||||
|
||||
enum {
|
||||
BTA_BLE_BATCH_SCAN_MODE_PASS = 1,
|
||||
BTA_BLE_BATCH_SCAN_MODE_ACTI = 2,
|
||||
BTA_BLE_BATCH_SCAN_MODE_PASS_ACTI = 3
|
||||
};
|
||||
typedef UINT8 tBTA_BLE_BATCH_SCAN_MODE;
|
||||
|
||||
enum {
|
||||
BTA_BLE_DISCARD_OLD_ITEMS = 0,
|
||||
BTA_BLE_DISCARD_LOWER_RSSI_ITEMS = 1
|
||||
@@ -533,19 +523,6 @@ enum {
|
||||
};
|
||||
typedef UINT8 tBTA_BLE_ADV_CHANGE_REASON;
|
||||
|
||||
enum {
|
||||
BTA_BLE_BATCH_SCAN_ENB_EVT = 1,
|
||||
BTA_BLE_BATCH_SCAN_CFG_STRG_EVT = 2,
|
||||
BTA_BLE_BATCH_SCAN_DATA_EVT = 3,
|
||||
BTA_BLE_BATCH_SCAN_THRES_EVT = 4,
|
||||
BTA_BLE_BATCH_SCAN_PARAM_EVT = 5,
|
||||
BTA_BLE_BATCH_SCAN_DIS_EVT = 6
|
||||
};
|
||||
typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT;
|
||||
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION;
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
// #endif
|
||||
|
||||
/* BLE customer specific feature function type definitions */
|
||||
@@ -579,7 +556,6 @@ enum {
|
||||
BTA_DM_BLE_SCAN_COND_DELETE,
|
||||
BTA_DM_BLE_SCAN_COND_CLEAR = 2
|
||||
};
|
||||
typedef UINT8 tBTA_DM_BLE_SCAN_COND_OP;
|
||||
|
||||
/* ADV payload filtering vendor specific call event */
|
||||
enum {
|
||||
@@ -587,18 +563,6 @@ enum {
|
||||
BTA_BLE_SCAN_PF_COND_EVT
|
||||
};
|
||||
|
||||
/* filter selection bit index */
|
||||
#define BTA_DM_BLE_PF_ADDR_FILTER BTM_BLE_PF_ADDR_FILTER
|
||||
#define BTA_DM_BLE_PF_SRVC_DATA BTM_BLE_PF_SRVC_DATA
|
||||
#define BTA_DM_BLE_PF_SRVC_UUID BTM_BLE_PF_SRVC_UUID
|
||||
#define BTA_DM_BLE_PF_SRVC_SOL_UUID BTM_BLE_PF_SRVC_SOL_UUID
|
||||
#define BTA_DM_BLE_PF_LOCAL_NAME BTM_BLE_PF_LOCAL_NAME
|
||||
#define BTA_DM_BLE_PF_MANU_DATA BTM_BLE_PF_MANU_DATA
|
||||
#define BTA_DM_BLE_PF_SRVC_DATA_PATTERN BTM_BLE_PF_SRVC_DATA_PATTERN
|
||||
#define BTA_DM_BLE_PF_TYPE_ALL BTM_BLE_PF_TYPE_ALL
|
||||
#define BTA_DM_BLE_PF_TYPE_MAX BTM_BLE_PF_TYPE_MAX
|
||||
typedef UINT8 tBTA_DM_BLE_PF_COND_TYPE;
|
||||
|
||||
typedef union {
|
||||
UINT16 uuid16_mask;
|
||||
UINT32 uuid32_mask;
|
||||
@@ -634,18 +598,6 @@ typedef struct {
|
||||
as data pattern, set to all 0xff, match exact data */
|
||||
} tBTA_DM_BLE_PF_SRVC_PATTERN_COND;
|
||||
|
||||
typedef union {
|
||||
tBLE_BD_ADDR target_addr;
|
||||
tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */
|
||||
tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */
|
||||
tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
|
||||
} tBTA_DM_BLE_PF_COND_PARAM;
|
||||
|
||||
typedef UINT8 tBTA_DM_BLE_PF_FILT_INDEX;
|
||||
typedef UINT8 tBTA_DM_BLE_PF_AVBL_SPACE;
|
||||
|
||||
typedef INT8 tBTA_DM_RSSI_VALUE;
|
||||
typedef UINT8 tBTA_DM_LINK_QUALITY_VALUE;
|
||||
|
||||
@@ -1053,82 +1005,8 @@ typedef union {
|
||||
/* Security callback */
|
||||
typedef void (tBTA_DM_SEC_CBACK)(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *p_data);
|
||||
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
#define BTA_BLE_MULTI_ADV_ILLEGAL 0
|
||||
|
||||
/* multi adv callback event */
|
||||
#define BTA_BLE_MULTI_ADV_ENB_EVT 1
|
||||
#define BTA_BLE_MULTI_ADV_DISABLE_EVT 2
|
||||
#define BTA_BLE_MULTI_ADV_PARAM_EVT 3
|
||||
#define BTA_BLE_MULTI_ADV_DATA_EVT 4
|
||||
|
||||
typedef UINT8 tBTA_BLE_MULTI_ADV_EVT;
|
||||
|
||||
/* multi adv callback */
|
||||
typedef void (tBTA_BLE_MULTI_ADV_CBACK)(tBTA_BLE_MULTI_ADV_EVT event,
|
||||
UINT8 inst_id, void *p_ref, tBTA_STATUS status);
|
||||
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
|
||||
typedef UINT32 tBTA_DM_BLE_REF_VALUE;
|
||||
|
||||
#define BTA_DM_BLE_PF_ENABLE_EVT BTM_BLE_PF_ENABLE
|
||||
#define BTA_DM_BLE_PF_CONFIG_EVT BTM_BLE_PF_CONFIG
|
||||
typedef UINT8 tBTA_DM_BLE_PF_EVT;
|
||||
|
||||
#define BTA_DM_BLE_PF_ENABLE 1
|
||||
#define BTA_DM_BLE_PF_CONFIG 2
|
||||
typedef UINT8 tBTA_DM_BLE_PF_ACTION;
|
||||
|
||||
/* Config callback */
|
||||
typedef void (tBTA_DM_BLE_PF_CFG_CBACK) (tBTA_DM_BLE_PF_ACTION action,
|
||||
tBTA_DM_BLE_PF_COND_TYPE cfg_cond,
|
||||
tBTA_DM_BLE_PF_AVBL_SPACE avbl_space, tBTA_STATUS status,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
/* Param callback */
|
||||
typedef void (tBTA_DM_BLE_PF_PARAM_CBACK) (UINT8 action_type, tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value, tBTA_STATUS status);
|
||||
|
||||
/* Status callback */
|
||||
typedef void (tBTA_DM_BLE_PF_STATUS_CBACK) (UINT8 action, tBTA_STATUS status,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
|
||||
#define BTA_DM_BLE_PF_BRDCAST_ADDR_FILT 1
|
||||
#define BTA_DM_BLE_PF_SERV_DATA_CHG_FILT 2
|
||||
#define BTA_DM_BLE_PF_SERV_UUID 4
|
||||
#define BTA_DM_BLE_PF_SERV_SOLC_UUID 8
|
||||
#define BTA_DM_BLE_PF_LOC_NAME_CHECK 16
|
||||
#define BTA_DM_BLE_PF_MANUF_NAME_CHECK 32
|
||||
#define BTA_DM_BLE_PF_SERV_DATA_CHECK 64
|
||||
typedef UINT16 tBTA_DM_BLE_PF_FEAT_SEL;
|
||||
|
||||
#define BTA_DM_BLE_PF_LIST_LOGIC_OR 1
|
||||
#define BTA_DM_BLE_PF_LIST_LOGIC_AND 2
|
||||
typedef UINT16 tBTA_DM_BLE_PF_LIST_LOGIC_TYPE;
|
||||
|
||||
#define BTA_DM_BLE_PF_FILT_LOGIC_OR 0
|
||||
#define BTA_DM_BLE_PF_FILT_LOGIC_AND 1
|
||||
typedef UINT16 tBTA_DM_BLE_PF_FILT_LOGIC_TYPE;
|
||||
|
||||
typedef UINT8 tBTA_DM_BLE_PF_RSSI_THRESHOLD;
|
||||
typedef UINT8 tBTA_DM_BLE_PF_DELIVERY_MODE;
|
||||
typedef UINT16 tBTA_DM_BLE_PF_TIMEOUT;
|
||||
typedef UINT8 tBTA_DM_BLE_PF_TIMEOUT_CNT;
|
||||
typedef UINT16 tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES;
|
||||
|
||||
typedef struct {
|
||||
tBTA_DM_BLE_PF_FEAT_SEL feat_seln;
|
||||
tBTA_DM_BLE_PF_LIST_LOGIC_TYPE list_logic_type;
|
||||
tBTA_DM_BLE_PF_FILT_LOGIC_TYPE filt_logic_type;
|
||||
tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_high_thres;
|
||||
tBTA_DM_BLE_PF_RSSI_THRESHOLD rssi_low_thres;
|
||||
tBTA_DM_BLE_PF_DELIVERY_MODE dely_mode;
|
||||
tBTA_DM_BLE_PF_TIMEOUT found_timeout;
|
||||
tBTA_DM_BLE_PF_TIMEOUT lost_timeout;
|
||||
tBTA_DM_BLE_PF_TIMEOUT_CNT found_timeout_cnt;
|
||||
tBTA_DM_BLE_PF_ADV_TRACK_ENTRIES num_of_tracking_entries;
|
||||
} tBTA_DM_BLE_PF_FILT_PARAMS;
|
||||
|
||||
/* Search callback events */
|
||||
#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */
|
||||
#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */
|
||||
@@ -1228,6 +1106,71 @@ typedef struct {
|
||||
tBTA_DM_SEARCH *p_data; /* Union of all search callback structures */
|
||||
} tBTA_DM_SEARCH_PARAM;
|
||||
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
typedef struct {
|
||||
UINT16 conn_handle;
|
||||
UINT8 num_config_supported;
|
||||
UINT16 max_consecutive_proc_supported;
|
||||
UINT8 num_ant_supported;
|
||||
UINT8 max_ant_paths_supported;
|
||||
UINT8 roles_supported;
|
||||
UINT8 modes_supported;
|
||||
UINT8 rtt_capability;
|
||||
UINT8 rtt_aa_only_n;
|
||||
UINT8 rtt_sounding_n;
|
||||
UINT8 rtt_random_payload_n;
|
||||
UINT16 NADM_sounding_capability;
|
||||
UINT16 NADM_random_capability;
|
||||
UINT8 cs_sync_phys_supported;
|
||||
UINT16 subfeatures_supported;
|
||||
UINT16 T_IP1_times_supported;
|
||||
UINT16 T_IP2_times_supported;
|
||||
UINT16 T_FCS_times_supported;
|
||||
UINT16 T_PM_times_supported;
|
||||
UINT8 T_SW_times_supported;
|
||||
UINT8 TX_SNR_capability;
|
||||
} tBTA_DM_CS_WRITE_CACHED_REMOTE_SUPP_CAPS;
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_handle;
|
||||
UINT8 config_id;
|
||||
UINT8 create_context;
|
||||
UINT8 main_mode_type;
|
||||
UINT8 sub_mode_type;
|
||||
UINT8 min_main_mode_steps;
|
||||
UINT8 max_main_mode_steps;
|
||||
UINT8 main_mode_repetition;
|
||||
UINT8 mode_0_steps;
|
||||
UINT8 role;
|
||||
UINT8 rtt_type;
|
||||
UINT8 cs_sync_phy;
|
||||
UINT8 channel_map[10];
|
||||
UINT8 channel_map_repetition;
|
||||
UINT8 channel_selection_type;
|
||||
UINT8 ch3c_shape;
|
||||
UINT8 ch3c_jump;
|
||||
UINT8 reserved;
|
||||
} tBTA_DM_CS_CREATE_CONFIG_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_handle;
|
||||
UINT8 config_id;
|
||||
UINT16 max_procedure_len;
|
||||
UINT16 min_procedure_interval;
|
||||
UINT16 max_procedure_interval;
|
||||
UINT16 max_procedure_count;
|
||||
uint32_t min_subevent_len;
|
||||
uint32_t max_subevent_len;
|
||||
UINT8 tone_ant_config_selection;
|
||||
UINT8 phy;
|
||||
UINT8 tx_power_delta;
|
||||
UINT8 preferred_peer_antenna;
|
||||
UINT8 SNR_control_initiator;
|
||||
UINT8 SNR_control_reflector;
|
||||
} tBTA_DM_CS_SET_PROC_PARAMS;
|
||||
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
|
||||
/* Search callback */
|
||||
typedef void (tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
|
||||
|
||||
@@ -1245,11 +1188,6 @@ typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport,
|
||||
#define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM
|
||||
typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT;
|
||||
|
||||
typedef tBTM_BLE_TX_TIME_MS tBTA_DM_BLE_TX_TIME_MS;
|
||||
typedef tBTM_BLE_RX_TIME_MS tBTA_DM_BLE_RX_TIME_MS;
|
||||
typedef tBTM_BLE_IDLE_TIME_MS tBTA_DM_BLE_IDLE_TIME_MS;
|
||||
typedef tBTM_BLE_ENERGY_USED tBTA_DM_BLE_ENERGY_USED;
|
||||
|
||||
#define BTA_DM_CONTRL_UNKNOWN 0 /* Unknown state */
|
||||
#define BTA_DM_CONTRL_ACTIVE 1 /* ACL link on, SCO link ongoing, sniff mode */
|
||||
#define BTA_DM_CONTRL_SCAN 2 /* Scan state - paging/inquiry/trying to connect*/
|
||||
@@ -1261,9 +1199,6 @@ typedef UINT8 tBTA_DM_BLE_ADV_STATE;
|
||||
typedef UINT8 tBTA_DM_BLE_ADV_INFO_PRESENT;
|
||||
typedef UINT8 tBTA_DM_BLE_RSSI_VALUE;
|
||||
typedef UINT16 tBTA_DM_BLE_ADV_INFO_TIMESTAMP;
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
typedef tBTM_BLE_TRACK_ADV_DATA tBTA_DM_BLE_TRACK_ADV_DATA;
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
|
||||
typedef void (tBTA_BLE_SCAN_THRESHOLD_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
@@ -1271,33 +1206,12 @@ typedef void (tBTA_BLE_SCAN_REP_CBACK) (tBTA_DM_BLE_REF_VALUE ref_value, UINT8 r
|
||||
UINT8 num_records, UINT16 data_len,
|
||||
UINT8 *p_rep_data, tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_BLE_SCAN_SETUP_CBACK) (tBTA_BLE_BATCH_SCAN_EVT evt,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value,
|
||||
tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_START_STOP_SCAN_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_START_STOP_ADV_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_CLEAR_ADV_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
typedef void (tBTA_BLE_TRACK_ADV_CMPL_CBACK)(int action, tBTA_STATUS status,
|
||||
tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
typedef void (tBTA_BLE_TRACK_ADV_CBACK)(tBTA_DM_BLE_TRACK_ADV_DATA *p_adv_data);
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
typedef void (tBTA_BLE_ENERGY_INFO_CBACK)(tBTA_DM_BLE_TX_TIME_MS tx_time,
|
||||
tBTA_DM_BLE_RX_TIME_MS rx_time,
|
||||
tBTA_DM_BLE_IDLE_TIME_MS idle_time,
|
||||
tBTA_DM_BLE_ENERGY_USED energy_used,
|
||||
tBTA_DM_CONTRL_STATE ctrl_state,
|
||||
tBTA_STATUS status);
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
|
||||
#else
|
||||
typedef UINT8 tBTA_DM_BLE_SEC_ACT;
|
||||
#endif
|
||||
@@ -1573,6 +1487,10 @@ typedef struct {
|
||||
tBTA_DM_BLE_GAP_PHY secondary_phy;
|
||||
UINT8 sid;
|
||||
BOOLEAN scan_req_notif;
|
||||
#if (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
uint8_t primary_adv_phy_options;
|
||||
uint8_t secondary_adv_phy_options;
|
||||
#endif // (BT_BLE_FEAT_ADV_CODING_SELECTION == TRUE)
|
||||
} tBTA_DM_BLE_GAP_EXT_ADV_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
@@ -1584,7 +1502,14 @@ typedef struct {
|
||||
typedef struct {
|
||||
UINT16 interval_min;
|
||||
UINT16 interval_max;
|
||||
UINT8 properties;
|
||||
UINT16 properties;
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 num_subevents;
|
||||
UINT8 subevent_interval;
|
||||
UINT8 rsp_slot_delay;
|
||||
UINT8 rsp_slot_spacing;
|
||||
UINT8 num_rsp_slots;
|
||||
#endif // (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
} tBTA_DM_BLE_Periodic_Adv_Params;
|
||||
|
||||
typedef struct {
|
||||
@@ -1701,6 +1626,30 @@ typedef struct {
|
||||
#define BTA_BLE_GAP_SET_HOST_FEATURE_EVT BTM_BLE_GAP_SET_HOST_FEATURE_EVT
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
#define BTA_BLE_GAP_SET_PERIODIC_ADV_SUBEVT_DATA_EVT BTM_BLE_GAP_SET_PERIODIC_ADV_SUBEVT_DATA_EVT
|
||||
#define BTA_BLE_GAP_SET_PERIODIC_ADV_RESPONSE_DATA_EVT BTM_BLE_GAP_SET_PERIODIC_ADV_RESPONSE_DATA_EVT
|
||||
#define BTA_BLE_GAP_SET_PERIODIC_SYNC_SUBEVT_EVT BTM_BLE_GAP_SET_PERIODIC_SYNC_SUBEVT_EVT
|
||||
#define BTA_BLE_GAP_PERIODIC_ADV_SUBEVT_DATA_REQUEST_EVT BTM_BLE_GAP_PERIODIC_ADV_SUBEVT_DATA_REQUEST_EVT
|
||||
#define BTA_BLE_GAP_PERIODIC_ADV_RESPONSE_REPORT_EVT BTM_BLE_GAP_PERIODIC_ADV_RESPONSE_REPORT_EVT
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
#define BTA_BLE_GAP_CS_READ_LOCAL_SUPP_CAPS_EVT BTM_BLE_GAP_CS_READ_LOCAL_SUPP_CAPS_EVT
|
||||
#define BTA_BLE_GAP_CS_WRITE_CACHED_REMOTE_SUPP_CAPS_EVT BTM_BLE_GAP_CS_WRITE_CACHED_REMOTE_SUPP_CAPS_EVT
|
||||
#define BTA_BLE_GAP_CS_SET_DEFAULT_SETTINGS_EVT BTM_BLE_GAP_CS_SET_DEFAULT_SETTINGS_EVT
|
||||
#define BTA_BLE_GAP_CS_WRITE_CACHED_REMOTE_FAE_TAB_EVT BTM_BLE_GAP_CS_WRITE_CACHED_REMOTE_FAE_TAB_EVT
|
||||
#define BTA_BLE_GAP_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT BTM_BLE_GAP_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT
|
||||
#define BTA_BLE_GAP_CS_SET_CHANNEL_CLASS_CMPL_EVT BTM_BLE_GAP_CS_SET_CHANNEL_CLASS_CMPL_EVT
|
||||
#define BTA_BLE_GAP_CS_PROC_PARAMS_CMPL_EVT BTM_BLE_GAP_CS_PROC_PARAMS_CMPL_EVT
|
||||
#define BTA_BLE_GAP_CS_PROC_ENABLE_CMPL_EVT BTM_BLE_GAP_CS_PROC_ENABLE_CMPL_EVT
|
||||
#define BTA_BLE_GAP_CS_READ_REMOTE_FAE_TABLE_CMPL_EVT BTM_BLE_GAP_CS_READ_REMOTE_FAE_TABLE_CMPL_EVT
|
||||
#define BTA_BLE_GAP_CS_SECURITY_ENABLE_CMPL_EVT BTM_BLE_GAP_CS_SECURITY_ENABLE_CMPL_EVT
|
||||
#define BTA_BLE_GAP_CS_CONFIG_CMPL_EVT BTM_BLE_GAP_CS_CONFIG_CMPL_EVT
|
||||
#define BTA_BLE_GAP_CS_SUBEVENT_RESULT_EVT BTM_BLE_GAP_CS_SUBEVENT_RESULT_EVT
|
||||
#define BTA_BLE_GAP_CS_SUBEVENT_RESULT_CONTINUE_EVT BTM_BLE_GAP_CS_SUBEVENT_RESULT_CONTINUE_EVT
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
|
||||
#define BTA_DM_BLE_5_GAP_UNKNOWN_EVT BTM_BLE_5_GAP_UNKNOWN_EVT
|
||||
typedef tBTM_BLE_5_GAP_EVENT tBTA_DM_BLE_5_GAP_EVENT;
|
||||
|
||||
@@ -2798,9 +2747,6 @@ extern void BTA_DmBleScan(BOOLEAN start, UINT32 duration,
|
||||
tBTA_DM_SEARCH_CBACK *p_results_cb,
|
||||
tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb);
|
||||
|
||||
#if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
extern void BTA_DmBleStopAdvertising(void);
|
||||
#endif // #if (BLE_HOST_STOP_ADV_UNUSED == TRUE)
|
||||
|
||||
extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback);
|
||||
extern void BTA_DmClearRandAddress(void);
|
||||
@@ -2839,6 +2785,22 @@ extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable, tBTA_SET_LOCAL_P
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleConfigLocalIcon(uint16_t icon);
|
||||
|
||||
#if (BT_GATTS_KEY_MATERIAL_CHAR == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetKeyMaterial
|
||||
**
|
||||
** Description Set the Encrypted Data Key Material in GAP service
|
||||
**
|
||||
** Parameters: session_key - 16-byte session key
|
||||
** iv - 8-byte initialization vector
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleSetKeyMaterial(const uint8_t *session_key, const uint8_t *iv);
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleEnableRemotePrivacy
|
||||
@@ -2950,7 +2912,7 @@ extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleBroadcast
|
||||
** Function BTA_DmBleAdvStop
|
||||
**
|
||||
** Description This function starts or stops LE broadcasting.
|
||||
**
|
||||
@@ -2960,68 +2922,7 @@ extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p_start_stop_adv_cb);
|
||||
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_BleEnableAdvInstance
|
||||
**
|
||||
** Description This function enables the Multi ADV instance feature
|
||||
**
|
||||
** Parameters p_params Pointer to ADV param user defined structure
|
||||
** p_cback Pointer to Multi ADV callback structure
|
||||
** p_ref - Reference pointer
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
|
||||
tBTA_BLE_MULTI_ADV_CBACK *p_cback, void *p_ref);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_BleUpdateAdvInstParam
|
||||
**
|
||||
** Description This function updates the Multi ADV instance params
|
||||
**
|
||||
** Parameters inst_id Instance ID
|
||||
** p_params Pointer to ADV param user defined structure
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_BleUpdateAdvInstParam (UINT8 inst_id,
|
||||
tBTA_BLE_ADV_PARAMS *p_params);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_BleCfgAdvInstData
|
||||
**
|
||||
** Description This function is called to configure the ADV instance data
|
||||
**
|
||||
** Parameters inst_id - Instance ID
|
||||
** is_scan_rsp - Boolean value Scan response
|
||||
** Pointer to User defined ADV data structure
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
|
||||
tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_BleDisableAdvInstance
|
||||
**
|
||||
** Description This function is called to disable the ADV instance
|
||||
**
|
||||
** Parameters inst_id - Instance ID to be disabled
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_BleDisableAdvInstance(UINT8 inst_id);
|
||||
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
extern void BTA_DmBleAdvStop (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p_start_stop_adv_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -3094,177 +2995,27 @@ void BTA_DmBleGapSubrateReqest(uint16_t conn_handle, uint16_t subrate_min, uint1
|
||||
extern void BTA_DmBleGapSetHostFeature(uint16_t bit_num, uint8_t bit_val);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetStorageParams
|
||||
**
|
||||
** Description This function is called to set the storage parameters
|
||||
**
|
||||
** Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning
|
||||
** batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning
|
||||
** batch_scan_notify_threshold - Setup notification level based on total space
|
||||
** consumed by both pools. Setting it to 0 will disable threshold notification
|
||||
** p_setup_cback - Setup callback
|
||||
** p_thres_cback - Threshold callback
|
||||
** p_rep_cback - Reports callback
|
||||
** ref_value - Reference value
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max,
|
||||
UINT8 batch_scan_trunc_max,
|
||||
UINT8 batch_scan_notify_threshold,
|
||||
tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback,
|
||||
tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback,
|
||||
tBTA_BLE_SCAN_REP_CBACK *p_rep_cback,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
void BTA_DmBleGapSetPASubevtData(uint8_t adv_handle, uint8_t num_subevents_with_data, uint8_t *subevent_params);
|
||||
void BTA_DmBleGapSetPeriodicAdvRspData(uint16_t sync_handle, uint16_t request_event, uint8_t request_subevent,
|
||||
uint8_t rsp_subevent, uint8_t rsp_slot, uint8_t rsp_data_len, uint8_t *rsp_data);
|
||||
void BTA_DmBleGapSetPeriodicSyncSubevt(uint16_t sync_handle, uint16_t periodic_adv_properties, uint8_t num_subevents_to_sync, uint8_t *subevent);
|
||||
#endif// (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleEnableBatchScan
|
||||
**
|
||||
** Description This function is called to enable the batch scan
|
||||
**
|
||||
** Parameters scan_mode -Batch scan mode
|
||||
** scan_interval - Scan interval
|
||||
** scan_window - Scan window
|
||||
** discard_rule -Discard rules
|
||||
** addr_type - Address type
|
||||
** ref_value - Reference value
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleEnableBatchScan(tBTA_BLE_BATCH_SCAN_MODE scan_mode,
|
||||
UINT32 scan_interval, UINT32 scan_window,
|
||||
tBTA_BLE_DISCARD_RULE discard_rule,
|
||||
tBLE_ADDR_TYPE addr_type,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleReadScanReports
|
||||
**
|
||||
** Description This function is called to read the batch scan reports
|
||||
**
|
||||
** Parameters scan_mode -Batch scan mode
|
||||
** ref_value - Reference value
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleDisableBatchScan
|
||||
**
|
||||
** Description This function is called to disable the batch scanning
|
||||
**
|
||||
** Parameters ref_value - Reference value
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmEnableScanFilter
|
||||
**
|
||||
** Description This function is called to enable the adv data payload filter
|
||||
**
|
||||
** Parameters action - enable or disable the APCF feature
|
||||
** p_cmpl_cback - Command completed callback
|
||||
** ref_value - Reference value
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmEnableScanFilter(UINT8 action,
|
||||
tBTA_DM_BLE_PF_STATUS_CBACK *p_cmpl_cback,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleScanFilterSetup
|
||||
**
|
||||
** Description This function is called to setup the filter params
|
||||
**
|
||||
** Parameters p_target: enable the filter condition on a target device; if NULL
|
||||
** filt_index - Filter index
|
||||
** p_filt_params -Filter parameters
|
||||
** ref_value - Reference value
|
||||
** action - Add, delete or clear
|
||||
** p_cmpl_back - Command completed callback
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleScanFilterSetup(UINT8 action,
|
||||
tBTA_DM_BLE_PF_FILT_INDEX filt_index,
|
||||
tBTA_DM_BLE_PF_FILT_PARAMS *p_filt_params,
|
||||
tBLE_BD_ADDR *p_target,
|
||||
tBTA_DM_BLE_PF_PARAM_CBACK *p_cmpl_cback,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleCfgFilterCondition
|
||||
**
|
||||
** Description This function is called to configure the adv data payload filter
|
||||
** condition.
|
||||
**
|
||||
** Parameters action: to read/write/clear
|
||||
** cond_type: filter condition type
|
||||
** filt_index - Filter index
|
||||
** p_cond: filter condition parameter
|
||||
** p_cmpl_back - Command completed callback
|
||||
** ref_value - Reference value
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleCfgFilterCondition(tBTA_DM_BLE_SCAN_COND_OP action,
|
||||
tBTA_DM_BLE_PF_COND_TYPE cond_type,
|
||||
tBTA_DM_BLE_PF_FILT_INDEX filt_index,
|
||||
tBTA_DM_BLE_PF_COND_PARAM *p_cond,
|
||||
tBTA_DM_BLE_PF_CFG_CBACK *p_cmpl_cback,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
|
||||
#if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleTrackAdvertiser
|
||||
**
|
||||
** Description This function is called to track the advertiser
|
||||
**
|
||||
** Parameters ref_value - Reference value
|
||||
** p_track_adv_cback - ADV callback
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value,
|
||||
tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback);
|
||||
#endif // #if (BLE_HOST_TRACK_ADVERTISER_EN == TRUE)
|
||||
|
||||
#if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleGetEnergyInfo
|
||||
**
|
||||
** Description This function is called to obtain the energy info
|
||||
**
|
||||
** Parameters p_cmpl_cback - Command complete callback
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK *p_cmpl_cback);
|
||||
#endif // #if (BLE_HOST_ENERGY_INFO_EN == TRUE)
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
void BTA_DmBleGapReadLocalSupportedCaps(void);
|
||||
void BTA_DmBleGapReadRemoteSupportedCaps(uint16_t conn_handle);
|
||||
void BTA_DmBleGapWriteCachedRemoteSupportedCaps(tBTA_DM_CS_WRITE_CACHED_REMOTE_SUPP_CAPS *write_cachedremote_supp_caps);
|
||||
void BTA_DmBleGapCsSecurityEnable(uint16_t conn_handle);
|
||||
void BTA_DmBleGapCsSetDefaultSetting(uint16_t conn_handle, uint8_t role_enable, uint8_t cs_sync_ant_selection, int8_t max_tx_power);
|
||||
void BTA_DmBleGapCsReadRemoteFaeTable(uint16_t conn_handle);
|
||||
void BTA_DmBleGapWriteCachedRemoteFaeTable(uint16_t conn_handle, uint8_t *remote_fae_table, uint8_t table_len);
|
||||
void BTA_DmBleGapCsCreateConfig(tBTA_DM_CS_CREATE_CONFIG_PARAMS *create_config_params);
|
||||
void BTA_DmBleGapCsRemoveConfig(uint16_t conn_handle, uint8_t config_id);
|
||||
void BTA_DmBleGapCsSetChannelClass(uint8_t *channel_class, uint8_t channl_len);
|
||||
void BTA_DmBleGapCsSetProcPatams(tBTA_DM_CS_SET_PROC_PARAMS *set_proc_params);
|
||||
void BTA_DmBleGapCsProcEnable(uint16_t conn_handle, uint8_t config_id, uint8_t enable);
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -3277,17 +3028,6 @@ extern void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK *p_cmpl_cback);
|
||||
*******************************************************************************/
|
||||
extern void BTA_VendorInit (void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_BrcmCleanup
|
||||
**
|
||||
** Description This function frees up Broadcom specific VS specific dynamic memory
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_VendorCleanup (void);
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void BTA_DmBleGapReadPHY(BD_ADDR addr);
|
||||
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if (APPL_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG)
|
||||
#ifndef BTA_GATT_DEBUG
|
||||
#define BTA_GATT_DEBUG FALSE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
BTGATT_DB_PRIMARY_SERVICE,
|
||||
@@ -817,6 +819,7 @@ extern void BTA_GATTC_AppDeregister (tBTA_GATTC_IF client_if);
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_Enh_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_ADDR_TYPE remote_addr_type,
|
||||
BOOLEAN is_direct, tBTA_GATT_TRANSPORT transport, BOOLEAN is_aux, tBTA_ADDR_TYPE own_addr_type,
|
||||
BOOLEAN is_pawr_synced, UINT8 adv_handle, UINT8 subevent,
|
||||
UINT8 phy_mask, tBTA_BLE_CONN_PARAMS *phy_1m_conn_params, tBTA_BLE_CONN_PARAMS *phy_2m_conn_params,
|
||||
tBTA_BLE_CONN_PARAMS *phy_coded_conn_params);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef void (tBTA_SYS_DISABLE)(void);
|
||||
/* HW modules */
|
||||
enum {
|
||||
BTA_SYS_HW_BLUETOOTH,
|
||||
BTA_SYS_HW_RT,
|
||||
// BTA_SYS_HW_RT,
|
||||
|
||||
BTA_SYS_MAX_HW_MODULES
|
||||
};
|
||||
|
||||
@@ -2923,7 +2923,7 @@ void bta_jv_l2cap_connect_le(tBTA_JV_MSG *p_data)
|
||||
id = t->id;
|
||||
t->init_called = FALSE;
|
||||
|
||||
if (L2CA_ConnectFixedChnl(t->chan, t->remote_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE)) {
|
||||
if (L2CA_ConnectFixedChnl(t->chan, t->remote_addr, BLE_ADDR_UNKNOWN_TYPE, FALSE, FALSE, 0xFF, 0xFF)) {
|
||||
|
||||
evt.l2c_cl_init.status = BTA_JV_SUCCESS;
|
||||
evt.l2c_cl_init.handle = id;
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "bta_sys_int.h"
|
||||
#include "bta/utl.h"
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_sys_rm_register
|
||||
@@ -661,3 +663,5 @@ BOOLEAN bta_sys_vs_hdl(UINT16 evt, void *p)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
@@ -543,7 +543,7 @@ void bta_sys_deregister(UINT8 id)
|
||||
**
|
||||
** Function bta_sys_is_register
|
||||
**
|
||||
** Description Called by other BTA subsystems to get registeration
|
||||
** Description Called by other BTA subsystems to get registration
|
||||
** status.
|
||||
**
|
||||
**
|
||||
@@ -724,7 +724,7 @@ void bta_sys_disable(tBTA_SYS_HW_MODULE module)
|
||||
bta_id_max = BTA_ID_BLUETOOTH_MAX;
|
||||
break;
|
||||
default:
|
||||
APPL_TRACE_WARNING("bta_sys_disable: unkown module");
|
||||
APPL_TRACE_WARNING("bta_sys_disable: unknown module");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ void bta_sys_set_trace_level(UINT8 level)
|
||||
{
|
||||
appl_trace_level = level;
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_sys_get_sys_features
|
||||
@@ -764,3 +764,4 @@ UINT16 bta_sys_get_sys_features (void)
|
||||
{
|
||||
return bta_sys_cb.sys_features;
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user