Merge remote-tracking branch 'upstream/release/v3.2'
This commit is contained in:
commit
40f01ec30a
427
.gitlab-ci.yml
427
.gitlab-ci.yml
|
@ -2,10 +2,10 @@ stages:
|
|||
- build
|
||||
- assign_test
|
||||
- host_test
|
||||
- unit_test
|
||||
- integration_test
|
||||
- target_test
|
||||
- check
|
||||
- deploy
|
||||
- post_check
|
||||
|
||||
variables:
|
||||
# System environment
|
||||
|
@ -19,11 +19,12 @@ variables:
|
|||
GET_SOURCES_ATTEMPTS: "10"
|
||||
ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
|
||||
|
||||
# We use get_sources.sh script to fetch the submodules and/or re-fetch the repo
|
||||
# We use get-full-sources.sh script to fetch the submodules and/or re-fetch the repo
|
||||
# if it was corrupted (if submodule update fails this can happen)
|
||||
GIT_STRATEGY: fetch
|
||||
GIT_SUBMODULE_STRATEGY: none
|
||||
|
||||
UNIT_TEST_BUILD_SYSTEM: make
|
||||
# IDF environment
|
||||
|
||||
IDF_PATH: "$CI_PROJECT_DIR"
|
||||
|
@ -53,6 +54,7 @@ variables:
|
|||
python $APPLY_BOT_FILTER_SCRIPT || exit 0
|
||||
|
||||
before_script:
|
||||
- source tools/ci/setup_python.sh
|
||||
- *git_clean_stale_submodules
|
||||
# apply bot filter in before script
|
||||
- *apply_bot_filter
|
||||
|
@ -75,11 +77,13 @@ before_script:
|
|||
# used for check scripts which we want to run unconditionally
|
||||
.do_nothing_before_no_filter:
|
||||
before_script: &do_nothing_before_no_filter
|
||||
- source tools/ci/setup_python.sh
|
||||
- *git_clean_stale_submodules
|
||||
|
||||
# used for everything else where we want to do no prep, except for bot filter
|
||||
.do_nothing_before:
|
||||
before_script: &do_nothing_before
|
||||
- source tools/ci/setup_python.sh
|
||||
- *git_clean_stale_submodules
|
||||
# apply bot filter in before script
|
||||
- *apply_bot_filter
|
||||
|
@ -88,6 +92,7 @@ before_script:
|
|||
|
||||
.add_gitlab_key_before:
|
||||
before_script: &add_gitlab_key_before
|
||||
- source tools/ci/setup_python.sh
|
||||
- *git_clean_stale_submodules
|
||||
# apply bot filter in before script
|
||||
- *apply_bot_filter
|
||||
|
@ -108,14 +113,21 @@ build_template_app:
|
|||
- build
|
||||
variables:
|
||||
BATCH_BUILD: "1"
|
||||
IDF_CI_BUILD: "1"
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
script:
|
||||
- git clone https://github.com/espressif/esp-idf-template.git
|
||||
# Set the variable for 'esp-idf-template' testing
|
||||
- ESP_IDF_TEMPLATE_GIT=${ESP_IDF_TEMPLATE_GIT:-"https://github.com/espressif/esp-idf-template.git"}
|
||||
- git clone ${ESP_IDF_TEMPLATE_GIT}
|
||||
- cd esp-idf-template
|
||||
# Try to use the same branch name for esp-idf-template that we're
|
||||
# using on esp-idf. If it doesn't exist then just stick to the default
|
||||
# branch
|
||||
- python $CHECKOUT_REF_SCRIPT esp-idf-template
|
||||
- make defconfig
|
||||
# Test debug build (default)
|
||||
- make all V=1
|
||||
# Now test release build
|
||||
|
@ -145,6 +157,12 @@ build_template_app:
|
|||
expire_in: 1 week
|
||||
variables:
|
||||
SSC_CONFIG_FOLDER: "$CI_PROJECT_DIR/SSC/configs/ESP32_IDF"
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD
|
||||
- $BOT_LABEL_INTEGRATION_TEST
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
script:
|
||||
- git clone $SSC_REPOSITORY
|
||||
- cd SSC
|
||||
|
@ -163,30 +181,65 @@ build_ssc_02:
|
|||
|
||||
# If you want to add new build ssc jobs, please add it into dependencies of `assign_test` and `.test_template`
|
||||
|
||||
build_esp_idf_tests:
|
||||
|
||||
.build_esp_idf_unit_test_template: &build_esp_idf_unit_test_template
|
||||
<<: *build_template
|
||||
artifacts:
|
||||
paths:
|
||||
- tools/unit-test-app/output
|
||||
- components/idf_test/unit_test/TestCaseAll.yml
|
||||
- components/idf_test/unit_test/CIConfigs/*.yml
|
||||
expire_in: 2 days
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD
|
||||
- $BOT_LABEL_UNIT_TEST
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
|
||||
build_esp_idf_tests_make:
|
||||
<<: *build_esp_idf_unit_test_template
|
||||
script:
|
||||
- cd tools/unit-test-app
|
||||
- MAKEFLAGS= make help # make sure kconfig tools are built in single process
|
||||
- make ut-clean-all-configs
|
||||
- export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
|
||||
- export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||
- cd $CI_PROJECT_DIR/tools/unit-test-app
|
||||
- MAKEFLAGS= make help # make sure kconfig tools are built in single process
|
||||
- make ut-clean-all-configs
|
||||
- make ut-build-all-configs
|
||||
- python tools/UnitTestParser.py
|
||||
- if [ "$UNIT_TEST_BUILD_SYSTEM" == "make" ]; then exit 0; fi
|
||||
# If Make, delete the CMake built artifacts
|
||||
- rm -rf builds output sdkconfig
|
||||
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/TestCaseAll.yml
|
||||
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/*.yml
|
||||
|
||||
build_esp_idf_tests_cmake:
|
||||
<<: *build_esp_idf_unit_test_template
|
||||
script:
|
||||
- export PATH="$IDF_PATH/tools:$PATH"
|
||||
- export EXTRA_CFLAGS="-Werror -Werror=deprecated-declarations"
|
||||
- export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||
- cd $CI_PROJECT_DIR/tools/unit-test-app
|
||||
# Build with CMake first
|
||||
- idf.py ut-clean-all-configs
|
||||
- idf.py ut-build-all-configs
|
||||
- python tools/UnitTestParser.py
|
||||
# Check if test demands CMake or Make built binaries. If CMake leave the built artifacts as is then exit.
|
||||
- if [ "$UNIT_TEST_BUILD_SYSTEM" == "cmake" ]; then exit 0; fi
|
||||
# If Make, delete the CMake built artifacts
|
||||
- rm -rf builds output sdkconfig
|
||||
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/TestCaseAll.yml
|
||||
- rm -rf $CI_PROJECT_DIR/components/idf_test/unit_test/CIConfigs/*.yml
|
||||
|
||||
.build_examples_make_template: &build_examples_make_template
|
||||
<<: *build_template
|
||||
# This is a workaround for a rarely encountered issue with building examples in CI.
|
||||
# Probably related to building of Kconfig in 'make clean' stage
|
||||
retry: 1
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- build_examples/*/*/*/build/*.bin
|
||||
- build_examples/*/*/*/sdkconfig
|
||||
- build_examples/*/*/*/build/*.elf
|
||||
- build_examples/*/*/*/build/*.map
|
||||
- build_examples/*/*/*/build/download.config
|
||||
|
@ -194,8 +247,13 @@ build_esp_idf_tests:
|
|||
- $LOG_PATH
|
||||
expire_in: 2 days
|
||||
variables:
|
||||
IDF_CI_BUILD: "1"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/log_examples_make"
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD
|
||||
- $BOT_LABEL_EXAMPLE_TEST
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
script:
|
||||
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
||||
# mechanism work, but this is the next best thing
|
||||
|
@ -209,11 +267,11 @@ build_esp_idf_tests:
|
|||
# same as above, but for CMake
|
||||
.build_examples_cmake_template: &build_examples_cmake_template
|
||||
<<: *build_template
|
||||
retry: 1
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- build_examples_cmake/*/*/*/build/*.bin
|
||||
- build_examples_cmake/*/*/*/sdkconfig
|
||||
- build_examples_cmake/*/*/*/build/*.elf
|
||||
- build_examples_cmake/*/*/*/build/*.map
|
||||
- build_examples_cmake/*/*/*/build/download.config
|
||||
|
@ -221,8 +279,13 @@ build_esp_idf_tests:
|
|||
- $LOG_PATH
|
||||
expire_in: 2 days
|
||||
variables:
|
||||
IDF_CI_BUILD: "1"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/log_examples_cmake"
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD
|
||||
- $BOT_LABEL_EXAMPLE_TEST
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
script:
|
||||
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
||||
# mechanism work, but this is the next best thing
|
||||
|
@ -303,21 +366,40 @@ build_docs:
|
|||
- docs/zh_CN/sphinx-warning-log-sanitized.txt
|
||||
- docs/zh_CN/_build/html
|
||||
expire_in: 1 day
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD
|
||||
- $BOT_LABEL_BUILD_DOCS
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
script:
|
||||
- cd docs
|
||||
- ./check_lang_folder_sync.sh
|
||||
- cd en
|
||||
- make gh-linkcheck
|
||||
- make html || cat /tmp/sphinx-err*.log
|
||||
- make html
|
||||
- ../check_doc_warnings.sh
|
||||
- cd ../zh_CN
|
||||
- make gh-linkcheck
|
||||
- make html
|
||||
- ../check_doc_warnings.sh
|
||||
|
||||
verify_cmake_style:
|
||||
stage: build
|
||||
.check_job_template: &check_job_template
|
||||
stage: check
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
||||
tags:
|
||||
- host_test
|
||||
dependencies: []
|
||||
before_script: *do_nothing_before_no_filter
|
||||
|
||||
verify_cmake_style:
|
||||
<<: *check_job_template
|
||||
stage: build
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
script:
|
||||
tools/cmake/run_cmake_lint.sh
|
||||
|
||||
|
@ -327,6 +409,11 @@ verify_cmake_style:
|
|||
tags:
|
||||
- host_test
|
||||
dependencies: []
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_HOST_TEST
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
|
||||
test_nvs_on_host:
|
||||
<<: *host_test_template
|
||||
|
@ -341,10 +428,10 @@ test_nvs_coverage:
|
|||
- components/nvs_flash/test_nvs_host/coverage_report
|
||||
expire_in: 1 week
|
||||
only:
|
||||
- triggers
|
||||
# This job takes a few hours to finish, so only run it on demand
|
||||
variables:
|
||||
BOT_NEEDS_TRIGGER_BY_NAME: 1
|
||||
refs:
|
||||
- triggers
|
||||
variables:
|
||||
- $BOT_LABEL_NVS_COVERAGE
|
||||
script:
|
||||
- cd components/nvs_flash/test_nvs_host
|
||||
- make coverage_report
|
||||
|
@ -386,8 +473,11 @@ test_fatfs_on_host:
|
|||
- ${FUZZER_TEST_DIR}/fuzz_output.log
|
||||
expire_in: 1 week
|
||||
only:
|
||||
# can only be triggered
|
||||
- triggers
|
||||
refs:
|
||||
# can only be triggered
|
||||
- triggers
|
||||
variables:
|
||||
- $BOT_LABEL_FUZZER_TEST
|
||||
script:
|
||||
- export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 && export AFL_SKIP_CPUFREQ=1
|
||||
- cd ${FUZZER_TEST_DIR}
|
||||
|
@ -533,15 +623,19 @@ push_to_github:
|
|||
- tools/ci/push_to_github.sh
|
||||
|
||||
deploy_docs:
|
||||
stage: host_test
|
||||
stage: deploy
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
||||
tags:
|
||||
- deploy
|
||||
only:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- triggers
|
||||
refs:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- triggers
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD_DOCS
|
||||
dependencies:
|
||||
- build_docs
|
||||
before_script: *do_nothing_before
|
||||
|
@ -573,8 +667,12 @@ check_doc_links:
|
|||
tags:
|
||||
- check_doc_links
|
||||
only:
|
||||
# can only be triggered
|
||||
- triggers
|
||||
refs:
|
||||
# can only be triggered
|
||||
- triggers
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_BUILD_DOCS
|
||||
artifacts:
|
||||
paths:
|
||||
- docs/_build/linkcheck
|
||||
|
@ -587,14 +685,6 @@ check_doc_links:
|
|||
- cd docs
|
||||
- make linkcheck
|
||||
|
||||
.check_job_template: &check_job_template
|
||||
stage: check
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
||||
tags:
|
||||
- build
|
||||
dependencies: []
|
||||
before_script: *do_nothing_before_no_filter
|
||||
|
||||
check_line_endings:
|
||||
<<: *check_job_template
|
||||
script:
|
||||
|
@ -623,10 +713,27 @@ check_examples_cmake_make:
|
|||
script:
|
||||
- tools/ci/check_examples_cmake_make.sh
|
||||
|
||||
check_ut_cmake_make:
|
||||
stage: check
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
||||
tags:
|
||||
- build
|
||||
except:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
dependencies: []
|
||||
before_script: *do_nothing_before
|
||||
script:
|
||||
- tools/ci/check_ut_cmake_make.sh
|
||||
|
||||
check_submodule_sync:
|
||||
<<: *check_job_template
|
||||
tags:
|
||||
- github_sync
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
retry: 2
|
||||
script:
|
||||
# check if all submodules are correctly synced to public repostory
|
||||
- git submodule update --init --recursive
|
||||
|
@ -637,6 +744,17 @@ check_artifacts_expire_time:
|
|||
# check if we have set expire time for all artifacts
|
||||
- python tools/ci/check_artifacts_expire_time.py
|
||||
|
||||
check_pipeline_triggered_by_label:
|
||||
<<: *check_job_template
|
||||
stage: post_check
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL
|
||||
script:
|
||||
# If the pipeline is triggered with label, the pipeline will only succeeded if "regular_test" label is added.
|
||||
# We want to make sure some jobs are always executed to detect regression.
|
||||
- test "$BOT_LABEL_REGULAR_TEST" = "true" || exit -1
|
||||
|
||||
assign_test:
|
||||
tags:
|
||||
- assign_test
|
||||
|
@ -648,7 +766,8 @@ assign_test:
|
|||
- build_ssc_00
|
||||
- build_ssc_01
|
||||
- build_ssc_02
|
||||
- build_esp_idf_tests
|
||||
- build_esp_idf_tests_make
|
||||
- build_esp_idf_tests_cmake
|
||||
variables:
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
|
||||
|
@ -658,6 +777,12 @@ assign_test:
|
|||
- components/idf_test/*/TC.sqlite
|
||||
- $EXAMPLE_CONFIG_OUTPUT_PATH
|
||||
expire_in: 1 week
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_UNIT_TEST
|
||||
- $BOT_LABEL_INTEGRATION_TEST
|
||||
- $BOT_LABEL_EXAMPLE_TEST
|
||||
before_script: *add_gitlab_key_before
|
||||
script:
|
||||
# assign example tests
|
||||
|
@ -672,14 +797,18 @@ assign_test:
|
|||
- python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
|
||||
|
||||
.example_test_template: &example_test_template
|
||||
stage: integration_test
|
||||
stage: target_test
|
||||
when: on_success
|
||||
only:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- triggers
|
||||
- schedules
|
||||
refs:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- triggers
|
||||
- schedules
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_EXAMPLE_TEST
|
||||
dependencies:
|
||||
- assign_test
|
||||
- build_examples_make_00
|
||||
|
@ -703,6 +832,8 @@ assign_test:
|
|||
paths:
|
||||
- $LOG_PATH
|
||||
expire_in: 1 week
|
||||
reports:
|
||||
junit: $LOG_PATH/*/XUNIT_RESULT.xml
|
||||
variables:
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
|
||||
|
@ -722,10 +853,21 @@ assign_test:
|
|||
|
||||
.unit_test_template: &unit_test_template
|
||||
<<: *example_test_template
|
||||
stage: unit_test
|
||||
stage: target_test
|
||||
dependencies:
|
||||
- assign_test
|
||||
- build_esp_idf_tests
|
||||
- build_esp_idf_tests_make
|
||||
- build_esp_idf_tests_cmake
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- triggers
|
||||
- schedules
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_UNIT_TEST
|
||||
variables:
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
|
||||
|
@ -734,14 +876,18 @@ assign_test:
|
|||
ENV_FILE: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/EnvConfig.yml"
|
||||
|
||||
.test_template: &test_template
|
||||
stage: integration_test
|
||||
stage: target_test
|
||||
when: on_success
|
||||
only:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- triggers
|
||||
- schedules
|
||||
refs:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- triggers
|
||||
- schedules
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
- $BOT_LABEL_INTEGRATION_TEST
|
||||
dependencies:
|
||||
- assign_test
|
||||
- build_ssc_00
|
||||
|
@ -804,14 +950,20 @@ example_test_001_01:
|
|||
- ESP32
|
||||
- Example_WIFI
|
||||
|
||||
example_test_001_02:
|
||||
<<: *example_test_template
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_WIFI
|
||||
|
||||
example_test_002_01:
|
||||
<<: *example_test_template
|
||||
image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_ShieldBox
|
||||
- Example_ShieldBox_Basic
|
||||
|
||||
example_test_003_01:
|
||||
.example_test_003_01:
|
||||
<<: *example_test_template
|
||||
tags:
|
||||
- ESP32
|
||||
|
@ -829,6 +981,16 @@ example_test_005_01:
|
|||
- ESP32
|
||||
- Example_WIFI_BT
|
||||
|
||||
example_test_006_01:
|
||||
<<: *example_test_template
|
||||
image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
|
||||
only:
|
||||
variables:
|
||||
- $BOT_LABEL_IPERF_STRESS_TEST
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_ShieldBox
|
||||
|
||||
UT_001_01:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
|
@ -1044,7 +1206,37 @@ UT_001_36:
|
|||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
|
||||
|
||||
UT_001_37:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
|
||||
UT_001_38:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
|
||||
UT_001_39:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
|
||||
UT_001_40:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
|
||||
UT_001_41:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
|
||||
UT_002_01:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
|
@ -1357,6 +1549,45 @@ UT_012_03:
|
|||
- UT_T1_1
|
||||
- 8Mpsram
|
||||
|
||||
UT_012_04:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
- 8Mpsram
|
||||
|
||||
UT_017_01:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T2_1
|
||||
|
||||
UT_017_02:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T2_1
|
||||
|
||||
UT_017_03:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T2_1
|
||||
|
||||
UT_017_04:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T2_1
|
||||
- psram
|
||||
|
||||
UT_017_05:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T2_1
|
||||
- 8Mpsram
|
||||
|
||||
UT_601_01:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
|
@ -1513,6 +1744,18 @@ IT_006_05:
|
|||
- ESP32_IDF
|
||||
- SSC_T1_6
|
||||
|
||||
IT_006_06:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_6
|
||||
|
||||
IT_006_07:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_6
|
||||
|
||||
IT_007_01:
|
||||
<<: *test_template
|
||||
tags:
|
||||
|
@ -1525,6 +1768,12 @@ IT_007_02:
|
|||
- ESP32_IDF
|
||||
- SSC_T1_7
|
||||
|
||||
IT_007_03:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_7
|
||||
|
||||
IT_008_01:
|
||||
<<: *test_template
|
||||
tags:
|
||||
|
@ -1543,11 +1792,71 @@ IT_010_01:
|
|||
- ESP32_IDF
|
||||
- SSC_T5_1
|
||||
|
||||
IT_010_02:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T5_1
|
||||
|
||||
IT_010_03:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T5_1
|
||||
|
||||
IT_010_04:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T5_1
|
||||
|
||||
IT_011_01:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T50_1
|
||||
- SSC_T1_MESH1
|
||||
|
||||
IT_011_02:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_MESH1
|
||||
|
||||
IT_011_03:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_MESH1
|
||||
|
||||
IT_011_04:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T3_MESH1
|
||||
|
||||
IT_011_05:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T6_MESH1
|
||||
|
||||
IT_011_06:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T12_MESH1
|
||||
|
||||
IT_011_07:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T50_MESH1
|
||||
|
||||
IT_011_08:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_MESH2
|
||||
|
||||
IT_012_01:
|
||||
<<: *test_template
|
||||
|
@ -1555,6 +1864,12 @@ IT_012_01:
|
|||
- ESP32_IDF
|
||||
- SSC_T1_9
|
||||
|
||||
IT_012_02:
|
||||
<<: *test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_9
|
||||
|
||||
IT_013_01:
|
||||
<<: *test_template
|
||||
tags:
|
||||
|
|
22
.readthedocs.yml
Normal file
22
.readthedocs.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
# .readthedocs.yml
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Optionally build your docs in additional formats such as PDF and ePub
|
||||
formats:
|
||||
- htmlzip
|
||||
- pdf
|
||||
|
||||
# Optionally set the version of Python and requirements required to build your docs
|
||||
python:
|
||||
version: 2.7
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
|
||||
# We need to list all the submodules included in documenation build by Doxygen
|
||||
submodules:
|
||||
include:
|
||||
- components/mqtt/esp-mqtt
|
6
components/app_trace/test/CMakeLists.txt
Normal file
6
components/app_trace/test/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
set(COMPONENT_SRCDIRS ".")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
set(COMPONENT_REQUIRES unity)
|
||||
|
||||
register_component()
|
|
@ -145,8 +145,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
|||
if (it->handle == handle) {
|
||||
// must erase the partition before writing to it
|
||||
assert(it->erased_size > 0 && "must erase the partition before writing to it");
|
||||
|
||||
if(it->wrote_size == 0 && size > 0 && data_bytes[0] != 0xE9) {
|
||||
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
|
||||
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
|
||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
}
|
||||
|
|
6
components/app_update/test/CMakeLists.txt
Normal file
6
components/app_update/test/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
set(COMPONENT_SRCDIRS ".")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
set(COMPONENT_REQUIRES unity app_update bootloader_support nvs_flash)
|
||||
|
||||
register_component()
|
|
@ -15,9 +15,10 @@ set(bootloader_binary_files
|
|||
|
||||
externalproject_add(bootloader
|
||||
# TODO: support overriding the bootloader in COMPONENT_PATHS
|
||||
SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
|
||||
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/subproject"
|
||||
BINARY_DIR "${bootloader_build_dir}"
|
||||
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH}
|
||||
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH}
|
||||
-DEXTRA_COMPONENT_DIRS=${CMAKE_CURRENT_LIST_DIR}
|
||||
INSTALL_COMMAND ""
|
||||
BUILD_ALWAYS 1 # no easy way around this...
|
||||
BUILD_BYPRODUCTS ${bootloader_binary_files}
|
||||
|
|
|
@ -35,7 +35,6 @@ SECTIONS
|
|||
.iram_loader.text :
|
||||
{
|
||||
. = ALIGN (16);
|
||||
_stext = .;
|
||||
_loader_text_start = ABSOLUTE(.);
|
||||
*(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
|
||||
*(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
|
||||
|
@ -59,7 +58,6 @@ SECTIONS
|
|||
*(.fini)
|
||||
*(.gnu.version)
|
||||
_loader_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} > iram_loader_seg
|
||||
|
||||
.iram.text :
|
||||
|
|
|
@ -91,3 +91,8 @@ bool bootloader_common_label_search(const char *list, char *label);
|
|||
* - ESP_FAIL: An allocation error occurred.
|
||||
*/
|
||||
esp_err_t bootloader_common_get_sha256_of_partition(uint32_t address, uint32_t size, int type, uint8_t *out_sha_256);
|
||||
|
||||
/**
|
||||
* @brief Configure VDDSDIO, call this API to rise VDDSDIO to 1.9V when VDDSDIO regulator is enabled as 1.8V mode.
|
||||
*/
|
||||
void bootloader_common_vddsdio_configure();
|
||||
|
|
34
components/bootloader_support/include/bootloader_util.h
Normal file
34
components/bootloader_support/include/bootloader_util.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* @brief Check if half-open intervals overlap
|
||||
*
|
||||
* @param start1 interval 1 start
|
||||
* @param end1 interval 1 end
|
||||
* @param start2 interval 2 start
|
||||
* @param end2 interval 2 end
|
||||
* @return true iff [start1; end1) overlaps [start2; end2)
|
||||
*/
|
||||
static inline bool bootloader_util_regions_overlap(
|
||||
const intptr_t start1, const intptr_t end1,
|
||||
const intptr_t start2, const intptr_t end2)
|
||||
{
|
||||
return (end1 > start2 && end2 > start1) ||
|
||||
!(end1 <= start2 || end2 <= start1);
|
||||
}
|
|
@ -111,4 +111,21 @@ esp_err_t bootloader_flash_erase_sector(size_t sector);
|
|||
*/
|
||||
esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size);
|
||||
|
||||
/* Cache MMU block size */
|
||||
#define MMU_BLOCK_SIZE 0x00010000
|
||||
|
||||
/* Cache MMU address mask (MMU tables ignore bits which are zero) */
|
||||
#define MMU_FLASH_MASK (~(MMU_BLOCK_SIZE - 1))
|
||||
|
||||
/**
|
||||
* @brief Calculate the number of cache pages to map
|
||||
* @param size size of data to map
|
||||
* @param vaddr virtual address where data will be mapped
|
||||
* @return number of cache MMU pages required to do the mapping
|
||||
*/
|
||||
static inline uint32_t bootloader_cache_pages_to_map(uint32_t size, uint32_t vaddr)
|
||||
{
|
||||
return (size + (vaddr - (vaddr & MMU_FLASH_MASK)) + MMU_BLOCK_SIZE - 1) / MMU_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,14 +31,14 @@ void bootloader_clock_configure()
|
|||
/* Set CPU to 80MHz. Keep other clocks unmodified. */
|
||||
int cpu_freq_mhz = 80;
|
||||
|
||||
/* On ESP32 rev 0, switching to 80MHz if clock was previously set to
|
||||
/* On ESP32 rev 0, switching to 80/160 MHz if clock was previously set to
|
||||
* 240 MHz may cause the chip to lock up (see section 3.5 of the errata
|
||||
* document). For rev. 0, switch to 240 instead if it was chosen in
|
||||
* menuconfig.
|
||||
* document). For rev. 0, switch to 240 instead if it has been enabled
|
||||
* previously.
|
||||
*/
|
||||
uint32_t chip_ver_reg = REG_READ(EFUSE_BLK0_RDATA3_REG);
|
||||
if ((chip_ver_reg & EFUSE_RD_CHIP_VER_REV1_M) == 0 &&
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240) {
|
||||
DPORT_REG_GET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL) == DPORT_CPUPERIOD_SEL_240) {
|
||||
cpu_freq_mhz = 240;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "bootloader_flash.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "esp_image_format.h"
|
||||
#include "bootloader_sha.h"
|
||||
|
||||
|
@ -192,3 +194,18 @@ esp_err_t bootloader_common_get_sha256_of_partition (uint32_t address, uint32_t
|
|||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void bootloader_common_vddsdio_configure()
|
||||
{
|
||||
#if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V
|
||||
rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config();
|
||||
if (cfg.enable == 1 && cfg.tieh == RTC_VDDSDIO_TIEH_1_8V) { // VDDSDIO regulator is enabled @ 1.8V
|
||||
cfg.drefh = 3;
|
||||
cfg.drefm = 3;
|
||||
cfg.drefl = 3;
|
||||
cfg.force = 1;
|
||||
rtc_vddsdio_set_config(cfg);
|
||||
ets_delay_us(10); // wait for regulator to become stable
|
||||
}
|
||||
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
|
||||
}
|
||||
|
|
|
@ -91,8 +91,6 @@ static const char *TAG = "bootloader_flash";
|
|||
*/
|
||||
#define MMU_BLOCK0_VADDR 0x3f400000
|
||||
#define MMU_BLOCK50_VADDR 0x3f720000
|
||||
#define MMU_FLASH_MASK 0xffff0000
|
||||
#define MMU_BLOCK_SIZE 0x00010000
|
||||
|
||||
static bool mapped;
|
||||
|
||||
|
@ -112,10 +110,11 @@ const void *bootloader_mmap(uint32_t src_addr, uint32_t size)
|
|||
}
|
||||
|
||||
uint32_t src_addr_aligned = src_addr & MMU_FLASH_MASK;
|
||||
uint32_t count = (size + (src_addr - src_addr_aligned) + 0xffff) / MMU_BLOCK_SIZE;
|
||||
uint32_t count = bootloader_cache_pages_to_map(size, src_addr);
|
||||
Cache_Read_Disable(0);
|
||||
Cache_Flush(0);
|
||||
ESP_LOGD(TAG, "mmu set paddr=%08x count=%d", src_addr_aligned, count );
|
||||
ESP_LOGD(TAG, "mmu set paddr=%08x count=%d size=%x src_addr=%x src_addr_aligned=%x",
|
||||
src_addr & MMU_FLASH_MASK, count, size, src_addr, src_addr_aligned );
|
||||
int e = cache_flash_mmu_set(0, 0, MMU_BLOCK0_VADDR, src_addr_aligned, 64, count);
|
||||
if (e != 0) {
|
||||
ESP_LOGE(TAG, "cache_flash_mmu_set failed: %d\n", e);
|
||||
|
|
|
@ -33,12 +33,10 @@
|
|||
#include "soc/cpu.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "soc/dport_reg.h"
|
||||
#include "soc/io_mux_reg.h"
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "soc/timer_group_reg.h"
|
||||
#include "soc/gpio_reg.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "soc/rtc_wdt.h"
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
@ -50,6 +48,7 @@
|
|||
#include "bootloader_random.h"
|
||||
#include "bootloader_config.h"
|
||||
#include "bootloader_clock.h"
|
||||
#include "bootloader_common.h"
|
||||
|
||||
#include "flash_qio_mode.h"
|
||||
|
||||
|
@ -63,7 +62,6 @@ static const char* TAG = "boot";
|
|||
static esp_err_t bootloader_main();
|
||||
static void print_flash_info(const esp_image_header_t* pfhdr);
|
||||
static void update_flash_config(const esp_image_header_t* pfhdr);
|
||||
static void vddsdio_configure();
|
||||
static void flash_gpio_configure(const esp_image_header_t* pfhdr);
|
||||
static void uart_console_configure(void);
|
||||
static void wdt_reset_check(void);
|
||||
|
@ -72,6 +70,7 @@ static void wdt_reset_check(void);
|
|||
esp_err_t bootloader_init()
|
||||
{
|
||||
cpu_configure_region_protection();
|
||||
cpu_init_memctl();
|
||||
|
||||
/* Sanity check that static RAM is after the stack */
|
||||
#ifndef NDEBUG
|
||||
|
@ -118,7 +117,7 @@ esp_err_t bootloader_init()
|
|||
|
||||
static esp_err_t bootloader_main()
|
||||
{
|
||||
vddsdio_configure();
|
||||
bootloader_common_vddsdio_configure();
|
||||
/* Read and keep flash ID, for further use. */
|
||||
g_rom_flashchip.device_id = bootloader_read_flash_id();
|
||||
esp_image_header_t fhdr;
|
||||
|
@ -286,21 +285,6 @@ static void print_flash_info(const esp_image_header_t* phdr)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void vddsdio_configure()
|
||||
{
|
||||
#if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V
|
||||
rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config();
|
||||
if (cfg.enable == 1 && cfg.tieh == RTC_VDDSDIO_TIEH_1_8V) { // VDDSDIO regulator is enabled @ 1.8V
|
||||
cfg.drefh = 3;
|
||||
cfg.drefm = 3;
|
||||
cfg.drefl = 3;
|
||||
cfg.force = 1;
|
||||
rtc_vddsdio_set_config(cfg);
|
||||
ets_delay_us(10); // wait for regulator to become stable
|
||||
}
|
||||
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
|
||||
}
|
||||
|
||||
#define FLASH_CLK_IO 6
|
||||
#define FLASH_CS_IO 11
|
||||
#define FLASH_SPIQ_IO 7
|
||||
|
@ -321,10 +305,11 @@ static void IRAM_ATTR flash_gpio_configure(const esp_image_header_t* pfhdr)
|
|||
int drv = 2;
|
||||
switch (pfhdr->spi_mode) {
|
||||
case ESP_IMAGE_SPI_MODE_QIO:
|
||||
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
|
||||
spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_DIO:
|
||||
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN; //qio 3
|
||||
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_ADDR_BITLEN_V, SPI0_R_DIO_ADDR_BITSLEN, SPI_USR_ADDR_BITLEN_S);
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_QOUT:
|
||||
case ESP_IMAGE_SPI_MODE_DOUT:
|
||||
|
@ -349,6 +334,10 @@ static void IRAM_ATTR flash_gpio_configure(const esp_image_header_t* pfhdr)
|
|||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_40M,
|
||||
SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_26M:
|
||||
case ESP_IMAGE_SPI_SPEED_20M:
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy, SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -441,10 +430,18 @@ static void uart_console_configure(void)
|
|||
// (arrays should be optimized away by the compiler)
|
||||
const uint32_t tx_idx_list[3] = { U0TXD_OUT_IDX, U1TXD_OUT_IDX, U2TXD_OUT_IDX };
|
||||
const uint32_t rx_idx_list[3] = { U0RXD_IN_IDX, U1RXD_IN_IDX, U2RXD_IN_IDX };
|
||||
const uint32_t uart_reset[3] = { DPORT_UART_RST, DPORT_UART1_RST, DPORT_UART2_RST };
|
||||
const uint32_t tx_idx = tx_idx_list[uart_num];
|
||||
const uint32_t rx_idx = rx_idx_list[uart_num];
|
||||
|
||||
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[uart_rx_gpio]);
|
||||
gpio_pad_pullup(uart_rx_gpio);
|
||||
|
||||
gpio_matrix_out(uart_tx_gpio, tx_idx, 0, 0);
|
||||
gpio_matrix_in(uart_rx_gpio, rx_idx, 0);
|
||||
|
||||
DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, uart_reset[uart_num]);
|
||||
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, uart_reset[uart_num]);
|
||||
}
|
||||
#endif // CONFIG_CONSOLE_UART_CUSTOM
|
||||
|
||||
|
|
|
@ -389,7 +389,7 @@ static void unpack_load_app(const esp_image_metadata_t* data)
|
|||
// Find DROM & IROM addresses, to configure cache mappings
|
||||
for (int i = 0; i < data->image.segment_count; i++) {
|
||||
const esp_image_segment_header_t *header = &data->segments[i];
|
||||
if (header->load_addr >= SOC_IROM_LOW && header->load_addr < SOC_IROM_HIGH) {
|
||||
if (header->load_addr >= SOC_DROM_LOW && header->load_addr < SOC_DROM_HIGH) {
|
||||
if (drom_addr != 0) {
|
||||
ESP_LOGE(TAG, MAP_ERR_MSG, "DROM");
|
||||
} else {
|
||||
|
@ -399,7 +399,7 @@ static void unpack_load_app(const esp_image_metadata_t* data)
|
|||
drom_load_addr = header->load_addr;
|
||||
drom_size = header->data_len;
|
||||
}
|
||||
if (header->load_addr >= SOC_DROM_LOW && header->load_addr < SOC_DROM_HIGH) {
|
||||
if (header->load_addr >= SOC_IROM_LOW && header->load_addr < SOC_IROM_HIGH) {
|
||||
if (irom_addr != 0) {
|
||||
ESP_LOGE(TAG, MAP_ERR_MSG, "IROM");
|
||||
} else {
|
||||
|
@ -430,6 +430,7 @@ static void set_cache_and_start_app(
|
|||
uint32_t irom_size,
|
||||
uint32_t entry_addr)
|
||||
{
|
||||
int rc;
|
||||
ESP_LOGD(TAG, "configure drom and irom and start");
|
||||
Cache_Read_Disable( 0 );
|
||||
Cache_Flush( 0 );
|
||||
|
@ -441,20 +442,34 @@ static void set_cache_and_start_app(
|
|||
DPORT_PRO_FLASH_MMU_TABLE[i] = DPORT_FLASH_MMU_TABLE_INVALID_VAL;
|
||||
}
|
||||
|
||||
uint32_t drom_page_count = (drom_size + 64*1024 - 1) / (64*1024); // round up to 64k
|
||||
ESP_LOGV(TAG, "d mmu set paddr=%08x vaddr=%08x size=%d n=%d", drom_addr & 0xffff0000, drom_load_addr & 0xffff0000, drom_size, drom_page_count );
|
||||
int rc = cache_flash_mmu_set( 0, 0, drom_load_addr & 0xffff0000, drom_addr & 0xffff0000, 64, drom_page_count );
|
||||
ESP_LOGV(TAG, "rc=%d", rc );
|
||||
rc = cache_flash_mmu_set( 1, 0, drom_load_addr & 0xffff0000, drom_addr & 0xffff0000, 64, drom_page_count );
|
||||
ESP_LOGV(TAG, "rc=%d", rc );
|
||||
uint32_t irom_page_count = (irom_size + 64*1024 - 1) / (64*1024); // round up to 64k
|
||||
ESP_LOGV(TAG, "i mmu set paddr=%08x vaddr=%08x size=%d n=%d", irom_addr & 0xffff0000, irom_load_addr & 0xffff0000, irom_size, irom_page_count );
|
||||
rc = cache_flash_mmu_set( 0, 0, irom_load_addr & 0xffff0000, irom_addr & 0xffff0000, 64, irom_page_count );
|
||||
ESP_LOGV(TAG, "rc=%d", rc );
|
||||
rc = cache_flash_mmu_set( 1, 0, irom_load_addr & 0xffff0000, irom_addr & 0xffff0000, 64, irom_page_count );
|
||||
ESP_LOGV(TAG, "rc=%d", rc );
|
||||
DPORT_REG_CLR_BIT( DPORT_PRO_CACHE_CTRL1_REG, (DPORT_PRO_CACHE_MASK_IRAM0) | (DPORT_PRO_CACHE_MASK_IRAM1 & 0) | (DPORT_PRO_CACHE_MASK_IROM0 & 0) | DPORT_PRO_CACHE_MASK_DROM0 | DPORT_PRO_CACHE_MASK_DRAM1 );
|
||||
DPORT_REG_CLR_BIT( DPORT_APP_CACHE_CTRL1_REG, (DPORT_APP_CACHE_MASK_IRAM0) | (DPORT_APP_CACHE_MASK_IRAM1 & 0) | (DPORT_APP_CACHE_MASK_IROM0 & 0) | DPORT_APP_CACHE_MASK_DROM0 | DPORT_APP_CACHE_MASK_DRAM1 );
|
||||
uint32_t drom_load_addr_aligned = drom_load_addr & MMU_FLASH_MASK;
|
||||
uint32_t drom_page_count = bootloader_cache_pages_to_map(drom_size, drom_load_addr);
|
||||
ESP_LOGV(TAG, "d mmu set paddr=%08x vaddr=%08x size=%d n=%d",
|
||||
drom_addr & MMU_FLASH_MASK, drom_load_addr_aligned, drom_size, drom_page_count);
|
||||
rc = cache_flash_mmu_set(0, 0, drom_load_addr_aligned, drom_addr & MMU_FLASH_MASK, 64, drom_page_count);
|
||||
ESP_LOGV(TAG, "rc=%d", rc);
|
||||
rc = cache_flash_mmu_set(1, 0, drom_load_addr_aligned, drom_addr & MMU_FLASH_MASK, 64, drom_page_count);
|
||||
ESP_LOGV(TAG, "rc=%d", rc);
|
||||
|
||||
uint32_t irom_load_addr_aligned = irom_load_addr & MMU_FLASH_MASK;
|
||||
uint32_t irom_page_count = bootloader_cache_pages_to_map(irom_size, irom_load_addr);
|
||||
ESP_LOGV(TAG, "i mmu set paddr=%08x vaddr=%08x size=%d n=%d",
|
||||
irom_addr & MMU_FLASH_MASK, irom_load_addr_aligned, irom_size, irom_page_count);
|
||||
rc = cache_flash_mmu_set(0, 0, irom_load_addr_aligned, irom_addr & MMU_FLASH_MASK, 64, irom_page_count);
|
||||
ESP_LOGV(TAG, "rc=%d", rc);
|
||||
rc = cache_flash_mmu_set(1, 0, irom_load_addr_aligned, irom_addr & MMU_FLASH_MASK, 64, irom_page_count);
|
||||
ESP_LOGV(TAG, "rc=%d", rc);
|
||||
|
||||
DPORT_REG_CLR_BIT( DPORT_PRO_CACHE_CTRL1_REG,
|
||||
(DPORT_PRO_CACHE_MASK_IRAM0) | (DPORT_PRO_CACHE_MASK_IRAM1 & 0) |
|
||||
(DPORT_PRO_CACHE_MASK_IROM0 & 0) | DPORT_PRO_CACHE_MASK_DROM0 |
|
||||
DPORT_PRO_CACHE_MASK_DRAM1 );
|
||||
|
||||
DPORT_REG_CLR_BIT( DPORT_APP_CACHE_CTRL1_REG,
|
||||
(DPORT_APP_CACHE_MASK_IRAM0) | (DPORT_APP_CACHE_MASK_IRAM1 & 0) |
|
||||
(DPORT_APP_CACHE_MASK_IROM0 & 0) | DPORT_APP_CACHE_MASK_DROM0 |
|
||||
DPORT_APP_CACHE_MASK_DRAM1 );
|
||||
|
||||
Cache_Read_Enable( 0 );
|
||||
|
||||
// Application will need to do Cache_Flush(1) and Cache_Read_Enable(1)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <bootloader_flash.h>
|
||||
#include <bootloader_random.h>
|
||||
#include <bootloader_sha.h>
|
||||
#include "bootloader_util.h"
|
||||
|
||||
/* Checking signatures as part of verifying images is necessary:
|
||||
- Always if secure boot is enabled
|
||||
|
@ -56,6 +57,10 @@ static const char *TAG = "esp_image";
|
|||
(Means loaded code isn't executable until after the secure boot check.)
|
||||
*/
|
||||
static uint32_t ram_obfs_value[2];
|
||||
|
||||
/* Range of IRAM used by the loader, defined in ld script */
|
||||
extern int _loader_text_start;
|
||||
extern int _loader_text_end;
|
||||
#endif
|
||||
|
||||
/* Return true if load_addr is an address the bootloader should load into */
|
||||
|
@ -328,18 +333,41 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
|
|||
(do_load)?"load":(is_mapping)?"map":"");
|
||||
}
|
||||
|
||||
|
||||
#ifdef BOOTLOADER_BUILD
|
||||
/* Before loading segment, check it doesn't clobber bootloader RAM. */
|
||||
if (do_load) {
|
||||
/* Before loading segment, check it doesn't clobber bootloader RAM... */
|
||||
uint32_t end_addr = load_addr + data_len;
|
||||
if (end_addr < 0x40000000) {
|
||||
const intptr_t load_end = load_addr + data_len;
|
||||
if (load_end <= (intptr_t) SOC_DIRAM_DRAM_HIGH) {
|
||||
/* Writing to DRAM */
|
||||
intptr_t sp = (intptr_t)get_sp();
|
||||
if (end_addr > sp - STACK_LOAD_HEADROOM) {
|
||||
ESP_LOGE(TAG, "Segment %d end address 0x%08x too high (bootloader stack 0x%08x liimit 0x%08x)",
|
||||
index, end_addr, sp, sp - STACK_LOAD_HEADROOM);
|
||||
if (load_end > sp - STACK_LOAD_HEADROOM) {
|
||||
/* Bootloader .data/.rodata/.bss is above the stack, so this
|
||||
* also checks that we aren't overwriting these segments.
|
||||
*
|
||||
* TODO: This assumes specific arrangement of sections we have
|
||||
* in the ESP32. Rewrite this in a generic way to support other
|
||||
* layouts.
|
||||
*/
|
||||
ESP_LOGE(TAG, "Segment %d end address 0x%08x too high (bootloader stack 0x%08x limit 0x%08x)",
|
||||
index, load_end, sp, sp - STACK_LOAD_HEADROOM);
|
||||
return ESP_ERR_IMAGE_INVALID;
|
||||
}
|
||||
} else {
|
||||
/* Writing to IRAM */
|
||||
const intptr_t loader_iram_start = (intptr_t) &_loader_text_start;
|
||||
const intptr_t loader_iram_end = (intptr_t) &_loader_text_end;
|
||||
|
||||
if (bootloader_util_regions_overlap(loader_iram_start, loader_iram_end,
|
||||
load_addr, load_end)) {
|
||||
ESP_LOGE(TAG, "Segment %d (0x%08x-0x%08x) overlaps bootloader IRAM (0x%08x-0x%08x)",
|
||||
index, load_addr, load_end, loader_iram_start, loader_iram_end);
|
||||
return ESP_ERR_IMAGE_INVALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // BOOTLOADER_BUILD
|
||||
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
uint32_t free_page_count = spi_flash_mmap_get_free_pages(SPI_FLASH_MMAP_DATA);
|
||||
ESP_LOGD(TAG, "free data page_count 0x%08x",free_page_count);
|
||||
|
|
|
@ -163,7 +163,7 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
|
|||
|
||||
/* If the last flash_crypt_cnt bit is burned or write-disabled, the
|
||||
device can't re-encrypt itself. */
|
||||
if (flash_crypt_wr_dis || flash_crypt_cnt == 0xFF) {
|
||||
if (flash_crypt_wr_dis) {
|
||||
ESP_LOGE(TAG, "Cannot re-encrypt data (FLASH_CRYPT_CNT 0x%02x write disabled %d", flash_crypt_cnt, flash_crypt_wr_dis);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
|
|||
ESP_LOGD(TAG, "All flash regions checked for encryption pass");
|
||||
|
||||
/* Set least significant 0-bit in flash_crypt_cnt */
|
||||
int ffs_inv = __builtin_ffs((~flash_crypt_cnt) & 0xFF);
|
||||
/* ffs_inv shouldn't be zero, as zero implies flash_crypt_cnt == 0xFF */
|
||||
int ffs_inv = __builtin_ffs((~flash_crypt_cnt) & EFUSE_RD_FLASH_CRYPT_CNT);
|
||||
/* ffs_inv shouldn't be zero, as zero implies flash_crypt_cnt == EFUSE_RD_FLASH_CRYPT_CNT (0x7F) */
|
||||
uint32_t new_flash_crypt_cnt = flash_crypt_cnt + (1 << (ffs_inv - 1));
|
||||
ESP_LOGD(TAG, "FLASH_CRYPT_CNT 0x%x -> 0x%x", flash_crypt_cnt, new_flash_crypt_cnt);
|
||||
REG_SET_FIELD(EFUSE_BLK0_WDATA0_REG, EFUSE_FLASH_CRYPT_CNT, new_flash_crypt_cnt);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "rom/sha.h"
|
||||
typedef SHA_CTX sha_context;
|
||||
#else
|
||||
#include "hwcrypto/sha.h"
|
||||
#include "mbedtls/sha256.h"
|
||||
#endif
|
||||
|
||||
static const char* TAG = "secure_boot";
|
||||
|
@ -57,8 +57,8 @@ esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length)
|
|||
bootloader_sha256_data(handle, data, length);
|
||||
bootloader_sha256_finish(handle, digest);
|
||||
#else
|
||||
/* Use thread-safe esp-idf SHA function */
|
||||
esp_sha(SHA2_256, data, length, digest);
|
||||
/* Use thread-safe mbedTLS version */
|
||||
mbedtls_sha256_ret(data, length, digest, 0);
|
||||
#endif
|
||||
|
||||
// Map the signature block and verify the signature
|
||||
|
|
6
components/bootloader_support/test/CMakeLists.txt
Normal file
6
components/bootloader_support/test/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
set(COMPONENT_SRCDIRS ".")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
set(COMPONENT_REQUIRES unity bootloader_support app_update)
|
||||
|
||||
register_component()
|
|
@ -14,6 +14,7 @@
|
|||
#include "freertos/xtensa_api.h"
|
||||
#include "unity.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "bootloader_util.h"
|
||||
#include "esp_partition.h"
|
||||
#include "esp_ota_ops.h"
|
||||
#include "esp_image_format.h"
|
||||
|
@ -92,3 +93,23 @@ TEST_CASE("Test label_search", "[bootloader_support]")
|
|||
check_label_search(25, "phy, 1234567890123456, nvs1", "12345678901234567", true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Test regions_overlap", "[bootloader_support]")
|
||||
{
|
||||
TEST_ASSERT( bootloader_util_regions_overlap(1, 2, 1, 2) );
|
||||
|
||||
TEST_ASSERT( bootloader_util_regions_overlap(1, 2, 0, 2) );
|
||||
TEST_ASSERT( bootloader_util_regions_overlap(1, 2, 1, 3) );
|
||||
TEST_ASSERT( bootloader_util_regions_overlap(1, 2, 0, 3) );
|
||||
|
||||
TEST_ASSERT( bootloader_util_regions_overlap(0, 2, 1, 2) );
|
||||
TEST_ASSERT( bootloader_util_regions_overlap(1, 3, 1, 2) );
|
||||
TEST_ASSERT( bootloader_util_regions_overlap(0, 3, 1, 2) );
|
||||
|
||||
TEST_ASSERT( !bootloader_util_regions_overlap(2, 3, 1, 2) );
|
||||
TEST_ASSERT( !bootloader_util_regions_overlap(1, 2, 2, 3) );
|
||||
|
||||
TEST_ASSERT( !bootloader_util_regions_overlap(3, 4, 1, 2) );
|
||||
TEST_ASSERT( !bootloader_util_regions_overlap(1, 2, 3, 4) );
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ if(CONFIG_BT_ENABLED)
|
|||
bluedroid/bta/av/include
|
||||
bluedroid/bta/dm/include
|
||||
bluedroid/bta/gatt/include
|
||||
bluedroid/bta/hf_client/include
|
||||
bluedroid/bta/hh/include
|
||||
bluedroid/bta/jv/include
|
||||
bluedroid/bta/sdp/include
|
||||
|
@ -93,6 +94,14 @@ if(CONFIG_BT_ENABLED)
|
|||
"bluedroid/bta/jv/bta_jv_api.c"
|
||||
"bluedroid/bta/jv/bta_jv_cfg.c"
|
||||
"bluedroid/bta/jv/bta_jv_main.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_act.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_api.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_at.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_cmd.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_main.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_rfc.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_sco.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_sdp.c"
|
||||
"bluedroid/bta/sdp/bta_sdp.c"
|
||||
"bluedroid/bta/sdp/bta_sdp_act.c"
|
||||
"bluedroid/bta/sdp/bta_sdp_api.c"
|
||||
|
@ -122,6 +131,8 @@ if(CONFIG_BT_ENABLED)
|
|||
"bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c"
|
||||
"bluedroid/btc/profile/std/a2dp/btc_av.c"
|
||||
"bluedroid/btc/profile/std/avrc/btc_avrc.c"
|
||||
"bluedroid/btc/profile/std/hf_client/btc_hf_client.c"
|
||||
"bluedroid/btc/profile/std/hf_client/bta_hf_client_co.c"
|
||||
"bluedroid/btc/profile/std/gap/btc_gap_ble.c"
|
||||
"bluedroid/btc/profile/std/gap/btc_gap_bt.c"
|
||||
"bluedroid/btc/profile/std/gatt/btc_gatt_common.c"
|
||||
|
|
|
@ -53,6 +53,29 @@ config BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN
|
|||
BR/EDR Synchronize maximum connections of bluetooth controller.
|
||||
Each connection uses 2KB static DRAM whenever the BT controller is enabled.
|
||||
|
||||
choice BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH
|
||||
prompt "BR/EDR Sync(SCO/eSCO) default data path"
|
||||
depends on BTDM_CONTROLLER_MODE_BR_EDR_ONLY || BTDM_CONTROLLER_MODE_BTDM
|
||||
default BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
|
||||
help
|
||||
SCO data path, i.e. HCI or PCM.
|
||||
SCO data can be sent/received through HCI synchronous packets, or the data
|
||||
can be routed to on-chip PCM module on ESP32. PCM input/output signals can
|
||||
be "matrixed" to GPIOs. The default data path can also be set using API
|
||||
"esp_bredr_sco_datapath_set"
|
||||
|
||||
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI
|
||||
bool "HCI"
|
||||
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
|
||||
bool "PCM"
|
||||
endchoice
|
||||
|
||||
config BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_EFF
|
||||
int
|
||||
default 0 if BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_HCI
|
||||
default 1 if BTDM_CONTROLLER_BR_EDR_SCO_DATA_PATH_PCM
|
||||
default 0
|
||||
|
||||
config BTDM_CONTROLLER_BLE_MAX_CONN_EFF
|
||||
int
|
||||
default BTDM_CONTROLLER_BLE_MAX_CONN if BTDM_CONTROLLER_MODE_BLE_ONLY || BTDM_CONTROLLER_MODE_BTDM
|
||||
|
@ -135,7 +158,6 @@ config BTDM_CONTROLLER_MODEM_SLEEP
|
|||
default y
|
||||
help
|
||||
Enable/disable bluetooth controller low power mode.
|
||||
Note that currently there is problem in the combination use of bluetooth modem sleep and Dynamic Frequency Scaling(DFS). So do not enable DFS if bluetooth modem sleep is in use.
|
||||
|
||||
choice BTDM_MODEM_SLEEP_MODE
|
||||
prompt "Bluetooth Modem sleep mode"
|
||||
|
@ -146,11 +168,13 @@ choice BTDM_MODEM_SLEEP_MODE
|
|||
config BTDM_MODEM_SLEEP_MODE_ORIG
|
||||
bool "ORIG Mode(sleep with low power clock)"
|
||||
help
|
||||
ORIG mode is a deep sleep mode that can be used for dual mode controller. In this mode, bluetooth controller sleeps between BR/EDR frames and BLE events. A low power clock is used to maintain bluetooth reference clock.
|
||||
ORIG mode is a bluetooth sleep mode that can be used for dual mode controller. In this mode, bluetooth controller
|
||||
sleeps between BR/EDR frames and BLE events. A low power clock is used to maintain bluetooth reference clock.
|
||||
config BTDM_MODEM_SLEEP_MODE_EVED
|
||||
bool "EVED Mode "
|
||||
bool "EVED Mode(For internal test only)"
|
||||
help
|
||||
This mode is for BLE only.
|
||||
EVED mode is for BLE only and is only for internal test. Do not use it for production. this mode is not compatible
|
||||
with DFS nor light sleep
|
||||
endchoice
|
||||
|
||||
choice BTDM_LOW_POWER_CLOCK
|
||||
|
@ -161,11 +185,14 @@ choice BTDM_LOW_POWER_CLOCK
|
|||
|
||||
config BTDM_LPCLK_SEL_MAIN_XTAL
|
||||
bool "Main crystal"
|
||||
help
|
||||
Main crystal can be used as low power clock for bluetooth modem sleep. If this option is selected, bluetooth
|
||||
modem sleep can work under Dynamic Frequency Scaling(DFS) enabled, but cannot work when light sleep is enabled.
|
||||
Main crystal has a relatively better performance than other bluetooth low power clock sources.
|
||||
config BTDM_LPCLK_SEL_EXT_32K_XTAL
|
||||
bool "External 32kHz crystal"
|
||||
depends on ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
|
||||
config BLE_SCAN_DUPLICATE
|
||||
|
@ -180,16 +207,16 @@ choice SCAN_DUPLICATE_TYPE
|
|||
default SCAN_DUPLICATE_BY_DEVICE_ADDR
|
||||
depends on BLE_SCAN_DUPLICATE
|
||||
help
|
||||
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use advertiser address
|
||||
filtering. The adv packet of the same address is only allowed to be reported once. Another way is "Scan Duplicate
|
||||
By Device Address And Advertising Data". This way is to use advertising data and device address filtering. All
|
||||
different adv packets with the same address are allowed to be reported. The last way is "Scan Duplicate By Advertising
|
||||
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use advertiser address
|
||||
filtering. The adv packet of the same address is only allowed to be reported once. Another way is "Scan Duplicate
|
||||
By Device Address And Advertising Data". This way is to use advertising data and device address filtering. All
|
||||
different adv packets with the same address are allowed to be reported. The last way is "Scan Duplicate By Advertising
|
||||
Data". This way is to use advertising data filtering. All same advertising data only allow to be reported once even though
|
||||
they are from different devices.
|
||||
|
||||
config SCAN_DUPLICATE_BY_DEVICE_ADDR
|
||||
bool "Scan Duplicate By Device Address"
|
||||
help
|
||||
help
|
||||
This way is to use advertiser address filtering. The adv packet of the same address is only allowed to be reported once
|
||||
|
||||
config SCAN_DUPLICATE_BY_ADV_DATA
|
||||
|
@ -201,7 +228,7 @@ config SCAN_DUPLICATE_BY_ADV_DATA
|
|||
config SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR
|
||||
bool "Scan Duplicate By Device Address And Advertising Data"
|
||||
help
|
||||
This way is to use advertising data and device address filtering. All different adv packets with the same address are
|
||||
This way is to use advertising data and device address filtering. All different adv packets with the same address are
|
||||
allowed to be reported.
|
||||
endchoice
|
||||
|
||||
|
@ -238,6 +265,39 @@ config MESH_DUPLICATE_SCAN_CACHE_SIZE
|
|||
Maximum number of adv packets which can be recorded in duplicate scan cache for BLE Mesh.
|
||||
When the maximum amount of device in the filter is reached, the cache will be refreshed.
|
||||
|
||||
config BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
|
||||
bool "BLE adv report flow control supported"
|
||||
depends on (BTDM_CONTROLLER_MODE_BTDM || BTDM_CONTROLLER_MODE_BLE_ONLY)
|
||||
default y
|
||||
help
|
||||
The function is mainly used to enable flow control for advertising reports. When it is enabled,
|
||||
advertising reports will be discarded by the controller if the number of unprocessed advertising
|
||||
reports exceeds the size of BLE adv report flow control.
|
||||
|
||||
config BLE_ADV_REPORT_FLOW_CONTROL_NUM
|
||||
int "BLE adv report flow control number"
|
||||
depends on BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
|
||||
range 50 1000
|
||||
default 100
|
||||
help
|
||||
The number of unprocessed advertising report that Bluedroid can save.If you set
|
||||
`BLE_ADV_REPORT_FLOW_CONTROL_NUM` to a small value, this may cause adv packets lost.
|
||||
If you set `BLE_ADV_REPORT_FLOW_CONTROL_NUM` to a large value, Bluedroid may cache a
|
||||
lot of adv packets and this may cause system memory run out. For example, if you set
|
||||
it to 50, the maximum memory consumed by host is 35 * 50 bytes. Please set
|
||||
`BLE_ADV_REPORT_FLOW_CONTROL_NUM` according to your system free memory and handle adv
|
||||
packets as fast as possible, otherwise it will cause adv packets lost.
|
||||
|
||||
config BLE_ADV_REPORT_DISCARD_THRSHOLD
|
||||
int "BLE adv lost event threshold value"
|
||||
depends on BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
|
||||
range 1 1000
|
||||
default 20
|
||||
help
|
||||
When adv report flow control is enabled, The ADV lost event will be generated when the number
|
||||
of ADV packets lost in the controller reaches this threshold. It is better to set a larger value.
|
||||
If you set `BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
|
||||
may cause adv packets lost more.
|
||||
|
||||
|
||||
endmenu
|
||||
|
@ -331,15 +391,15 @@ endchoice
|
|||
choice HFP_AUDIO_DATA_PATH
|
||||
prompt "audio(SCO) data path"
|
||||
depends on HFP_ENABLE
|
||||
help
|
||||
SCO data path, i.e. HCI or PCM. This option is set using API
|
||||
"esp_bredr_sco_datapath_set" in Bluetooth host. Default SCO data
|
||||
path can also be set in Bluetooth Controller.
|
||||
|
||||
config HFP_AUDIO_DATA_PATH_PCM
|
||||
bool "PCM"
|
||||
help
|
||||
This enables the Serial Port Profile
|
||||
config HFP_AUDIO_DATA_PATH_HCI
|
||||
bool "HCI"
|
||||
help
|
||||
This enables the Serial Port Profile
|
||||
endchoice
|
||||
|
||||
config GATTS_ENABLE
|
||||
|
@ -396,6 +456,13 @@ config BLE_SMP_ENABLE
|
|||
help
|
||||
This option can be close when the app not used the ble security connect.
|
||||
|
||||
config SMP_SLAVE_CON_PARAMS_UPD_ENABLE
|
||||
bool "Slave enable connection parameters update during pairing"
|
||||
depends on BLE_SMP_ENABLE
|
||||
default n
|
||||
help
|
||||
In order to reduce the pairing time, slave actively initiates connection parameters update during pairing.
|
||||
|
||||
config BT_STACK_NO_LOG
|
||||
bool "Disable BT debug logs (minimize bin size)"
|
||||
depends on BLUEDROID_ENABLED
|
||||
|
@ -1180,7 +1247,26 @@ config SMP_ENABLE
|
|||
depends on BLUEDROID_ENABLED
|
||||
default CLASSIC_BT_ENABLED || BLE_SMP_ENABLE
|
||||
|
||||
config BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
|
||||
bool "Report adv data and scan response individually when BLE active scan"
|
||||
depends on BLUEDROID_ENABLED && (BTDM_CONTROLLER_MODE_BTDM || BTDM_CONTROLLER_MODE_BLE_ONLY)
|
||||
default n
|
||||
help
|
||||
Originally, when doing BLE active scan, Bluedroid will not report adv to application layer
|
||||
until receive scan response. This option is used to disable the behavior. When enable this option,
|
||||
Bluedroid will report adv data or scan response to application layer immediately.
|
||||
|
||||
# Memory reserved at start of DRAM for Bluetooth stack
|
||||
|
||||
config BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT
|
||||
int "Timeout of BLE connection establishment"
|
||||
depends on BLUEDROID_ENABLED
|
||||
range 1 60
|
||||
default 30
|
||||
help
|
||||
Bluetooth Connection establishment maximum time, if connection time exceeds this value, the connection
|
||||
establishment fails, ESP_GATTC_OPEN_EVT or ESP_GATTS_OPEN_EVT is triggered.
|
||||
|
||||
config BT_RESERVE_DRAM
|
||||
hex
|
||||
default 0xdb5c if BT_ENABLED
|
||||
|
|
|
@ -449,6 +449,73 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
|
|||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (!device_info && type <= ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID) {
|
||||
return ESP_ERR_INVALID_SIZE;
|
||||
}
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
|
||||
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_ADD;
|
||||
arg.update_duplicate_exceptional_list.info_type = type;
|
||||
if (device_info) {
|
||||
memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t));
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (!device_info && type <= ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID) {
|
||||
return ESP_ERR_INVALID_SIZE;
|
||||
}
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
|
||||
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_REMOVE;
|
||||
arg.update_duplicate_exceptional_list.info_type = type;
|
||||
if (device_info) {
|
||||
memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t));
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_exceptional_list_type_t list_type)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_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_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
|
||||
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN;
|
||||
arg.update_duplicate_exceptional_list.info_type = list_type;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#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)
|
||||
|
|
|
@ -321,6 +321,7 @@ esp_gatt_status_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *l
|
|||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (attr_handle == ESP_GATT_ILLEGAL_HANDLE) {
|
||||
*length = 0;
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ typedef enum {
|
|||
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
|
||||
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When read the rssi complete, the event comes */
|
||||
ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT, /*!< When add or remove whitelist complete, the event comes */
|
||||
ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT, /*!< When update duplicate exceptional list complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX,
|
||||
} esp_gap_ble_cb_event_t;
|
||||
/// This is the old name, just for backwards compatibility
|
||||
|
@ -286,7 +287,7 @@ typedef struct {
|
|||
esp_ble_adv_type_t adv_type; /*!< Advertising type */
|
||||
esp_ble_addr_type_t own_addr_type; /*!< Owner bluetooth device address type */
|
||||
esp_bd_addr_t peer_addr; /*!< Peer device bluetooth device address */
|
||||
esp_ble_addr_type_t peer_addr_type; /*!< Peer device bluetooth device address type */
|
||||
esp_ble_addr_type_t peer_addr_type; /*!< Peer device bluetooth device address type, only support public address type and random address type */
|
||||
esp_ble_adv_channel_t channel_map; /*!< Advertising channel map */
|
||||
esp_ble_adv_filter_t adv_filter_policy; /*!< Advertising filter policy */
|
||||
} esp_ble_adv_params_t;
|
||||
|
@ -303,9 +304,9 @@ typedef struct {
|
|||
Value of 0xFFFF indicates no specific minimum.
|
||||
Values not defined above are reserved for future use.*/
|
||||
|
||||
int max_interval; /*!< Advertising data show slave preferred connection max interval.
|
||||
int max_interval; /*!< Advertising data show slave preferred connection max interval.
|
||||
The connection interval in the following manner:
|
||||
connIntervalmax = Conn_Interval_Max * 1.25 ms
|
||||
connIntervalmax = Conn_Interval_Max * 1.25 ms
|
||||
Conn_Interval_Max range: 0x0006 to 0x0C80
|
||||
Conn_Interval_Max shall be equal to or greater than the Conn_Interval_Min.
|
||||
Value of 0xFFFF indicates no specific maximum.
|
||||
|
@ -366,8 +367,8 @@ typedef struct {
|
|||
Range: 0x0004 to 0x4000 Default: 0x0010 (10 ms)
|
||||
Time = N * 0.625 msec
|
||||
Time Range: 2.5 msec to 10240 msec */
|
||||
esp_ble_scan_duplicate_t scan_duplicate; /*!< The Scan_Duplicates parameter controls whether the Link Layer should filter out
|
||||
duplicate advertising reports (BLE_SCAN_DUPLICATE_ENABLE) to the Host, or if the Link Layer should generate
|
||||
esp_ble_scan_duplicate_t scan_duplicate; /*!< The Scan_Duplicates parameter controls whether the Link Layer should filter out
|
||||
duplicate advertising reports (BLE_SCAN_DUPLICATE_ENABLE) to the Host, or if the Link Layer should generate
|
||||
advertising reports for each packet received */
|
||||
} esp_ble_scan_params_t;
|
||||
|
||||
|
@ -552,6 +553,7 @@ typedef enum {
|
|||
ESP_GAP_SEARCH_DISC_CMPL_EVT = 4, /*!< Discovery complete. */
|
||||
ESP_GAP_SEARCH_DI_DISC_CMPL_EVT = 5, /*!< Discovery complete. */
|
||||
ESP_GAP_SEARCH_SEARCH_CANCEL_CMPL_EVT = 6, /*!< Search cancelled */
|
||||
ESP_GAP_SEARCH_INQ_DISCARD_NUM_EVT = 7, /*!< The number of pkt discarded by flow control */
|
||||
} esp_gap_search_evt_t;
|
||||
|
||||
/**
|
||||
|
@ -570,6 +572,34 @@ typedef enum{
|
|||
ESP_BLE_WHITELIST_REMOVE = 0X00, /*!< remove mac from whitelist */
|
||||
ESP_BLE_WHITELIST_ADD = 0X01, /*!< add address to whitelist */
|
||||
}esp_ble_wl_opration_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_ADD = 0, /*!< Add device info into duplicate scan exceptional list */
|
||||
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_REMOVE, /*!< Remove device info from duplicate scan exceptional list */
|
||||
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, /*!< Clean duplicate scan exceptional list */
|
||||
} esp_bt_duplicate_exceptional_subcode_type_t;
|
||||
|
||||
#define BLE_BIT(n) (1UL<<(n))
|
||||
|
||||
typedef enum {
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR = 0, /*!< BLE advertising address , device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID, /*!< BLE mesh link ID, it is for BLE mesh, device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV, /*!< BLE mesh provisioning service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1827 | .... |` */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1828 | .... |` */
|
||||
} esp_ble_duplicate_exceptional_info_type_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST = BLE_BIT(0), /*!< duplicate scan exceptional addr list */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST = BLE_BIT(1), /*!< duplicate scan exceptional mesh link ID list */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_BEACON_TYPE_LIST = BLE_BIT(2), /*!< duplicate scan exceptional mesh beacon type list */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROV_SRV_ADV_LIST = BLE_BIT(3), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROXY_SRV_ADV_LIST = BLE_BIT(4), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = 0xFFFF, /*!< duplicate scan exceptional all list */
|
||||
} esp_duplicate_scan_exceptional_list_type_t;
|
||||
|
||||
typedef uint8_t esp_duplicate_info_t[ESP_BD_ADDR_LEN];
|
||||
|
||||
/**
|
||||
* @brief Gap callback parameters union
|
||||
*/
|
||||
|
@ -607,6 +637,7 @@ typedef union {
|
|||
int num_resps; /*!< Scan result number */
|
||||
uint8_t adv_data_len; /*!< Adv data length */
|
||||
uint8_t scan_rsp_len; /*!< Scan response length */
|
||||
uint32_t num_dis; /*!< The number of discard packets */
|
||||
} scan_rst; /*!< Event parameter of ESP_GAP_BLE_SCAN_RESULT_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT
|
||||
|
@ -715,6 +746,15 @@ typedef union {
|
|||
esp_bt_status_t status; /*!< Indicate the add or remove whitelist operation success status */
|
||||
esp_ble_wl_opration_t wl_opration; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */
|
||||
} update_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_update_duplicate_exceptional_list_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate update duplicate scan exceptional list operation success status */
|
||||
uint8_t subcode; /*!< Define in esp_bt_duplicate_exceptional_subcode_type_t */
|
||||
uint16_t length; /*!< The length of device_info */
|
||||
esp_duplicate_info_t device_info; /*!< device information, when subcode is ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, the value is invalid */
|
||||
} update_duplicate_exceptional_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
|
@ -962,8 +1002,7 @@ esp_err_t esp_ble_gap_get_local_used_addr(esp_bd_addr_t local_used_addr, uint8_t
|
|||
* @param[in] type - finding ADV data type
|
||||
* @param[out] length - return the length of ADV data not including type
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
* @return pointer of ADV data
|
||||
*
|
||||
*/
|
||||
uint8_t *esp_ble_resolve_adv_data(uint8_t *adv_data, uint8_t type, uint8_t *length);
|
||||
|
@ -1008,6 +1047,45 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
|
|||
*/
|
||||
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
|
||||
|
||||
/**
|
||||
* @brief This function is called to add a device info into the duplicate scan exceptional list.
|
||||
*
|
||||
*
|
||||
* @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t
|
||||
* when type is MESH_BEACON_TYPE, MESH_PROV_SRV_ADV or MESH_PROXY_SRV_ADV , device_info is invalid.
|
||||
* @param[in] device_info: the device information.
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* @brief This function is called to remove a device info from the duplicate scan exceptional list.
|
||||
*
|
||||
*
|
||||
* @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t
|
||||
* when type is MESH_BEACON_TYPE, MESH_PROV_SRV_ADV or MESH_PROXY_SRV_ADV , device_info is invalid.
|
||||
* @param[in] device_info: the device information.
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info);
|
||||
|
||||
/**
|
||||
* @brief This function is called to clean the duplicate scan exceptional list.
|
||||
* This API will delete all device information in the duplicate scan exceptional list.
|
||||
*
|
||||
*
|
||||
* @param[in] list_type: duplicate scan exceptional list type, the value can be one or more of esp_duplicate_scan_exceptional_list_type_t.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_exceptional_list_type_t list_type);
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
/**
|
||||
* @brief Set a GAP security parameter value. Overrides the default value.
|
||||
|
|
|
@ -347,7 +347,8 @@ esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id);
|
|||
|
||||
|
||||
/**
|
||||
* @brief This function is called to request a GATT service discovery
|
||||
* @brief This function is called to get service from local cache.
|
||||
* If it does not exist, request a GATT service discovery
|
||||
* on a GATT server. This function report service search result
|
||||
* by a callback event, and followed by a service search complete
|
||||
* event.
|
||||
|
|
|
@ -120,6 +120,7 @@ typedef union {
|
|||
struct gatts_conf_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint16_t handle; /*!< attribute handle */
|
||||
uint16_t len; /*!< The indication or notification value length, len is valid when send notification or indication failed */
|
||||
uint8_t *value; /*!< The indication or notification value , value is valid when send notification or indication failed */
|
||||
} conf; /*!< Gatt server callback param of ESP_GATTS_CONF_EVT (confirm) */
|
||||
|
|
|
@ -251,9 +251,9 @@ typedef union {
|
|||
} esp_hf_client_cb_param_t;
|
||||
|
||||
/**
|
||||
* @brief HFP client incoming data callback function, the callback is useful in case of
|
||||
* @brief HFP client incoming data callback function, the callback is useful in case of
|
||||
* Voice Over HCI.
|
||||
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
|
||||
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
|
||||
* buffer is allocated inside bluetooth protocol stack and will be released after
|
||||
* invoke of the callback is finished.
|
||||
* @param[in] len : size(in bytes) in buf
|
||||
|
@ -261,13 +261,13 @@ typedef union {
|
|||
typedef void (* esp_hf_client_incoming_data_cb_t)(const uint8_t *buf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief HFP client outgoing data callback function, the callback is useful in case of
|
||||
* Voice Over HCI. Once audio connection is set up and the application layer has
|
||||
* prepared data to send, the lower layer will call this function to read data
|
||||
* @brief HFP client outgoing data callback function, the callback is useful in case of
|
||||
* Voice Over HCI. Once audio connection is set up and the application layer has
|
||||
* prepared data to send, the lower layer will call this function to read data
|
||||
* and then send. This callback is supposed to be implemented as non-blocking,
|
||||
* and if data is not enough, return value 0 is supposed.
|
||||
*
|
||||
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
|
||||
*
|
||||
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
|
||||
* buffer is allocated inside bluetooth protocol stack and will be released after
|
||||
* invoke of the callback is finished.
|
||||
* @param[in] len : size(in bytes) in buf
|
||||
|
@ -326,7 +326,7 @@ esp_err_t esp_hf_client_deinit(void);
|
|||
|
||||
/**
|
||||
*
|
||||
* @brief Connect to remote bluetooth HFP audio gateway(AG) device, must after esp_a2d_hf_client_init()
|
||||
* @brief Connect to remote bluetooth HFP audio gateway(AG) device, must after esp_hf_client_init()
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
*
|
||||
|
@ -606,7 +606,7 @@ void esp_hf_client_outgoing_data_ready(void);
|
|||
|
||||
/**
|
||||
* @brief Initialize the down sampling converter. This is a utility function that can
|
||||
* only be used in the case that Voice Over HCI is enabled.
|
||||
* only be used in the case that Voice Over HCI is enabled.
|
||||
*
|
||||
* @param[in] src_sps: original samples per second(source audio data, i.e. 48000, 32000,
|
||||
* 16000, 44100, 22050, 11025)
|
||||
|
|
|
@ -190,8 +190,7 @@ esp_err_t esp_spp_register_callback(esp_spp_cb_t callback);
|
|||
/**
|
||||
* @brief This function is called to init SPP.
|
||||
*
|
||||
* @param[in] mode: Choose the mode of SPP, ESP_SPP_MODE_CB or ESP_SPP_MODE_CB.
|
||||
* Now only supports ESP_SPP_MODE_CB mode, we will continue to update.
|
||||
* @param[in] mode: Choose the mode of SPP, ESP_SPP_MODE_CB or ESP_SPP_MODE_VFS.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
|
|
|
@ -1293,9 +1293,10 @@ void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
|
|||
/* if SBC is used by the SNK as INT, discover req is not sent in bta_av_config_ind.
|
||||
* call disc_res now */
|
||||
/* this is called in A2DP SRC path only, In case of SINK we don't need it */
|
||||
if (local_sep == AVDT_TSEP_SRC)
|
||||
if (local_sep == AVDT_TSEP_SRC) {
|
||||
p_scb->p_cos->disc_res(p_scb->hndl, num, num, 0, p_scb->peer_addr,
|
||||
UUID_SERVCLASS_AUDIO_SOURCE);
|
||||
}
|
||||
} else {
|
||||
/* we do not know the peer device and it is using non-SBC codec
|
||||
* we need to know all the SEPs on SNK */
|
||||
|
|
|
@ -829,10 +829,11 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
|
|||
if (p_data->rc_msg.msg.pass.op_id == AVRC_ID_VENDOR) {
|
||||
p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_NOT_IMPL;
|
||||
#if (AVRC_METADATA_INCLUDED == TRUE)
|
||||
if (p_cb->features & BTA_AV_FEAT_METADATA)
|
||||
if (p_cb->features & BTA_AV_FEAT_METADATA) {
|
||||
p_data->rc_msg.msg.hdr.ctype =
|
||||
bta_av_group_navi_supported(p_data->rc_msg.msg.pass.pass_len,
|
||||
p_data->rc_msg.msg.pass.p_pass_data, is_inquiry);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
p_data->rc_msg.msg.hdr.ctype = bta_av_op_supported(p_data->rc_msg.msg.pass.op_id, is_inquiry);
|
||||
|
@ -890,7 +891,9 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
|
|||
evt = bta_av_proc_meta_cmd (&rc_rsp, &p_data->rc_msg, &ctype);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
evt = BTA_AV_VENDOR_CMD_EVT;
|
||||
}
|
||||
}
|
||||
/* else if configured to support vendor specific and it's a response */
|
||||
else if ((p_cb->features & BTA_AV_FEAT_VENDOR) &&
|
||||
|
@ -902,7 +905,9 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
|
|||
evt = BTA_AV_META_MSG_EVT;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
evt = BTA_AV_VENDOR_RSP_EVT;
|
||||
}
|
||||
|
||||
}
|
||||
/* else if not configured to support vendor specific and it's a command */
|
||||
|
@ -1870,8 +1875,14 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data)
|
|||
bta_av_cb.features = 0;
|
||||
}
|
||||
|
||||
/* Clear the Capturing service class bit */
|
||||
cod.service = BTM_COD_SERVICE_CAPTURING;
|
||||
/* Clear the Capturing/Rendering service class bit */
|
||||
if (p_data->api_reg.tsep == AVDT_TSEP_SRC) {
|
||||
cod.service = BTM_COD_SERVICE_CAPTURING | BTM_COD_SERVICE_AUDIO;
|
||||
} else {
|
||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||
cod.service = BTM_COD_SERVICE_RENDERING | BTM_COD_SERVICE_AUDIO;
|
||||
#endif
|
||||
}
|
||||
utl_set_device_class(&cod, BTA_UTL_CLR_COD_SERVICE_CLASS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -577,15 +577,19 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Set the Capturing service class bit */
|
||||
/* Set the Calss of Device (Audio & Capturing/Rendering service class bit) */
|
||||
if (p_data->api_reg.tsep == AVDT_TSEP_SRC) {
|
||||
cod.service = BTM_COD_SERVICE_CAPTURING;
|
||||
cod.service = BTM_COD_SERVICE_CAPTURING | BTM_COD_SERVICE_AUDIO;
|
||||
cod.major = BTM_COD_MAJOR_AUDIO;
|
||||
cod.minor = BTM_COD_MINOR_UNCLASSIFIED;
|
||||
} else {
|
||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||
cod.service = BTM_COD_SERVICE_RENDERING;
|
||||
cod.service = BTM_COD_SERVICE_RENDERING | BTM_COD_SERVICE_AUDIO;
|
||||
cod.major = BTM_COD_MAJOR_AUDIO;
|
||||
cod.minor = BTM_COD_MINOR_LOUDSPEAKER;
|
||||
#endif
|
||||
}
|
||||
utl_set_device_class(&cod, BTA_UTL_SET_COD_SERVICE_CLASS);
|
||||
utl_set_device_class(&cod, BTA_UTL_SET_COD_ALL);
|
||||
} /* if 1st channel */
|
||||
|
||||
/* get stream configuration and create stream */
|
||||
|
@ -1264,7 +1268,7 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
|
|||
** Returns char *
|
||||
**
|
||||
*******************************************************************************/
|
||||
static char *bta_av_st_code(UINT8 state)
|
||||
UNUSED_ATTR static char *bta_av_st_code(UINT8 state)
|
||||
{
|
||||
switch (state) {
|
||||
case BTA_AV_INIT_ST: return "INIT";
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <string.h>
|
||||
#include "bta/bta_av_co.h"
|
||||
#include "bta_av_int.h"
|
||||
#include "osi/osi.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and types
|
||||
|
@ -564,7 +565,7 @@ void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb)
|
|||
** Returns char *
|
||||
**
|
||||
*******************************************************************************/
|
||||
static char *bta_av_sst_code(UINT8 state)
|
||||
UNUSED_ATTR static char *bta_av_sst_code(UINT8 state)
|
||||
{
|
||||
switch (state) {
|
||||
case BTA_AV_INIT_SST: return "INIT";
|
||||
|
|
|
@ -127,6 +127,7 @@ static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr);
|
|||
#endif ///SMP_INCLUDED == TRUE
|
||||
static void bta_dm_observe_results_cb(tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
|
||||
static void bta_dm_observe_cmpl_cb(void *p_result);
|
||||
static void bta_dm_observe_discard_cb (uint32_t num_dis);
|
||||
static void bta_dm_delay_role_switch_cback(TIMER_LIST_ENT *p_tle);
|
||||
extern void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8 *p_uuid128);
|
||||
static void bta_dm_disable_timer_cback(TIMER_LIST_ENT *p_tle);
|
||||
|
@ -635,13 +636,15 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
|
|||
|
||||
/* set modes for Discoverability and connectability if not ignore */
|
||||
if (p_data->set_visibility.disc_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
||||
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
|
||||
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
|
||||
p_data->set_visibility.disc_mode =
|
||||
((p_data->set_visibility.disc_mode & ~BTA_DM_LE_IGNORE) | le_disc_mode);
|
||||
}
|
||||
|
||||
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
|
||||
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
|
||||
p_data->set_visibility.disc_mode =
|
||||
((p_data->set_visibility.disc_mode & ~BTA_DM_IGNORE) | disc_mode);
|
||||
}
|
||||
|
||||
BTM_SetDiscoverability(p_data->set_visibility.disc_mode,
|
||||
bta_dm_cb.inquiry_scan_window,
|
||||
|
@ -649,13 +652,15 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
|
|||
}
|
||||
|
||||
if (p_data->set_visibility.conn_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
||||
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
|
||||
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
|
||||
p_data->set_visibility.conn_mode =
|
||||
((p_data->set_visibility.conn_mode & ~BTA_DM_LE_IGNORE) | le_conn_mode);
|
||||
}
|
||||
|
||||
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
|
||||
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
|
||||
p_data->set_visibility.conn_mode =
|
||||
((p_data->set_visibility.conn_mode & ~BTA_DM_IGNORE) | conn_mode);
|
||||
}
|
||||
|
||||
BTM_SetConnectability(p_data->set_visibility.conn_mode,
|
||||
bta_dm_cb.page_scan_window,
|
||||
|
@ -1885,10 +1890,12 @@ void bta_dm_disc_result (tBTA_DM_MSG *p_data)
|
|||
|
||||
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
|
||||
/* if any BR/EDR service discovery has been done, report the event */
|
||||
if ((bta_dm_search_cb.services & ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK ) & ~BTA_BLE_SERVICE_MASK)))
|
||||
#endif
|
||||
if ((bta_dm_search_cb.services & ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK ) & ~BTA_BLE_SERVICE_MASK))) {
|
||||
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
|
||||
|
||||
}
|
||||
#else
|
||||
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
|
||||
#endif
|
||||
tBTA_DM_MSG *p_msg = (tBTA_DM_MSG *) osi_malloc(sizeof(tBTA_DM_MSG));
|
||||
|
||||
/* send a message to change state */
|
||||
|
@ -2154,9 +2161,10 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
|
|||
}
|
||||
|
||||
/* last one? clear the BLE service bit if all discovery has been done */
|
||||
if (bta_dm_search_cb.uuid_to_search == 0)
|
||||
if (bta_dm_search_cb.uuid_to_search == 0) {
|
||||
bta_dm_search_cb.services_to_search &=
|
||||
(tBTA_SERVICE_MASK)(~(BTA_SERVICE_ID_TO_SERVICE_MASK(bta_dm_search_cb.service_index)));
|
||||
}
|
||||
|
||||
} else
|
||||
#endif
|
||||
|
@ -2666,9 +2674,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if (BT_SSP_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_pinname_cback
|
||||
|
@ -2725,6 +2731,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
|
|||
bta_dm_cb.p_sec_cback(event, &sec_event);
|
||||
}
|
||||
}
|
||||
#endif /// BT_SSP_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -2744,18 +2751,6 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
|
|||
return BTM_NOT_AUTHORIZED;
|
||||
}
|
||||
|
||||
/* If the device name is not known, save bdaddr and devclass and initiate a name request */
|
||||
if (bd_name[0] == 0) {
|
||||
bta_dm_cb.pin_evt = BTA_DM_PIN_REQ_EVT;
|
||||
bdcpy(bta_dm_cb.pin_bd_addr, bd_addr);
|
||||
BTA_COPY_DEVICE_CLASS(bta_dm_cb.pin_dev_class, dev_class);
|
||||
if ((BTM_ReadRemoteDeviceName(bd_addr, bta_dm_pinname_cback, BT_TRANSPORT_BR_EDR)) == BTM_CMD_STARTED) {
|
||||
return BTM_CMD_STARTED;
|
||||
}
|
||||
|
||||
APPL_TRACE_WARNING(" bta_dm_pin_cback() -> Failed to start Remote Name Request ");
|
||||
}
|
||||
|
||||
bdcpy(sec_event.pin_req.bd_addr, bd_addr);
|
||||
BTA_COPY_DEVICE_CLASS(sec_event.pin_req.dev_class, dev_class);
|
||||
BCM_STRNCPY_S((char *)sec_event.pin_req.bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
|
||||
|
@ -3652,11 +3647,11 @@ static char *bta_dm_get_remname(void)
|
|||
char *p_temp;
|
||||
|
||||
/* If the name isn't already stored, try retrieving from BTM */
|
||||
if (*p_name == '\0')
|
||||
if (*p_name == '\0') {
|
||||
if ((p_temp = BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr)) != NULL) {
|
||||
p_name = p_temp;
|
||||
}
|
||||
|
||||
}
|
||||
return p_name;
|
||||
}
|
||||
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
|
||||
|
@ -4271,6 +4266,28 @@ static void bta_dm_observe_cmpl_cb (void *p_result)
|
|||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_observe_discard_cb
|
||||
**
|
||||
** Description Callback for BLE Observe lost
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static void bta_dm_observe_discard_cb (uint32_t num_dis)
|
||||
{
|
||||
tBTA_DM_SEARCH data;
|
||||
|
||||
APPL_TRACE_DEBUG("bta_dm_observe_discard_cb");
|
||||
|
||||
data.inq_dis.num_dis = num_dis;
|
||||
if (bta_dm_search_cb.p_scan_cback) {
|
||||
bta_dm_search_cb.p_scan_cback(BTA_DM_INQ_DISCARD_NUM_EVT, &data);
|
||||
}
|
||||
}
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -4296,9 +4313,6 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
|
|||
switch (event) {
|
||||
case BTM_LE_IO_REQ_EVT: {
|
||||
// #if (BT_SSP_INCLUDED == TRUE)
|
||||
UINT8 enable = bta_dm_co_ble_get_accept_auth_enable();
|
||||
UINT8 origin_auth = bta_dm_co_ble_get_auth_req();
|
||||
BTM_BleSetAcceptAuthMode(enable, origin_auth);
|
||||
bta_dm_co_ble_io_req(bda,
|
||||
&p_data->io_req.io_cap,
|
||||
&p_data->io_req.oob_data,
|
||||
|
@ -4478,7 +4492,8 @@ void bta_dm_add_ble_device (tBTA_DM_MSG *p_data)
|
|||
{
|
||||
if (!BTM_SecAddBleDevice (p_data->add_ble_device.bd_addr, NULL,
|
||||
p_data->add_ble_device.dev_type ,
|
||||
p_data->add_ble_device.addr_type)) {
|
||||
p_data->add_ble_device.addr_type,
|
||||
p_data->add_ble_device.auth_mode)) {
|
||||
APPL_TRACE_ERROR ("BTA_DM: Error adding BLE Device for device %08x%04x",
|
||||
(p_data->add_ble_device.bd_addr[0] << 24) + (p_data->add_ble_device.bd_addr[1] << 16) + \
|
||||
(p_data->add_ble_device.bd_addr[2] << 8) + p_data->add_ble_device.bd_addr[3],
|
||||
|
@ -4804,7 +4819,7 @@ void bta_dm_ble_scan (tBTA_DM_MSG *p_data)
|
|||
bta_dm_search_cb.p_scan_cback = p_data->ble_scan.p_cback;
|
||||
|
||||
if ((status = BTM_BleScan(TRUE, p_data->ble_scan.duration,
|
||||
bta_dm_observe_results_cb, bta_dm_observe_cmpl_cb)) != BTM_CMD_STARTED) {
|
||||
bta_dm_observe_results_cb, bta_dm_observe_cmpl_cb, bta_dm_observe_discard_cb)) != BTM_CMD_STARTED) {
|
||||
APPL_TRACE_WARNING(" %s start scan failed. status=0x%x\n", __FUNCTION__, status);
|
||||
}
|
||||
|
||||
|
@ -4814,7 +4829,7 @@ void bta_dm_ble_scan (tBTA_DM_MSG *p_data)
|
|||
}
|
||||
} else {
|
||||
bta_dm_search_cb.p_scan_cback = NULL;
|
||||
status = BTM_BleScan(FALSE, 0, NULL, NULL);
|
||||
status = BTM_BleScan(FALSE, 0, NULL, NULL, NULL);
|
||||
|
||||
if (status != BTM_CMD_STARTED){
|
||||
APPL_TRACE_WARNING(" %s stop scan failed, status=0x%x\n", __FUNCTION__, status);
|
||||
|
@ -4871,6 +4886,22 @@ void bta_dm_ble_set_adv_params_all (tBTA_DM_MSG *p_data)
|
|||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_ble_update_duplicate_exceptional_list
|
||||
**
|
||||
** Description This function is to update duplicate scan exceptional list
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_UpdateBleDuplicateExceptionalList(p_data->ble_duplicate_exceptional_list.subcode,
|
||||
p_data->ble_duplicate_exceptional_list.type,
|
||||
p_data->ble_duplicate_exceptional_list.device_info,
|
||||
p_data->ble_duplicate_exceptional_list.exceptional_list_cb);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_ble_set_adv_config
|
||||
|
@ -5157,9 +5188,10 @@ void bta_dm_ble_setup_storage (tBTA_DM_MSG *p_data)
|
|||
p_data->ble_set_storage.ref_value);
|
||||
}
|
||||
|
||||
if (BTM_CMD_STARTED != btm_status)
|
||||
if (BTM_CMD_STARTED != btm_status) {
|
||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_CFG_STRG_EVT, p_data->ble_set_storage.ref_value,
|
||||
btm_status);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -5187,9 +5219,10 @@ void bta_dm_ble_enable_batch_scan (tBTA_DM_MSG *p_data)
|
|||
p_data->ble_enable_scan.ref_value);
|
||||
}
|
||||
|
||||
if (BTM_CMD_STARTED != btm_status)
|
||||
if (BTM_CMD_STARTED != btm_status) {
|
||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_ENABLE_EVT, p_data->ble_enable_scan.ref_value,
|
||||
btm_status);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -5213,9 +5246,10 @@ void bta_dm_ble_disable_batch_scan (tBTA_DM_MSG *p_data)
|
|||
btm_status = BTM_BleDisableBatchScan(p_data->ble_disable_scan.ref_value);
|
||||
}
|
||||
|
||||
if (BTM_CMD_STARTED != btm_status)
|
||||
if (BTM_CMD_STARTED != btm_status) {
|
||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_DISABLE_EVT, p_data->ble_enable_scan.ref_value,
|
||||
btm_status);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -5239,9 +5273,10 @@ void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data)
|
|||
p_data->ble_read_reports.ref_value);
|
||||
}
|
||||
|
||||
if (BTM_CMD_STARTED != btm_status)
|
||||
if (BTM_CMD_STARTED != btm_status) {
|
||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_READ_REPTS_EVT, p_data->ble_enable_scan.ref_value,
|
||||
btm_status);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -5371,10 +5406,11 @@ void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data)
|
|||
}
|
||||
}
|
||||
|
||||
if (p_data->ble_cfg_filter_cond.p_filt_cfg_cback)
|
||||
if (p_data->ble_cfg_filter_cond.p_filt_cfg_cback) {
|
||||
p_data->ble_cfg_filter_cond.p_filt_cfg_cback(BTA_DM_BLE_PF_CONFIG_EVT,
|
||||
p_data->ble_cfg_filter_cond.cond_type, 0, status,
|
||||
p_data->ble_cfg_filter_cond.ref_value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5405,9 +5441,10 @@ void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (p_data->ble_enable_scan_filt.p_filt_status_cback)
|
||||
if (p_data->ble_enable_scan_filt.p_filt_status_cback) {
|
||||
p_data->ble_enable_scan_filt.p_filt_status_cback (BTA_DM_BLE_PF_ENABLE_EVT,
|
||||
p_data->ble_enable_scan_filt.ref_value, status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -5441,9 +5478,10 @@ void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data)
|
|||
}
|
||||
}
|
||||
|
||||
if (p_data->ble_scan_filt_param_setup.p_filt_param_cback)
|
||||
if (p_data->ble_scan_filt_param_setup.p_filt_param_cback) {
|
||||
p_data->ble_scan_filt_param_setup.p_filt_param_cback (BTA_DM_BLE_PF_ENABLE_EVT, 0,
|
||||
p_data->ble_scan_filt_param_setup.ref_value, status);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -5753,6 +5791,8 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN *p_data)
|
|||
((p2[0]) << 24) + ((p2[1]) << 16) + ((p2[2]) << 8) + (p2[3]),
|
||||
((p2[4]) << 8) + p2[5]);
|
||||
|
||||
UNUSED(p1);
|
||||
UNUSED(p2);
|
||||
APPL_TRACE_DEBUG("BTA_GATTC_OPEN_EVT conn_id = %d client_if=%d status = %d" ,
|
||||
p_data->conn_id,
|
||||
p_data->client_if,
|
||||
|
|
|
@ -797,12 +797,13 @@ void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key, tBTA_LE_KEY_
|
|||
**
|
||||
** Parameters: bd_addr - BD address of the peer
|
||||
** dev_type - Remote device's device type.
|
||||
** auth_mode - auth mode
|
||||
** addr_type - LE device address type.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TYPE dev_type)
|
||||
void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, int auth_mode, tBT_DEVICE_TYPE dev_type)
|
||||
{
|
||||
tBTA_DM_API_ADD_BLE_DEVICE *p_msg;
|
||||
|
||||
|
@ -812,6 +813,7 @@ void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TY
|
|||
p_msg->hdr.event = BTA_DM_API_ADD_BLEDEVICE_EVT;
|
||||
bdcpy(p_msg->bd_addr, bd_addr);
|
||||
p_msg->addr_type = addr_type;
|
||||
p_msg->auth_mode = auth_mode;
|
||||
p_msg->dev_type = dev_type;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
|
@ -1256,6 +1258,34 @@ void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
|
|||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmUpdateDuplicateExceptionalList
|
||||
**
|
||||
** Description This function is called to update duplicate scan exceptional list
|
||||
**
|
||||
** Parameters subcode : add, remove or clean duplicate scan exceptional list.
|
||||
** type : device info type.
|
||||
** device_info: device info
|
||||
** p_update_duplicate_ignore_list_cback : update complete callback.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type, BD_ADDR device_info, tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback)
|
||||
{
|
||||
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST *p_msg;
|
||||
if ((p_msg = (tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST *)osi_malloc(sizeof(tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT;
|
||||
p_msg->subcode = subcode;
|
||||
p_msg->type = type;
|
||||
p_msg->exceptional_list_cb = p_update_duplicate_exceptional_list_cback;
|
||||
memcpy(p_msg->device_info, device_info, sizeof(BD_ADDR));
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetStorageParams
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "bta/bta_sys.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "bta_dm_int.h"
|
||||
// #include "bta/bta_jv_api.h"
|
||||
#include "bta/bta_jv_api.h"
|
||||
|
||||
#ifndef BTA_DM_LINK_POLICY_SETTINGS
|
||||
#define BTA_DM_LINK_POLICY_SETTINGS (HCI_ENABLE_MASTER_SLAVE_SWITCH | HCI_ENABLE_HOLD_MODE | HCI_ENABLE_SNIFF_MODE | HCI_ENABLE_PARK_MODE)
|
||||
|
@ -116,11 +116,11 @@ tBTA_DM_CFG *p_bta_dm_cfg = (tBTA_DM_CFG *) &bta_dm_cfg;
|
|||
tBTA_DM_RM *p_bta_dm_rm_cfg = (tBTA_DM_RM *) &bta_dm_rm_cfg;
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
# define BTA_DM_NUM_PM_ENTRY 8 /* number of entries in bta_dm_pm_cfg except the first */
|
||||
# define BTA_DM_NUM_PM_SPEC 8 /* number of entries in bta_dm_pm_spec */
|
||||
#else
|
||||
# define BTA_DM_NUM_PM_ENTRY 6 /* number of entries in bta_dm_pm_cfg except the first */
|
||||
# define BTA_DM_NUM_PM_SPEC 6 /* number of entries in bta_dm_pm_spec */
|
||||
#else
|
||||
# define BTA_DM_NUM_PM_ENTRY 4 /* number of entries in bta_dm_pm_cfg except the first */
|
||||
# define BTA_DM_NUM_PM_SPEC 4 /* number of entries in bta_dm_pm_spec */
|
||||
#endif
|
||||
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
|
@ -129,11 +129,13 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG bta_dm_pm_cfg[BTA_DM_NUM_PM_ENTRY + 1]
|
|||
{BTA_ID_SYS, BTA_DM_NUM_PM_ENTRY, 0}, /* reserved: specifies length of this table. */
|
||||
{BTA_ID_AG, BTA_ALL_APP_ID, 0}, /* ag uses first spec table for app id 0 */
|
||||
{BTA_ID_AV, BTA_ALL_APP_ID, 1}, /* av spec table */
|
||||
{BTA_ID_HS, BTA_ALL_APP_ID, 2}, /* HS spec table */
|
||||
{BTA_ID_AVK, BTA_ALL_APP_ID, 3} /* avk spec table */
|
||||
{BTA_ID_JV, BTA_APP_ID_1, 2}, /* app BTA_JV_PM_ID_1, reuse ftc spec table */
|
||||
{BTA_ID_JV, BTA_ALL_APP_ID, 3}, /* reuse fts spec table */
|
||||
{BTA_ID_HS, BTA_ALL_APP_ID, 4}, /* HS spec table */
|
||||
{BTA_ID_AVK, BTA_ALL_APP_ID, 5} /* avk spec table */
|
||||
#if BLE_INCLUDED == TRUE
|
||||
, {BTA_ID_GATTC, BTA_ALL_APP_ID, 4} /* gattc spec table */
|
||||
, {BTA_ID_GATTS, BTA_ALL_APP_ID, 5} /* gatts spec table */
|
||||
, {BTA_ID_GATTC, BTA_ALL_APP_ID, 6} /* gattc spec table */
|
||||
, {BTA_ID_GATTS, BTA_ALL_APP_ID, 7} /* gatts spec table */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -177,7 +179,45 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
|
|||
}
|
||||
},
|
||||
|
||||
/* HS : 2 */
|
||||
/* FTC, OPC, JV : 2 */
|
||||
{
|
||||
(BTA_DM_PM_SNIFF), /* allow sniff */
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
(BTA_DM_PM_SSR2), /* the SSR entry */
|
||||
#endif
|
||||
{
|
||||
{{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */
|
||||
{{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
|
||||
{{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
|
||||
{{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
|
||||
{{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
|
||||
}
|
||||
},
|
||||
|
||||
/* FTS, PBS, OPS, MSE, BTA_JV_PM_ID_1 : 3 */
|
||||
{
|
||||
(BTA_DM_PM_SNIFF), /* allow sniff */
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
(BTA_DM_PM_SSR2), /* the SSR entry */
|
||||
#endif
|
||||
{
|
||||
{{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */
|
||||
{{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
|
||||
{{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */
|
||||
{{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
|
||||
{{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
|
||||
}
|
||||
},
|
||||
|
||||
/* HS : 4 */
|
||||
{
|
||||
(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
|
@ -196,7 +236,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
|
|||
}
|
||||
},
|
||||
|
||||
/* AVK : 3 */
|
||||
/* AVK : 5 */
|
||||
{
|
||||
(BTA_DM_PM_SNIFF), /* allow sniff */
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
|
@ -216,7 +256,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
|
|||
}
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
/* GATTC : 4 */
|
||||
/* GATTC : 6 */
|
||||
, {
|
||||
(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
|
@ -237,7 +277,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
|
|||
{{BTA_DM_PM_RETRY, 5000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
|
||||
}
|
||||
}
|
||||
/* GATTS : 5 */
|
||||
/* GATTS : 7 */
|
||||
, {
|
||||
(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
|
||||
#if (BTM_SSR_INCLUDED == TRUE)
|
||||
|
|
|
@ -157,6 +157,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
|||
bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */
|
||||
bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */
|
||||
bta_dm_ble_read_rssi, /* BTA_DM_API_BLE_READ_RSSI_EVT */
|
||||
bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1038,9 +1038,10 @@ static void bta_dm_pm_hid_check(BOOLEAN bScoActive)
|
|||
bta_dm_pm_set_sniff_policy( bta_dm_find_peer_device(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr), bScoActive);
|
||||
|
||||
/* if we had disabled link policy, seems like the hid device stop retrying SNIFF after a few tries. force sniff if needed */
|
||||
if (!bScoActive)
|
||||
if (!bScoActive) {
|
||||
bta_dm_pm_set_mode(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr, BTA_DM_PM_NO_ACTION,
|
||||
BTA_DM_PM_RESTART);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ enum {
|
|||
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
|
||||
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
|
||||
BTA_DM_API_BLE_READ_RSSI_EVT,
|
||||
BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
|
||||
|
@ -193,6 +194,14 @@ typedef struct {
|
|||
tBTA_ADD_WHITELIST_CBACK *add_wl_cb;
|
||||
}tBTA_DM_API_UPDATE_WHITE_LIST;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 subcode;
|
||||
UINT32 type;
|
||||
BD_ADDR device_info;
|
||||
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *exceptional_list_cb;
|
||||
}tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_CMPL_CB *read_tx_power_cb;
|
||||
|
@ -445,6 +454,7 @@ typedef struct {
|
|||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
tBT_DEVICE_TYPE dev_type ;
|
||||
UINT32 auth_mode;
|
||||
tBLE_ADDR_TYPE addr_type;
|
||||
|
||||
} tBTA_DM_API_ADD_BLE_DEVICE;
|
||||
|
@ -847,6 +857,7 @@ typedef union {
|
|||
tBTA_DM_API_TRACK_ADVERTISER ble_track_advert;
|
||||
tBTA_DM_API_ENERGY_INFO ble_energy_info;
|
||||
tBTA_DM_API_BLE_DISCONNECT ble_disconnect;
|
||||
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST ble_duplicate_exceptional_list;
|
||||
#endif
|
||||
|
||||
tBTA_DM_API_REMOVE_ACL remove_acl;
|
||||
|
@ -1242,7 +1253,7 @@ 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_set_data_length(tBTA_DM_MSG *p_data);
|
||||
|
||||
extern void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data);
|
||||
#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);
|
||||
|
|
|
@ -531,7 +531,9 @@ void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg
|
|||
if (bta_gattc_mark_bg_conn(p_data->client_if, p_data->remote_bda, TRUE, FALSE)) {
|
||||
/* 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)) {
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
uint8_t *bda = (uint8_t *)p_data->remote_bda;
|
||||
#endif
|
||||
status = BTA_GATT_ERROR;
|
||||
APPL_TRACE_ERROR("%s unable to connect to remote bd_addr:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
__func__, bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
|
||||
|
@ -674,7 +676,7 @@ void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
|||
bta_gattc_reset_discover_st(p_clcb->p_srcb, BTA_GATT_OK);
|
||||
//register service change
|
||||
bta_gattc_register_service_change_notify(p_clcb->bta_conn_id, p_clcb->bda);
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{ /* cache is building */
|
||||
p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC;
|
||||
|
@ -1071,8 +1073,9 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
|||
*******************************************************************************/
|
||||
void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
{
|
||||
if (!bta_gattc_enqueue(p_clcb, p_data))
|
||||
if (!bta_gattc_enqueue(p_clcb, p_data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
tGATT_READ_PARAM read_param;
|
||||
memset (&read_param, 0 ,sizeof(tGATT_READ_PARAM));
|
||||
|
@ -1140,8 +1143,9 @@ void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
|||
*******************************************************************************/
|
||||
void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
{
|
||||
if (!bta_gattc_enqueue(p_clcb, p_data))
|
||||
if (!bta_gattc_enqueue(p_clcb, p_data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
tBTA_GATT_STATUS status = BTA_GATT_OK;
|
||||
tGATT_VALUE attr;
|
||||
|
@ -1742,7 +1746,7 @@ void bta_gattc_process_api_cache_assoc(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_m
|
|||
tBTA_GATTC gattc_cb = {0};
|
||||
gattc_cb.set_assoc.client_if = p_msg->api_assoc.client_if;
|
||||
BOOLEAN state = FALSE;
|
||||
tBTA_GATTC_CLCB *p_assoc_clcb = bta_gattc_find_clcb_by_cif(p_msg->api_assoc.client_if,
|
||||
tBTA_GATTC_CLCB *p_assoc_clcb = bta_gattc_find_clcb_by_cif(p_msg->api_assoc.client_if,
|
||||
p_msg->api_assoc.assoc_addr, BTA_TRANSPORT_LE);
|
||||
tBTA_GATTC_RCB *p_clrcb = bta_gattc_cl_get_regcb(p_msg->api_assoc.client_if);
|
||||
if (p_assoc_clcb != NULL) {
|
||||
|
@ -1783,7 +1787,7 @@ void bta_gattc_process_api_cache_assoc(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_m
|
|||
}
|
||||
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
void bta_gattc_process_api_cache_get_addr_list(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ static char *bta_gattc_attr_type[] = {
|
|||
};
|
||||
/* utility functions */
|
||||
|
||||
bool display_cache_attribute(void *data, void *context)
|
||||
bool display_cache_attribute(void *data, void *context)
|
||||
{
|
||||
//tBTA_GATTC_CACHE_ATTR *p_attr = data;
|
||||
//APPL_TRACE_ERROR("\t Attr handle[%d] uuid[0x%04x] type[%s] prop[0x%1x]",
|
||||
|
@ -102,7 +102,7 @@ bool display_cache_attribute(void *data, void *context)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool display_cache_service(void *data, void *context)
|
||||
bool display_cache_service(void *data, void *context)
|
||||
{
|
||||
tBTA_GATTC_SERVICE *p_cur_srvc = data;
|
||||
APPL_TRACE_API("Service: handle[%d ~ %d] %s[0x%04x] inst[%d]",
|
||||
|
@ -213,9 +213,9 @@ static void bta_gattc_free(void *ptr)
|
|||
osi_free(ptr);
|
||||
}
|
||||
|
||||
void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE *p_new_srvc)
|
||||
void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE *p_new_srvc)
|
||||
{
|
||||
// services/p_new_srvc is NULL
|
||||
// services/p_new_srvc is NULL
|
||||
if (!services || !p_new_srvc) {
|
||||
APPL_TRACE_ERROR("%s services/p_new_srvc is NULL", __func__);
|
||||
return;
|
||||
|
@ -243,7 +243,7 @@ void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,8 +314,9 @@ static tBTA_GATT_STATUS bta_gattc_add_char_to_cache(tBTA_GATTC_SERV *p_srvc_cb,
|
|||
/* TODO(jpawlowski): We should use attribute handle, not value handle to refer to characteristic.
|
||||
This is just a temporary workaround.
|
||||
*/
|
||||
if (service->e_handle < value_handle)
|
||||
if (service->e_handle < value_handle) {
|
||||
service->e_handle = value_handle;
|
||||
}
|
||||
|
||||
tBTA_GATTC_CHARACTERISTIC *characteristic = osi_malloc(sizeof(tBTA_GATTC_CHARACTERISTIC));
|
||||
if (!characteristic) {
|
||||
|
@ -554,10 +555,10 @@ void bta_gattc_update_include_service(const list_t *services) {
|
|||
if(include_service && !include_service->included_service) {
|
||||
//update
|
||||
include_service->included_service = bta_gattc_find_matching_service(services, include_service->incl_srvc_s_handle);
|
||||
if(!include_service->included_service) {
|
||||
if(!include_service->included_service) {
|
||||
//not match, free it
|
||||
list_remove(service->included_svc, include_service);
|
||||
osi_free(include_service);
|
||||
osi_free(include_service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -980,12 +981,13 @@ void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_
|
|||
p_data->value.incl_service.e_handle,
|
||||
p_data->value.incl_service.service_type);
|
||||
|
||||
if (!pri_srvc)
|
||||
if (!pri_srvc) {
|
||||
bta_gattc_add_srvc_to_list(p_srvc_cb,
|
||||
p_data->value.incl_service.s_handle,
|
||||
p_data->value.incl_service.e_handle,
|
||||
p_data->value.incl_service.service_type,
|
||||
FALSE);
|
||||
}
|
||||
/* add into database */
|
||||
bta_gattc_add_attr_to_cache(p_srvc_cb,
|
||||
p_data->handle,
|
||||
|
@ -1007,8 +1009,8 @@ void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_
|
|||
|
||||
case GATT_DISC_CHAR_DSCPT:
|
||||
bta_gattc_add_attr_to_cache(p_srvc_cb,
|
||||
p_data->handle,
|
||||
&p_data->type,
|
||||
p_data->handle,
|
||||
&p_data->type,
|
||||
0,
|
||||
0 /* incl_srvc_s_handle */,
|
||||
0 /* incl_srvc_e_handle */,
|
||||
|
@ -1023,8 +1025,9 @@ void bta_gattc_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT
|
|||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
if ( p_clcb && (status != GATT_SUCCESS || p_clcb->status != GATT_SUCCESS) ) {
|
||||
if (status == GATT_SUCCESS)
|
||||
if (status == GATT_SUCCESS) {
|
||||
p_clcb->status = status;
|
||||
}
|
||||
bta_gattc_sm_execute(p_clcb, BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
|
||||
return;
|
||||
}
|
||||
|
@ -1071,15 +1074,17 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
|
|||
{
|
||||
tBTA_GATTC cb_data;
|
||||
|
||||
if (!p_clcb->p_srcb->p_srvc_cache || list_is_empty(p_clcb->p_srcb->p_srvc_cache))
|
||||
if (!p_clcb->p_srcb->p_srvc_cache || list_is_empty(p_clcb->p_srcb->p_srvc_cache)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (list_node_t *sn = list_begin(p_clcb->p_srcb->p_srvc_cache);
|
||||
sn != list_end(p_clcb->p_srcb->p_srvc_cache); sn = list_next(sn)) {
|
||||
tBTA_GATTC_SERVICE *p_cache = list_node(sn);
|
||||
|
||||
if (!bta_gattc_uuid_compare(p_uuid, &p_cache->uuid, FALSE))
|
||||
if (!bta_gattc_uuid_compare(p_uuid, &p_cache->uuid, FALSE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#if (defined BTA_GATT_DEBUG && BTA_GATT_DEBUG == TRUE)
|
||||
APPL_TRACE_DEBUG("found service [0x%04x], inst[%d] handle [%d]",
|
||||
|
@ -1087,8 +1092,9 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
|
|||
p_cache->handle,
|
||||
p_cache->s_handle);
|
||||
#endif
|
||||
if (!p_clcb->p_rcb->p_cback)
|
||||
if (!p_clcb->p_rcb->p_cback) {
|
||||
continue;
|
||||
}
|
||||
|
||||
memset(&cb_data, 0, sizeof(tBTA_GATTC));
|
||||
|
||||
|
@ -1103,8 +1109,9 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
|
|||
}
|
||||
|
||||
list_t* bta_gattc_get_services_srcb(tBTA_GATTC_SERV *p_srcb) {
|
||||
if (!p_srcb || !p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache))
|
||||
if (!p_srcb || !p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return p_srcb->p_srvc_cache;
|
||||
}
|
||||
|
@ -1112,8 +1119,9 @@ list_t* bta_gattc_get_services_srcb(tBTA_GATTC_SERV *p_srcb) {
|
|||
const list_t* bta_gattc_get_services(UINT16 conn_id) {
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
if (p_clcb == NULL )
|
||||
if (p_clcb == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||
|
||||
|
@ -1121,63 +1129,68 @@ const list_t* bta_gattc_get_services(UINT16 conn_id) {
|
|||
}
|
||||
|
||||
tBTA_GATTC_SERVICE* bta_gattc_find_matching_service(const list_t *services, UINT16 handle) {
|
||||
if (!services || list_is_empty(services))
|
||||
if (!services || list_is_empty(services)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (list_node_t *sn = list_begin(services);
|
||||
sn != list_end(services); sn = list_next(sn)) {
|
||||
tBTA_GATTC_SERVICE *service = list_node(sn);
|
||||
|
||||
if (handle >= service->s_handle && handle <= service->e_handle)
|
||||
if (handle >= service->s_handle && handle <= service->e_handle) {
|
||||
return service;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
|
||||
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
|
||||
{
|
||||
const list_t *services = bta_gattc_get_services_srcb(p_srcb);
|
||||
|
||||
return bta_gattc_find_matching_service(services, handle);
|
||||
}
|
||||
|
||||
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle)
|
||||
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle)
|
||||
{
|
||||
const list_t *services = bta_gattc_get_services(conn_id);
|
||||
|
||||
return bta_gattc_find_matching_service(services, handle);
|
||||
}
|
||||
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
|
||||
{
|
||||
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
|
||||
|
||||
if (!service)
|
||||
if (!service) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (list_node_t *cn = list_begin(service->characteristics);
|
||||
cn != list_end(service->characteristics); cn = list_next(cn)) {
|
||||
tBTA_GATTC_CHARACTERISTIC *p_char = list_node(cn);
|
||||
if (handle == p_char->handle)
|
||||
if (handle == p_char->handle) {
|
||||
return p_char;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle)
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
if (p_clcb == NULL )
|
||||
if (p_clcb == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||
return bta_gattc_get_characteristic_srcb(p_srcb, handle);
|
||||
}
|
||||
|
||||
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
|
||||
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
|
||||
{
|
||||
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
|
||||
|
||||
|
@ -1191,20 +1204,22 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, U
|
|||
for (list_node_t *dn = list_begin(p_char->descriptors);
|
||||
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
||||
tBTA_GATTC_DESCRIPTOR *p_desc = list_node(dn);
|
||||
if (handle == p_desc->handle)
|
||||
if (handle == p_desc->handle) {
|
||||
return p_desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
|
||||
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
if (p_clcb == NULL )
|
||||
if (p_clcb == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||
return bta_gattc_get_descriptor_srcb(p_srcb, handle);
|
||||
|
@ -1443,7 +1458,7 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1476,7 +1491,7 @@ static size_t bta_gattc_get_db_size_with_type(list_t *services,
|
|||
}
|
||||
|
||||
if (type == BTGATT_DB_PRIMARY_SERVICE || type == BTGATT_DB_SECONDARY_SERVICE) {
|
||||
if ((type == BTGATT_DB_PRIMARY_SERVICE && p_cur_srvc->is_primary) ||
|
||||
if ((type == BTGATT_DB_PRIMARY_SERVICE && p_cur_srvc->is_primary) ||
|
||||
(type == BTGATT_DB_SECONDARY_SERVICE && !p_cur_srvc->is_primary)) {
|
||||
// if the current service is the last service in the db, need to ensure the current service start handle is not less than the start_handle.
|
||||
if (!svc_length) {
|
||||
|
@ -1572,10 +1587,11 @@ static size_t bta_gattc_get_db_size_with_type(list_t *services,
|
|||
** Returns number of elements inside db from start_handle to end_handle
|
||||
*******************************************************************************/
|
||||
static size_t bta_gattc_get_db_size(list_t *services,
|
||||
UINT16 start_handle, UINT16 end_handle)
|
||||
UINT16 start_handle, UINT16 end_handle)
|
||||
{
|
||||
if (!services || list_is_empty(services))
|
||||
if (!services || list_is_empty(services)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t db_size = 0;
|
||||
UINT16 svc_length = list_length(services) - 1;
|
||||
|
@ -1598,9 +1614,10 @@ static size_t bta_gattc_get_db_size(list_t *services,
|
|||
} else {
|
||||
db_size++;
|
||||
}
|
||||
|
||||
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics))
|
||||
|
||||
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
|
||||
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
|
||||
|
@ -1657,7 +1674,7 @@ void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 en
|
|||
*count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||
if (!p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
|
||||
*count = 0;
|
||||
|
@ -1676,7 +1693,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
|
|||
*count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||
if (!p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
|
||||
*count = 0;
|
||||
|
@ -1694,7 +1711,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
|
|||
}
|
||||
}
|
||||
*count = bta_gattc_get_db_size_with_type(p_srcb->p_srvc_cache, type, NULL, start_handle, end_handle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1786,8 +1803,9 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
|||
p_char->properties);
|
||||
curr_db_attr++;
|
||||
|
||||
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
|
||||
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (list_node_t *dn = list_begin(p_char->descriptors);
|
||||
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
||||
|
@ -1815,8 +1833,9 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
|||
}
|
||||
}
|
||||
|
||||
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc))
|
||||
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (list_node_t *isn = list_begin(p_cur_srvc->included_svc);
|
||||
isn != list_end(p_cur_srvc->included_svc); isn = list_next(isn)) {
|
||||
|
@ -1983,8 +2002,9 @@ void bta_gattc_fill_nv_attr(tBTA_GATTC_NV_ATTR *p_attr, UINT8 type, UINT16 s_han
|
|||
*******************************************************************************/
|
||||
void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
||||
{
|
||||
if (!p_srvc_cb->p_srvc_cache || list_is_empty(p_srvc_cb->p_srvc_cache))
|
||||
if (!p_srvc_cb->p_srvc_cache || list_is_empty(p_srvc_cb->p_srvc_cache)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
size_t db_size = bta_gattc_get_db_size(p_srvc_cb->p_srvc_cache, 0x0000, 0xFFFF);
|
||||
|
@ -2017,8 +2037,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
|||
sn != list_end(p_srvc_cb->p_srvc_cache); sn = list_next(sn)) {
|
||||
tBTA_GATTC_SERVICE *p_cur_srvc = list_node(sn);
|
||||
|
||||
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics))
|
||||
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
|
||||
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
|
||||
|
@ -2034,8 +2055,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
|||
0 /* incl_srvc_e_handle */,
|
||||
FALSE);
|
||||
|
||||
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
|
||||
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (list_node_t *dn = list_begin(p_char->descriptors);
|
||||
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
||||
|
@ -2053,8 +2075,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
|||
}
|
||||
}
|
||||
|
||||
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc))
|
||||
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (list_node_t *an = list_begin(p_cur_srvc->included_svc);
|
||||
an != list_end(p_cur_srvc->included_svc); an = list_next(an)) {
|
||||
|
|
|
@ -261,14 +261,18 @@ tBTA_GATT_STATUS bta_gattc_co_cache_open(BD_ADDR server_bda, BOOLEAN to_save, UI
|
|||
*******************************************************************************/
|
||||
tBTA_GATT_STATUS bta_gattc_co_cache_load(tBTA_GATTC_NV_ATTR *attr, UINT8 index)
|
||||
{
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
UINT16 num_attr = 0;
|
||||
#endif
|
||||
tBTA_GATT_STATUS status = BTA_GATT_ERROR;
|
||||
size_t length = 0;
|
||||
// Read the size of memory space required for blob
|
||||
nvs_get_blob(cache_env.cache_addr[index].cache_fp, cache_key, NULL, &length);
|
||||
// Read previously saved blob if available
|
||||
esp_err_t err_code = nvs_get_blob(cache_env.cache_addr[index].cache_fp, cache_key, attr, &length);
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
num_attr = length / sizeof(tBTA_GATTC_NV_ATTR);
|
||||
#endif
|
||||
status = (err_code == ESP_OK && length != 0) ? BTA_GATT_OK : BTA_GATT_ERROR;
|
||||
APPL_TRACE_DEBUG("%s() - read=%d, status=%d, err_code = %d",
|
||||
__func__, num_attr, status, err_code);
|
||||
|
@ -323,6 +327,9 @@ void bta_gattc_co_cache_save (BD_ADDR server_bda, UINT16 num_attr,
|
|||
status = BTA_GATT_ERROR;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_STACK_NO_LOG
|
||||
(void) status;
|
||||
#endif
|
||||
APPL_TRACE_DEBUG("%s() wrote hash_key = %x%x%x%x, num_attr = %d, status = %d.", __func__, hash_key[0], hash_key[1], hash_key[2], hash_key[3], num_attr, status);
|
||||
}
|
||||
|
||||
|
|
|
@ -416,8 +416,9 @@ tBTA_GATTC_SERV *bta_gattc_srcb_alloc(BD_ADDR bda)
|
|||
|
||||
if (p_tcb != NULL)
|
||||
{
|
||||
if (p_tcb->p_srvc_cache != NULL)
|
||||
if (p_tcb->p_srvc_cache != NULL) {
|
||||
list_free(p_tcb->p_srvc_cache);
|
||||
}
|
||||
osi_free(p_tcb->p_srvc_list);
|
||||
p_tcb->p_srvc_list = NULL;
|
||||
//osi_free_and_reset((void **)&p_tcb->p_srvc_list);
|
||||
|
@ -583,8 +584,9 @@ void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id,
|
|||
* clear boundaries are always around service.
|
||||
*/
|
||||
handle = p_clrcb->notif_reg[i].handle;
|
||||
if (handle >= start_handle && handle <= end_handle)
|
||||
if (handle >= start_handle && handle <= end_handle) {
|
||||
memset(&p_clrcb->notif_reg[i], 0, sizeof(tBTA_GATTC_NOTIF_REG));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -637,8 +639,9 @@ BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda
|
|||
}
|
||||
if (!add) {
|
||||
if (remote_bda_ptr) {
|
||||
// bdstr_t bdstr = {0};
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
char bdstr[18] = {0};
|
||||
#endif
|
||||
APPL_TRACE_ERROR("%s unable to find the bg connection mask for: %s", __func__,
|
||||
bdaddr_to_string((bt_bdaddr_t *)remote_bda_ptr, bdstr, sizeof(bdstr)));
|
||||
}
|
||||
|
@ -936,8 +939,9 @@ void bta_to_btif_uuid(bt_uuid_t *p_dest, tBT_UUID *p_src)
|
|||
|
||||
if (p_src->len == LEN_UUID_16 || p_src->len == LEN_UUID_32)
|
||||
{
|
||||
for(i=0; i != 16; ++i)
|
||||
for(i=0; i != 16; ++i) {
|
||||
p_dest->uu[i] = base_uuid[i];
|
||||
}
|
||||
}
|
||||
|
||||
switch (p_src->len)
|
||||
|
|
|
@ -403,7 +403,7 @@ void bta_gatts_add_char(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg)
|
|||
UINT16 attr_id = 0;
|
||||
tBTA_GATTS cb_data;
|
||||
|
||||
tGATT_ATTR_VAL *p_attr_val = NULL;
|
||||
tGATT_ATTR_VAL *p_attr_val = NULL;
|
||||
tGATTS_ATTR_CONTROL *p_control = NULL;
|
||||
|
||||
if(p_msg->api_add_char.attr_val.attr_max_len != 0){
|
||||
|
@ -665,17 +665,18 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
|||
&gatt_if, remote_bda, &transport)) {
|
||||
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
||||
|
||||
if (p_msg->api_indicate.need_confirm)
|
||||
if (p_msg->api_indicate.need_confirm) {
|
||||
|
||||
status = GATTS_HandleValueIndication (p_msg->api_indicate.hdr.layer_specific,
|
||||
p_msg->api_indicate.attr_id,
|
||||
p_msg->api_indicate.len,
|
||||
p_msg->api_indicate.value);
|
||||
else
|
||||
} else {
|
||||
status = GATTS_HandleValueNotification (p_msg->api_indicate.hdr.layer_specific,
|
||||
p_msg->api_indicate.attr_id,
|
||||
p_msg->api_indicate.len,
|
||||
p_msg->api_indicate.value);
|
||||
}
|
||||
|
||||
/* if over BR_EDR, inform PM for mode change */
|
||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||
|
@ -691,6 +692,7 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
|||
p_rcb && p_cb->rcb[p_srvc_cb->rcb_idx].p_cback) {
|
||||
cb_data.req_data.status = status;
|
||||
cb_data.req_data.conn_id = p_msg->api_indicate.hdr.layer_specific;
|
||||
cb_data.req_data.handle = p_msg->api_indicate.attr_id;
|
||||
|
||||
cb_data.req_data.value = (uint8_t *)osi_malloc(p_msg->api_indicate.len);
|
||||
if (cb_data.req_data.value != NULL){
|
||||
|
@ -850,13 +852,13 @@ void bta_gatts_send_service_change_indication (tBTA_GATTS_DATA *p_msg)
|
|||
memcpy(bd_addr, p_msg->api_send_service_change.remote_bda, BD_ADDR_LEN);
|
||||
status = GATT_SendServiceChangeIndication(bd_addr);
|
||||
} else {
|
||||
status = GATT_SendServiceChangeIndication(NULL);
|
||||
status = GATT_SendServiceChangeIndication(NULL);
|
||||
}
|
||||
if (p_rcb && p_rcb->p_cback) {
|
||||
service_change.status = status;
|
||||
service_change.server_if = p_msg->api_send_service_change.server_if;
|
||||
(*p_rcb->p_cback)(BTA_GATTS_SEND_SERVICE_CHANGE_EVT, (tBTA_GATTS *)&service_change);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -931,6 +933,9 @@ static void bta_gatts_send_request_cback (UINT16 conn_id,
|
|||
cb_data.req_data.trans_id = trans_id;
|
||||
cb_data.req_data.p_data = (tBTA_GATTS_REQ_DATA *)p_data;
|
||||
|
||||
if(req_type == BTA_GATTS_CONF_EVT) {
|
||||
cb_data.req_data.handle = p_data->handle;
|
||||
}
|
||||
(*p_rcb->p_cback)(req_type, &cb_data);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("connection request on gatt_if[%d] is not interested", gatt_if);
|
||||
|
|
|
@ -73,9 +73,11 @@ void bta_hf_client_register(tBTA_HF_CLIENT_DATA *p_data)
|
|||
/* create SDP records */
|
||||
bta_hf_client_create_record(p_data);
|
||||
|
||||
/* Set the Audio service class bit */
|
||||
/* Set the Class of Device (Audio service class bit) */
|
||||
cod.service = BTM_COD_SERVICE_AUDIO;
|
||||
utl_set_device_class(&cod, BTA_UTL_SET_COD_SERVICE_CLASS);
|
||||
cod.major = BTM_COD_MAJOR_AUDIO;
|
||||
cod.minor = BTM_COD_MINOR_CONFM_HANDSFREE;
|
||||
utl_set_device_class(&cod, BTA_UTL_SET_COD_ALL);
|
||||
|
||||
/* start RFCOMM server */
|
||||
bta_hf_client_start_server();
|
||||
|
@ -98,8 +100,14 @@ void bta_hf_client_register(tBTA_HF_CLIENT_DATA *p_data)
|
|||
*******************************************************************************/
|
||||
void bta_hf_client_deregister(tBTA_HF_CLIENT_DATA *p_data)
|
||||
{
|
||||
tBTA_UTL_COD cod;
|
||||
|
||||
bta_hf_client_cb.scb.deregister = TRUE;
|
||||
|
||||
/* Clear the Audio service class bit */
|
||||
cod.service = BTM_COD_SERVICE_AUDIO;
|
||||
utl_set_device_class(&cod, BTA_UTL_CLR_COD_SERVICE_CLASS);
|
||||
|
||||
/* remove sdp record */
|
||||
bta_hf_client_del_record(p_data);
|
||||
|
||||
|
@ -653,7 +661,7 @@ void bta_hf_client_ccwa(char *number)
|
|||
if ((evt = osi_calloc(sizeof(tBTA_HF_CLIENT_NUMBER))) != NULL) {
|
||||
strlcpy(evt->number, number, BTA_HF_CLIENT_NUMBER_LEN + 1);
|
||||
evt->number[BTA_HF_CLIENT_NUMBER_LEN] = '\0';
|
||||
|
||||
|
||||
|
||||
(*bta_hf_client_cb.p_cback)(BTA_HF_CLIENT_CCWA_EVT, evt);
|
||||
osi_free(evt);
|
||||
|
@ -709,7 +717,7 @@ void bta_hf_client_clcc(UINT32 idx, BOOLEAN incoming, UINT8 status, BOOLEAN mpty
|
|||
strlcpy(evt->number, number, BTA_HF_CLIENT_NUMBER_LEN + 1);
|
||||
evt->number[BTA_HF_CLIENT_NUMBER_LEN] = '\0';
|
||||
}
|
||||
|
||||
|
||||
(*bta_hf_client_cb.p_cback)(BTA_HF_CLIENT_CLCC_EVT, evt);
|
||||
osi_free(evt);
|
||||
} else {
|
||||
|
|
|
@ -1159,6 +1159,7 @@ static char *bta_hf_client_skip_unknown(char *buffer)
|
|||
buffer = tmp + 2;
|
||||
|
||||
APPL_TRACE_DEBUG("%s %.*s", __FUNCTION__, buffer - start - 2, start);
|
||||
UNUSED(start);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -308,6 +308,7 @@ static void bta_hf_client_sco_disc_cback(UINT16 sco_idx)
|
|||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
tBTM_STATUS status = BTM_ConfigScoPath(BTM_SCO_ROUTE_PCM, NULL, NULL, TRUE);
|
||||
APPL_TRACE_DEBUG("%s close config status = %d", __FUNCTION__, status);
|
||||
UNUSED(status);
|
||||
/* SCO clean up here */
|
||||
bta_hf_client_sco_co_close();
|
||||
#endif
|
||||
|
|
|
@ -101,8 +101,10 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
|
|||
bta_hh_le_enable();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* signal BTA call back event */
|
||||
(* bta_hh_cb.p_cback)(BTA_HH_ENABLE_EVT, (tBTA_HH *)&status);
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -901,7 +903,9 @@ void bta_hh_get_dscp_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
|||
bta_hh_le_get_dscp_act(p_cb);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
(*bta_hh_cb.p_cback)(BTA_HH_GET_DSCP_EVT, (tBTA_HH *)&p_cb->dscp_info);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -934,11 +938,10 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
|||
dev_info.status = BTA_HH_OK;
|
||||
} else
|
||||
#endif
|
||||
|
||||
{
|
||||
if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, &dev_handle)\
|
||||
== HID_SUCCESS) {
|
||||
dev_info.handle = dev_handle;
|
||||
dev_info.status = BTA_HH_OK;
|
||||
|
||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||
/* update DI information */
|
||||
|
@ -966,6 +969,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
|||
/* update cb_index[] map */
|
||||
bta_hh_cb.cb_index[dev_handle] = p_cb->index;
|
||||
}
|
||||
}
|
||||
} else { /* device already been added */
|
||||
dev_info.handle = p_cb->hid_handle;
|
||||
dev_info.status = BTA_HH_OK;
|
||||
|
|
|
@ -2183,9 +2183,10 @@ void bta_hh_le_write_char_descr_cmpl(tBTA_HH_DEV_CB *p_dev_cb, tBTA_HH_DATA *p_b
|
|||
case GATT_UUID_HID_BT_KB_INPUT:
|
||||
case GATT_UUID_HID_BT_MOUSE_INPUT:
|
||||
case GATT_UUID_HID_REPORT:
|
||||
if (p_data->status == BTA_GATT_OK)
|
||||
if (p_data->status == BTA_GATT_OK) {
|
||||
p_dev_cb->hid_srvc[hid_inst_id].report[p_dev_cb->clt_cfg_idx].client_cfg_value =
|
||||
BTA_GATT_CLT_CONFIG_NOTIFICATION;
|
||||
}
|
||||
p_dev_cb->clt_cfg_idx ++;
|
||||
bta_hh_le_write_rpt_clt_cfg(p_dev_cb, hid_inst_id);
|
||||
|
||||
|
|
|
@ -75,11 +75,12 @@ UINT8 bta_hh_find_cb(BD_ADDR bda)
|
|||
return xx;
|
||||
}
|
||||
#if BTA_HH_DEBUG
|
||||
else
|
||||
else {
|
||||
APPL_TRACE_DEBUG("in_use ? [%d] kdev[%d].hid_handle = %d state = [%d]",
|
||||
bta_hh_cb.kdev[xx].in_use, xx,
|
||||
bta_hh_cb.kdev[xx].hid_handle,
|
||||
bta_hh_cb.kdev[xx].state);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -123,7 +124,9 @@ void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB *p_cb)
|
|||
bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = BTA_HH_IDX_INVALID;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
bta_hh_cb.cb_index[p_cb->hid_handle] = BTA_HH_IDX_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
/* reset device control block */
|
||||
|
@ -486,11 +489,12 @@ UINT8 bta_hh_dev_handle_to_cb_idx(UINT8 dev_handle)
|
|||
#endif
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* regular HID device checking */
|
||||
if (dev_handle < BTA_HH_MAX_KNOWN ) {
|
||||
index = bta_hh_cb.cb_index[dev_handle];
|
||||
}
|
||||
|
||||
}
|
||||
return index;
|
||||
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ typedef UINT16 tBTA_SEC;
|
|||
/* Ignore for Discoverable, Connectable only for LE modes */
|
||||
#define BTA_DM_LE_IGNORE 0xFF00
|
||||
|
||||
#define BTA_APP_ID_1 1 /* PM example profile 1 */
|
||||
#define BTA_APP_ID_PAN_MULTI 0xFE /* app id for pan multiple connection */
|
||||
#define BTA_ALL_APP_ID 0xFF
|
||||
|
||||
|
@ -398,6 +399,8 @@ typedef struct {
|
|||
UINT8 tx_power;
|
||||
} tBTA_BLE_ADV_DATA;
|
||||
|
||||
typedef void (tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info);
|
||||
|
||||
typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef tBTM_START_ADV_CMPL_CBACK tBTA_START_ADV_CMPL_CBACK;
|
||||
|
@ -1021,6 +1024,7 @@ typedef struct {
|
|||
#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
|
||||
#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
|
||||
#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
|
||||
#define BTA_DM_INQ_DISCARD_NUM_EVT 7 /* The number of inquiry discarded packets */
|
||||
|
||||
typedef UINT8 tBTA_DM_SEARCH_EVT;
|
||||
|
||||
|
@ -1052,6 +1056,11 @@ typedef struct {
|
|||
UINT8 num_resps; /* Number of inquiry responses. */
|
||||
} tBTA_DM_INQ_CMPL;
|
||||
|
||||
/* Structure associated with BTA_DM_INQ_DISCARD_NUM_EVT */
|
||||
typedef struct {
|
||||
UINT32 num_dis; /* The number of inquiry discarded packets. */
|
||||
} tBTA_DM_INQ_DISCARD;
|
||||
|
||||
/* Structure associated with BTA_DM_DI_DISC_CMPL_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* BD address peer device. */
|
||||
|
@ -1089,6 +1098,7 @@ typedef union {
|
|||
tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
|
||||
tBTA_DM_DISC_BLE_RES disc_ble_res; /* Discovery result for GATT based service */
|
||||
tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
|
||||
tBTA_DM_INQ_DISCARD inq_dis; /* the discarded packets information of inquiry */
|
||||
} tBTA_DM_SEARCH;
|
||||
|
||||
/* Structure of search callback event and structures */
|
||||
|
@ -1218,6 +1228,10 @@ typedef UINT8 tBTA_DM_PM_ACTION;
|
|||
#define BTA_DM_PM_SNIFF_A2DP_IDX BTA_DM_PM_SNIFF
|
||||
#endif
|
||||
|
||||
#ifndef BTA_DM_PM_SNIFF_JV_IDX
|
||||
#define BTA_DM_PM_SNIFF_JV_IDX BTA_DM_PM_SNIFF
|
||||
#endif
|
||||
|
||||
#ifndef BTA_DM_PM_SNIFF_HD_IDLE_IDX
|
||||
#define BTA_DM_PM_SNIFF_HD_IDLE_IDX BTA_DM_PM_SNIFF2
|
||||
#endif
|
||||
|
@ -1865,12 +1879,13 @@ extern void BTA_DmBleConfirmReply(BD_ADDR bd_addr, BOOLEAN accept);
|
|||
**
|
||||
** Parameters: bd_addr - BD address of the peer
|
||||
** dev_type - Remote device's device type.
|
||||
** auth_mode - auth mode
|
||||
** addr_type - LE device address type.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type,
|
||||
extern void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, int auth_mode,
|
||||
tBT_DEVICE_TYPE dev_type);
|
||||
|
||||
|
||||
|
@ -2231,6 +2246,24 @@ extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask,
|
|||
extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
|
||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmUpdateDuplicateExceptionalList
|
||||
**
|
||||
** Description This function is called to update duplicate scan exceptional list
|
||||
**
|
||||
** Parameters subcode : add, remove or clean duplicate scan exceptional list.
|
||||
** type : device info type.
|
||||
** device_info: device info
|
||||
** p_update_duplicate_ignore_list_cback : update complete callback.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
||||
BD_ADDR device_info,
|
||||
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleBroadcast
|
||||
|
|
|
@ -555,6 +555,7 @@ typedef struct {
|
|||
BD_ADDR remote_bda;
|
||||
UINT32 trans_id;
|
||||
UINT16 conn_id;
|
||||
UINT16 handle;
|
||||
tBTA_GATTS_REQ_DATA *p_data;
|
||||
UINT16 data_len;
|
||||
UINT8 *value;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "osi/allocator.h"
|
||||
#include "osi/osi.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "bta/utl.h"
|
||||
#include "bta/bta_sys.h"
|
||||
|
@ -137,7 +138,7 @@ UINT8 bta_jv_alloc_sec_id(void)
|
|||
return ret;
|
||||
|
||||
}
|
||||
static int get_sec_id_used(void)
|
||||
UNUSED_ATTR static int get_sec_id_used(void)
|
||||
{
|
||||
int i;
|
||||
int used = 0;
|
||||
|
@ -146,12 +147,13 @@ static int get_sec_id_used(void)
|
|||
used++;
|
||||
}
|
||||
}
|
||||
if (used == BTA_JV_NUM_SERVICE_ID)
|
||||
if (used == BTA_JV_NUM_SERVICE_ID) {
|
||||
APPL_TRACE_ERROR("get_sec_id_used, sec id exceeds the limit:%d",
|
||||
BTA_JV_NUM_SERVICE_ID);
|
||||
}
|
||||
return used;
|
||||
}
|
||||
static int get_rfc_cb_used(void)
|
||||
UNUSED_ATTR static int get_rfc_cb_used(void)
|
||||
{
|
||||
int i;
|
||||
int used = 0;
|
||||
|
@ -160,9 +162,10 @@ static int get_rfc_cb_used(void)
|
|||
used++;
|
||||
}
|
||||
}
|
||||
if (used == BTA_JV_MAX_RFC_CONN)
|
||||
if (used == BTA_JV_MAX_RFC_CONN) {
|
||||
APPL_TRACE_ERROR("get_sec_id_used, rfc ctrl block exceeds the limit:%d",
|
||||
BTA_JV_MAX_RFC_CONN);
|
||||
}
|
||||
return used;
|
||||
}
|
||||
|
||||
|
@ -474,19 +477,21 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
|
|||
< BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si]) {
|
||||
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(bta_jv_cb.rfc_cb[hi].rfc_hdl[si]);
|
||||
if (p_pcb) {
|
||||
if (NULL == p_pcb->p_pm_cb)
|
||||
if (NULL == p_pcb->p_pm_cb) {
|
||||
APPL_TRACE_WARNING("%s(jv_handle:"
|
||||
" 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to "
|
||||
"pm_cb?", __func__, jv_handle, p_pcb->port_handle, i);
|
||||
}
|
||||
p_cb = &p_pcb->p_pm_cb;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (jv_handle < BTA_JV_MAX_L2C_CONN) {
|
||||
tBTA_JV_L2C_CB *p_l2c_cb = &bta_jv_cb.l2c_cb[jv_handle];
|
||||
if (NULL == p_l2c_cb->p_pm_cb)
|
||||
if (NULL == p_l2c_cb->p_pm_cb) {
|
||||
APPL_TRACE_WARNING("%s(jv_handle: "
|
||||
"0x%x): p_pm_cb: %d: no link to pm_cb?", __func__, jv_handle, i);
|
||||
}
|
||||
p_cb = &p_l2c_cb->p_pm_cb;
|
||||
}
|
||||
}
|
||||
|
@ -643,10 +648,17 @@ BOOLEAN bta_jv_check_psm(UINT16 psm)
|
|||
*******************************************************************************/
|
||||
void bta_jv_enable(tBTA_JV_MSG *p_data)
|
||||
{
|
||||
tBTA_UTL_COD cod;
|
||||
|
||||
tBTA_JV_STATUS status = BTA_JV_SUCCESS;
|
||||
bta_jv_cb.p_dm_cback = p_data->enable.p_cback;
|
||||
bta_jv_cb.p_dm_cback(BTA_JV_ENABLE_EVT, (tBTA_JV *)&status, 0);
|
||||
memset(bta_jv_cb.free_psm_list, 0, sizeof(bta_jv_cb.free_psm_list));
|
||||
|
||||
/* Set the Class of Device */
|
||||
cod.major = BTM_COD_MAJOR_UNCLASSIFIED;
|
||||
cod.minor = BTM_COD_MINOR_UNCLASSIFIED;
|
||||
utl_set_device_class(&cod, BTA_UTL_SET_COD_MAJOR_MINOR);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -662,8 +674,6 @@ void bta_jv_enable(tBTA_JV_MSG *p_data)
|
|||
void bta_jv_disable (tBTA_JV_MSG *p_data)
|
||||
{
|
||||
UNUSED(p_data);
|
||||
|
||||
APPL_TRACE_ERROR("%s", __func__);
|
||||
}
|
||||
|
||||
|
||||
|
@ -737,9 +747,10 @@ void bta_jv_get_channel_id(tBTA_JV_MSG *p_data)
|
|||
bta_jv_cb.scn[channel - 1] = TRUE;
|
||||
scn = (UINT8) channel;
|
||||
}
|
||||
if (bta_jv_cb.p_dm_cback)
|
||||
if (bta_jv_cb.p_dm_cback) {
|
||||
bta_jv_cb.p_dm_cback(BTA_JV_GET_SCN_EVT, (tBTA_JV *)&scn,
|
||||
p_data->alloc_channel.user_data);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case BTA_JV_CONN_TYPE_L2CAP:
|
||||
|
@ -993,6 +1004,9 @@ static bool create_base_record(const uint32_t sdp_handle, const char *name, cons
|
|||
APPL_TRACE_DEBUG("create_base_record: successfully created base service "
|
||||
"record, handle: 0x%08x, scn: %d, name: %s, with_obex: %d",
|
||||
sdp_handle, channel, name, with_obex);
|
||||
|
||||
UNUSED(stage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1026,6 +1040,8 @@ static int add_spp_sdp(const char *name, const int channel) {
|
|||
|
||||
APPL_TRACE_DEBUG("add_spp_sdp: service registered successfully, "
|
||||
"service_name: %s, handle 0x%08x)", name, handle);
|
||||
UNUSED(stage);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -1518,6 +1534,7 @@ static int bta_jv_port_data_co_cback(UINT16 port_handle, UINT8 *buf, UINT16 len,
|
|||
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(port_handle);
|
||||
int ret = 0;
|
||||
APPL_TRACE_DEBUG("%s, p_cb:%p, p_pcb:%p, len:%d, type:%d", __func__, p_cb, p_pcb, len, type);
|
||||
UNUSED(p_cb);
|
||||
if (p_pcb != NULL) {
|
||||
switch (type) {
|
||||
case DATA_CO_CALLBACK_TYPE_INCOMING:
|
||||
|
|
|
@ -38,14 +38,9 @@ static void _btc_storage_save(void)
|
|||
//store the next iter, if remove section, then will not loss the point
|
||||
|
||||
const char *section = btc_config_section_name(iter);
|
||||
if (!string_is_bdaddr(section) ||
|
||||
!btc_config_get_int(section, BTC_BLE_STORAGE_DEV_TYPE_STR, (int *)&device_type) ||
|
||||
((device_type & BT_DEVICE_TYPE_BLE) != BT_DEVICE_TYPE_BLE)) {
|
||||
iter = btc_config_section_next(iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!btc_config_exist(section, BTC_BLE_STORAGE_DEV_TYPE_STR) &&
|
||||
if (string_is_bdaddr(section) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_DEV_TYPE_STR) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_ADDR_TYPE_STR) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_LINK_KEY_STR) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_PENC_STR) &&
|
||||
|
@ -57,6 +52,14 @@ static void _btc_storage_save(void)
|
|||
btc_config_remove_section(section);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!string_is_bdaddr(section) ||
|
||||
!btc_config_get_int(section, BTC_BLE_STORAGE_DEV_TYPE_STR, (int *)&device_type) ||
|
||||
((device_type & BT_DEVICE_TYPE_BLE) != BT_DEVICE_TYPE_BLE)) {
|
||||
iter = btc_config_section_next(iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(addr_section_count == BONED_DEVICES_MAX_COUNT) {
|
||||
need_remove_iter = iter;
|
||||
}
|
||||
|
@ -239,6 +242,9 @@ static bt_status_t _btc_storage_remove_ble_bonding_keys(bt_bdaddr_t *remote_bd_a
|
|||
if (btc_config_exist(bdstr, BTC_BLE_STORAGE_LE_KEY_LCSRK_STR)) {
|
||||
ret |= btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_KEY_LCSRK_STR);
|
||||
}
|
||||
if (btc_config_exist(bdstr, BTC_BLE_STORAGE_LE_KEY_LID_STR)) {
|
||||
ret |= btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_KEY_LID_STR);
|
||||
}
|
||||
//here don't remove section, because config_save will check it
|
||||
_btc_storage_save();
|
||||
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
|
||||
|
@ -547,6 +553,91 @@ bt_status_t btc_storage_remove_ble_dev_type(bt_bdaddr_t *remote_bd_addr, bool fl
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bt_status_t _btc_storage_set_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, uint8_t auth_mode, bool flush)
|
||||
{
|
||||
int ret;
|
||||
bdstr_t bdstr;
|
||||
|
||||
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr_t));
|
||||
ret = btc_config_set_int(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR, (int)auth_mode);
|
||||
if (ret == false) {
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
if (flush) {
|
||||
_btc_storage_save();
|
||||
}
|
||||
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bt_status_t btc_storage_set_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, uint8_t auth_mode, bool flush)
|
||||
{
|
||||
bt_status_t ret;
|
||||
|
||||
btc_config_lock();
|
||||
ret = _btc_storage_set_ble_dev_auth_mode(remote_bd_addr, auth_mode, flush);
|
||||
btc_config_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bt_status_t _btc_storage_get_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, int* auth_mode)
|
||||
{
|
||||
bdstr_t bdstr;
|
||||
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
|
||||
int ret = btc_config_get_int(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR, auth_mode);
|
||||
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
bt_status_t btc_storage_get_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, int* auth_mode)
|
||||
{
|
||||
bt_status_t ret;
|
||||
|
||||
btc_config_lock();
|
||||
ret = _btc_storage_get_ble_dev_auth_mode(remote_bd_addr, auth_mode);
|
||||
btc_config_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bt_status_t _btc_storage_remove_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, bool flush)
|
||||
{
|
||||
bool ret = true;
|
||||
bdstr_t bdstr;
|
||||
uint32_t auth_mode = 0;
|
||||
|
||||
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
|
||||
|
||||
ret = btc_config_get_int(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR, (int *)&auth_mode);
|
||||
if (ret == false) {
|
||||
//cannot find the key, just return SUCCESS, indicate already removed
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ret = btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_AUTH_MODE_STR);
|
||||
if (ret == false) {
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
if (flush) {
|
||||
_btc_storage_save();
|
||||
}
|
||||
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bt_status_t btc_storage_remove_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, bool flush)
|
||||
{
|
||||
bt_status_t ret;
|
||||
|
||||
btc_config_lock();
|
||||
ret = _btc_storage_remove_ble_dev_auth_mode(remote_bd_addr, flush);
|
||||
btc_config_unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bt_status_t _btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr, uint8_t addr_type, bool flush)
|
||||
{
|
||||
int ret;
|
||||
|
@ -651,11 +742,17 @@ static void _btc_read_le_key(const uint8_t key_type, const size_t key_len, bt_bd
|
|||
bdcpy(bta_bd_addr, bd_addr.address);
|
||||
|
||||
if (!*device_added) {
|
||||
BTA_DmAddBleDevice(bta_bd_addr, addr_type, BT_DEVICE_TYPE_BLE);
|
||||
int auth_mode = 0;
|
||||
if(_btc_storage_get_ble_dev_auth_mode(&bd_addr, &auth_mode) != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_WARNING("%s Failed to get auth mode from flash, please erase flash and download the firmware again", __func__);
|
||||
}
|
||||
BTA_DmAddBleDevice(bta_bd_addr, addr_type, auth_mode, BT_DEVICE_TYPE_BLE);
|
||||
*device_added = true;
|
||||
}
|
||||
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
char bd_str[20] = {0};
|
||||
#endif
|
||||
BTC_TRACE_DEBUG("%s() Adding key type %d for %s", __func__,
|
||||
key_type, bdaddr_to_string(&bd_addr, bd_str, sizeof(bd_str)));
|
||||
BTA_DmAddBleKey(bta_bd_addr, (tBTA_LE_KEY_VALUE *)buffer, key_type);
|
||||
|
@ -761,7 +858,6 @@ bt_status_t btc_storage_load_bonded_ble_devices(void)
|
|||
bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev, int dev_num)
|
||||
{
|
||||
bt_bdaddr_t bd_addr;
|
||||
uint32_t device_type = 0;
|
||||
char buffer[sizeof(tBTM_LE_KEY_VALUE)] = {0};
|
||||
|
||||
btc_config_lock();
|
||||
|
@ -771,12 +867,13 @@ bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev
|
|||
if (dev_num-- <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t device_type = 0;
|
||||
const char *name = btc_config_section_name(iter);
|
||||
|
||||
if (!string_is_bdaddr(name) ||
|
||||
!btc_config_get_int(name, BTC_BLE_STORAGE_DEV_TYPE_STR, (int *)&device_type) ||
|
||||
!(device_type & BT_DEVICE_TYPE_BLE)) {
|
||||
dev_num ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ static void btc_dm_remove_ble_bonding_keys(void)
|
|||
bdcpy(bd_addr.address, pairing_cb.bd_addr);
|
||||
|
||||
btc_storage_remove_remote_addr_type(&bd_addr, false);
|
||||
btc_storage_remove_ble_dev_auth_mode(&bd_addr, false);
|
||||
btc_storage_remove_ble_dev_type(&bd_addr, false);
|
||||
btc_storage_remove_ble_bonding_keys(&bd_addr);
|
||||
}
|
||||
|
@ -261,9 +262,14 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
|||
BTC_TRACE_DEBUG ("%s, - pairing_cb.bd_addr: %08x%04x", __func__,
|
||||
(pairing_cb.bd_addr[0] << 24) + (pairing_cb.bd_addr[1] << 16) + (pairing_cb.bd_addr[2] << 8) + pairing_cb.bd_addr[3],
|
||||
(pairing_cb.bd_addr[4] << 8) + pairing_cb.bd_addr[5]);
|
||||
// Check if need to save BLE keys
|
||||
if((p_auth_cmpl->auth_mode & SMP_AUTH_GEN_BOND) == 0) {
|
||||
return;
|
||||
}
|
||||
if (btc_storage_get_remote_addr_type(&bdaddr, &addr_type) != BT_STATUS_SUCCESS) {
|
||||
btc_storage_set_remote_addr_type(&bdaddr, p_auth_cmpl->addr_type, true);
|
||||
}
|
||||
btc_storage_set_ble_dev_auth_mode(&bdaddr, p_auth_cmpl->auth_mode, true);
|
||||
btc_dm_save_ble_bonding_keys();
|
||||
} else {
|
||||
/*Map the HCI fail reason to bt status */
|
||||
|
@ -284,6 +290,9 @@ static void btc_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
|||
|
||||
}
|
||||
|
||||
#if (CONFIG_BT_STACK_NO_LOG)
|
||||
(void) status;
|
||||
#endif
|
||||
BTC_TRACE_DEBUG("%s, authentication status = %x", __func__, status);
|
||||
return;
|
||||
|
||||
|
@ -638,6 +647,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
|||
//remove the bonded key in the config and nvs flash.
|
||||
btc_storage_remove_ble_dev_type(&bd_addr, false);
|
||||
btc_storage_remove_remote_addr_type(&bd_addr, false);
|
||||
btc_storage_remove_ble_dev_auth_mode(&bd_addr, false);
|
||||
param.remove_bond_dev_cmpl.status = btc_storage_remove_ble_bonding_keys(&bd_addr);
|
||||
}
|
||||
ble_msg.act = ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT;
|
||||
|
|
|
@ -64,7 +64,7 @@ static void btc_init_bluetooth(void)
|
|||
bte_main_boot_entry(btc_init_callback);
|
||||
#if (SMP_INCLUDED)
|
||||
btc_config_init();
|
||||
//load the ble local key whitch has been store in the flash
|
||||
//load the ble local key which has been stored in the flash
|
||||
btc_dm_load_ble_local_keys();
|
||||
#endif /* #if (SMP_INCLUDED) */
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define BTC_BLE_STORAGE_LE_KEY_LENC_STR "LE_KEY_LENC"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_LID_STR "LE_KEY_LID"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_LCSRK_STR "LE_KEY_LCSRK"
|
||||
#define BTC_BLE_STORAGE_LE_AUTH_MODE_STR "AuthMode"
|
||||
|
||||
#define BTC_BLE_STORAGE_LOCAL_ADAPTER_STR "Adapter"
|
||||
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_IR_STR "LE_LOCAL_KEY_IR"
|
||||
|
@ -66,6 +67,12 @@ bt_status_t btc_storage_remove_ble_local_keys(void);
|
|||
|
||||
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type, char *key_value, int key_len);
|
||||
|
||||
bt_status_t btc_storage_set_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, uint8_t auth_mode, bool flush);
|
||||
|
||||
bt_status_t btc_storage_get_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, int* auth_mode);
|
||||
|
||||
bt_status_t btc_storage_remove_ble_dev_auth_mode(bt_bdaddr_t *remote_bd_addr, bool flush);
|
||||
|
||||
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr, int *addr_type);
|
||||
|
||||
bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr, uint8_t addr_type, bool flush);
|
||||
|
|
|
@ -170,6 +170,14 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
|||
BTA_GATTS_SendRsp(p_data->req_data.conn_id, p_data->req_data.trans_id,
|
||||
status, &rsp);
|
||||
|
||||
if(status != GATT_SUCCESS) {
|
||||
if (blufi_env.prepare_buf) {
|
||||
osi_free(blufi_env.prepare_buf);
|
||||
blufi_env.prepare_buf = NULL;
|
||||
}
|
||||
BLUFI_TRACE_ERROR("write data error , error code 0x%x\n", status);
|
||||
return;
|
||||
}
|
||||
memcpy(blufi_env.prepare_buf + p_data->req_data.p_data->write_req.offset,
|
||||
p_data->req_data.p_data->write_req.value,
|
||||
p_data->req_data.p_data->write_req.len);
|
||||
|
@ -194,7 +202,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
|||
BTA_GATTS_SendRsp(p_data->req_data.conn_id, p_data->req_data.trans_id,
|
||||
GATT_SUCCESS, NULL);
|
||||
|
||||
if (p_data->req_data.p_data->exec_write == GATT_PREP_WRITE_EXEC) {
|
||||
if (blufi_env.prepare_buf && p_data->req_data.p_data->exec_write == GATT_PREP_WRITE_EXEC) {
|
||||
btc_blufi_recv_handler(blufi_env.prepare_buf, blufi_env.prepare_len);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,9 +143,21 @@ static inline void btc_a2d_data_cb_to_app(const uint8_t *data, uint32_t len)
|
|||
}
|
||||
}
|
||||
|
||||
OI_CODEC_SBC_DECODER_CONTEXT context;
|
||||
OI_UINT32 contextData[CODEC_DATA_WORDS(2, SBC_CODEC_FAST_FILTER_BUFFERS)];
|
||||
OI_INT16 pcmData[15 * SBC_MAX_SAMPLES_PER_FRAME * SBC_MAX_CHANNELS];
|
||||
#define BTC_SBC_DEC_CONTEXT_DATA_LEN (CODEC_DATA_WORDS(2, SBC_CODEC_FAST_FILTER_BUFFERS))
|
||||
#define BTC_SBC_DEC_PCM_DATA_LEN (15 * SBC_MAX_SAMPLES_PER_FRAME * SBC_MAX_CHANNELS)
|
||||
|
||||
#if BTC_SBC_DEC_DYNAMIC_MEMORY == FALSE
|
||||
static OI_CODEC_SBC_DECODER_CONTEXT btc_sbc_decoder_context;
|
||||
static OI_UINT32 btc_sbc_decoder_context_data[BTC_SBC_DEC_CONTEXT_DATA_LEN];
|
||||
static OI_INT16 btc_sbc_pcm_data[BTC_SBC_DEC_PCM_DATA_LEN];
|
||||
#else
|
||||
static OI_CODEC_SBC_DECODER_CONTEXT *btc_sbc_decoder_context_ptr;
|
||||
static OI_UINT32 *btc_sbc_decoder_context_data;
|
||||
static OI_INT16 *btc_sbc_pcm_data;
|
||||
#define btc_sbc_decoder_context (*btc_sbc_decoder_context_ptr)
|
||||
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == FALSE */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Misc helper functions
|
||||
|
@ -235,6 +247,16 @@ bool btc_a2dp_sink_startup(void)
|
|||
|
||||
APPL_TRACE_EVENT("## A2DP SINK START MEDIA THREAD ##");
|
||||
|
||||
#if (BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE)
|
||||
btc_sbc_decoder_context_ptr = osi_calloc(sizeof(OI_CODEC_SBC_DECODER_CONTEXT));
|
||||
btc_sbc_decoder_context_data = osi_calloc(BTC_SBC_DEC_CONTEXT_DATA_LEN * sizeof(OI_UINT32));
|
||||
btc_sbc_pcm_data = osi_calloc(BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16));
|
||||
if (!btc_sbc_decoder_context_ptr || !btc_sbc_decoder_context_data || !btc_sbc_pcm_data) {
|
||||
APPL_TRACE_ERROR("failed to allocate SBC decoder");
|
||||
goto error_exit;
|
||||
}
|
||||
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE */
|
||||
|
||||
btc_aa_snk_queue_set = xQueueCreateSet(BTC_A2DP_SINK_TASK_QUEUE_SET_LEN);
|
||||
configASSERT(btc_aa_snk_queue_set);
|
||||
btc_aa_snk_data_queue = xQueueCreate(BTC_A2DP_SINK_DATA_QUEUE_LEN, sizeof(int32_t));
|
||||
|
@ -280,6 +302,21 @@ error_exit:;
|
|||
vQueueDelete(btc_aa_snk_queue_set);
|
||||
btc_aa_snk_queue_set = NULL;
|
||||
}
|
||||
#if (BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE)
|
||||
if (btc_sbc_decoder_context_ptr) {
|
||||
osi_free(btc_sbc_decoder_context_ptr);
|
||||
btc_sbc_decoder_context_ptr = NULL;
|
||||
}
|
||||
if (btc_sbc_decoder_context_data) {
|
||||
osi_free(btc_sbc_decoder_context_data);
|
||||
btc_sbc_decoder_context_data = NULL;
|
||||
}
|
||||
if (btc_sbc_pcm_data) {
|
||||
osi_free(btc_sbc_pcm_data);
|
||||
btc_sbc_pcm_data = NULL;
|
||||
}
|
||||
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE */
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -306,6 +343,17 @@ void btc_a2dp_sink_shutdown(void)
|
|||
|
||||
vQueueDelete(btc_aa_snk_queue_set);
|
||||
btc_aa_snk_queue_set = NULL;
|
||||
|
||||
#if (BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE)
|
||||
osi_free(btc_sbc_decoder_context_ptr);
|
||||
btc_sbc_decoder_context_ptr = NULL;
|
||||
|
||||
osi_free(btc_sbc_decoder_context_data);
|
||||
btc_sbc_decoder_context_data = NULL;
|
||||
|
||||
osi_free(btc_sbc_pcm_data);
|
||||
btc_sbc_pcm_data = NULL;
|
||||
#endif /* BTC_SBC_DEC_DYNAMIC_MEMORY == TRUE */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -467,7 +515,8 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
|
|||
|
||||
btc_aa_snk_cb.rx_flush = FALSE;
|
||||
APPL_TRACE_EVENT("Reset to sink role");
|
||||
status = OI_CODEC_SBC_DecoderReset(&context, contextData, sizeof(contextData), 2, 2, FALSE);
|
||||
status = OI_CODEC_SBC_DecoderReset(&btc_sbc_decoder_context, btc_sbc_decoder_context_data,
|
||||
BTC_SBC_DEC_CONTEXT_DATA_LEN * sizeof(OI_UINT32), 2, 2, FALSE);
|
||||
if (!OI_SUCCESS(status)) {
|
||||
APPL_TRACE_ERROR("OI_CODEC_SBC_DecoderReset failed with error code %d\n", status);
|
||||
}
|
||||
|
@ -566,6 +615,7 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
|
|||
|
||||
int frames_to_process = ((freq_multiple) / (num_blocks * num_subbands)) + 1;
|
||||
APPL_TRACE_EVENT(" Frames to be processed in 20 ms %d\n", frames_to_process);
|
||||
UNUSED(frames_to_process);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -582,11 +632,11 @@ static void btc_a2dp_sink_handle_inc_media(tBT_SBC_HDR *p_msg)
|
|||
UINT8 *sbc_start_frame = ((UINT8 *)(p_msg + 1) + p_msg->offset + 1);
|
||||
int count;
|
||||
UINT32 pcmBytes, availPcmBytes;
|
||||
OI_INT16 *pcmDataPointer = pcmData; /*Will be overwritten on next packet receipt*/
|
||||
OI_INT16 *pcmDataPointer = btc_sbc_pcm_data; /*Will be overwritten on next packet receipt*/
|
||||
OI_STATUS status;
|
||||
int num_sbc_frames = p_msg->num_frames_to_be_processed;
|
||||
UINT32 sbc_frame_len = p_msg->len - 1;
|
||||
availPcmBytes = sizeof(pcmData);
|
||||
availPcmBytes = BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16);
|
||||
|
||||
/* XXX: Check if the below check is correct, we are checking for peer to be sink when we are sink */
|
||||
if (btc_av_get_peer_sep() == AVDT_TSEP_SNK || (btc_aa_snk_cb.rx_flush)) {
|
||||
|
@ -603,7 +653,7 @@ static void btc_a2dp_sink_handle_inc_media(tBT_SBC_HDR *p_msg)
|
|||
|
||||
for (count = 0; count < num_sbc_frames && sbc_frame_len != 0; count ++) {
|
||||
pcmBytes = availPcmBytes;
|
||||
status = OI_CODEC_SBC_DecodeFrame(&context, (const OI_BYTE **)&sbc_start_frame,
|
||||
status = OI_CODEC_SBC_DecodeFrame(&btc_sbc_decoder_context, (const OI_BYTE **)&sbc_start_frame,
|
||||
(OI_UINT32 *)&sbc_frame_len,
|
||||
(OI_INT16 *)pcmDataPointer,
|
||||
(OI_UINT32 *)&pcmBytes);
|
||||
|
@ -617,7 +667,7 @@ static void btc_a2dp_sink_handle_inc_media(tBT_SBC_HDR *p_msg)
|
|||
p_msg->len = sbc_frame_len + 1;
|
||||
}
|
||||
|
||||
btc_a2d_data_cb_to_app((uint8_t *)pcmData, (sizeof(pcmData) - availPcmBytes));
|
||||
btc_a2d_data_cb_to_app((uint8_t *)btc_sbc_pcm_data, (BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16) - availPcmBytes));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -156,7 +156,6 @@ typedef struct {
|
|||
tBTC_AV_FEEDING_MODE feeding_mode;
|
||||
tBTC_AV_MEDIA_FEEDINGS_STATE media_feeding_state;
|
||||
tBTC_AV_MEDIA_FEEDINGS media_feeding;
|
||||
SBC_ENC_PARAMS encoder;
|
||||
osi_alarm_t *media_alarm;
|
||||
} tBTC_A2DP_SOURCE_CB;
|
||||
|
||||
|
@ -187,6 +186,13 @@ static QueueSetHandle_t btc_aa_src_queue_set;
|
|||
static esp_a2d_source_data_cb_t btc_aa_src_data_cb = NULL;
|
||||
static UINT64 last_frame_us = 0;
|
||||
|
||||
#if BTC_SBC_ENC_DYNAMIC_MEMORY == FALSE
|
||||
static SBC_ENC_PARAMS btc_sbc_encoder;
|
||||
#else
|
||||
static SBC_ENC_PARAMS *btc_sbc_encoder_ptr;
|
||||
#define btc_sbc_encoder (*btc_sbc_encoder_ptr)
|
||||
#endif /* BTC_SBC_ENC_DYNAMIC_MEMORY == FALSE */
|
||||
|
||||
void btc_a2dp_src_reg_data_cb(esp_a2d_source_data_cb_t callback)
|
||||
{
|
||||
// todo: critical section protection
|
||||
|
@ -310,6 +316,14 @@ bool btc_a2dp_source_startup(void)
|
|||
|
||||
APPL_TRACE_EVENT("## A2DP SOURCE START MEDIA THREAD ##");
|
||||
|
||||
#if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE
|
||||
btc_sbc_encoder_ptr = osi_calloc(sizeof(SBC_ENC_PARAMS));
|
||||
if (!btc_sbc_encoder_ptr) {
|
||||
APPL_TRACE_ERROR("failed to allocate SBC encoder");
|
||||
goto error_exit;
|
||||
}
|
||||
#endif /* #if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE */
|
||||
|
||||
btc_aa_src_queue_set = xQueueCreateSet(BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN);
|
||||
configASSERT(btc_aa_src_queue_set);
|
||||
btc_aa_src_data_queue = xQueueCreate(BTC_A2DP_SOURCE_DATA_QUEUE_LEN, sizeof(void *));
|
||||
|
@ -355,6 +369,12 @@ error_exit:;
|
|||
vQueueDelete(btc_aa_src_queue_set);
|
||||
btc_aa_src_queue_set = NULL;
|
||||
}
|
||||
#if (BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE)
|
||||
if (btc_sbc_encoder_ptr) {
|
||||
osi_free(btc_sbc_encoder_ptr);
|
||||
btc_sbc_encoder_ptr = NULL;
|
||||
}
|
||||
#endif /* #if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -381,6 +401,11 @@ void btc_a2dp_source_shutdown(void)
|
|||
|
||||
vQueueDelete(btc_aa_src_queue_set);
|
||||
btc_aa_src_queue_set = NULL;
|
||||
|
||||
#if (BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE)
|
||||
osi_free(btc_sbc_encoder_ptr);
|
||||
btc_sbc_encoder_ptr = NULL;
|
||||
#endif /* #if BTC_SBC_ENC_DYNAMIC_MEMORY == TRUE */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -470,10 +495,11 @@ static UINT64 time_now_us()
|
|||
static void log_tstamps_us(char *comment)
|
||||
{
|
||||
static UINT64 prev_us = 0;
|
||||
const UINT64 now_us = time_now_us();
|
||||
UINT64 now_us = time_now_us();
|
||||
APPL_TRACE_DEBUG("[%s] ts %08llu, diff : %08llu, queue sz %d", comment, now_us, now_us - prev_us,
|
||||
fixed_queue_length(btc_aa_src_cb.TxAaQ));
|
||||
prev_us = now_us;
|
||||
UNUSED(prev_us);
|
||||
}
|
||||
|
||||
/* when true media task discards any tx frames */
|
||||
|
@ -794,13 +820,14 @@ static void btc_a2dp_source_enc_init(BT_HDR *p_msg)
|
|||
btc_aa_src_cb.timestamp = 0;
|
||||
|
||||
/* SBC encoder config (enforced even if not used) */
|
||||
btc_aa_src_cb.encoder.s16ChannelMode = pInitAudio->ChannelMode;
|
||||
btc_aa_src_cb.encoder.s16NumOfSubBands = pInitAudio->NumOfSubBands;
|
||||
btc_aa_src_cb.encoder.s16NumOfBlocks = pInitAudio->NumOfBlocks;
|
||||
btc_aa_src_cb.encoder.s16AllocationMethod = pInitAudio->AllocationMethod;
|
||||
btc_aa_src_cb.encoder.s16SamplingFreq = pInitAudio->SamplingFreq;
|
||||
|
||||
btc_aa_src_cb.encoder.u16BitRate = btc_a2dp_source_get_sbc_rate();
|
||||
btc_sbc_encoder.s16ChannelMode = pInitAudio->ChannelMode;
|
||||
btc_sbc_encoder.s16NumOfSubBands = pInitAudio->NumOfSubBands;
|
||||
btc_sbc_encoder.s16NumOfBlocks = pInitAudio->NumOfBlocks;
|
||||
btc_sbc_encoder.s16AllocationMethod = pInitAudio->AllocationMethod;
|
||||
btc_sbc_encoder.s16SamplingFreq = pInitAudio->SamplingFreq;
|
||||
|
||||
btc_sbc_encoder.u16BitRate = btc_a2dp_source_get_sbc_rate();
|
||||
|
||||
/* Default transcoding is PCM to SBC, modified by feeding configuration */
|
||||
btc_aa_src_cb.TxTranscoding = BTC_MEDIA_TRSCD_PCM_2_SBC;
|
||||
|
@ -811,14 +838,14 @@ static void btc_a2dp_source_enc_init(BT_HDR *p_msg)
|
|||
APPL_TRACE_EVENT("btc_a2dp_source_enc_init mtu %d, peer mtu %d",
|
||||
btc_aa_src_cb.TxAaMtuSize, pInitAudio->MtuSize);
|
||||
APPL_TRACE_EVENT(" ch mode %d, subnd %d, nb blk %d, alloc %d, rate %d, freq %d",
|
||||
btc_aa_src_cb.encoder.s16ChannelMode, btc_aa_src_cb.encoder.s16NumOfSubBands,
|
||||
btc_aa_src_cb.encoder.s16NumOfBlocks,
|
||||
btc_aa_src_cb.encoder.s16AllocationMethod, btc_aa_src_cb.encoder.u16BitRate,
|
||||
btc_aa_src_cb.encoder.s16SamplingFreq);
|
||||
btc_sbc_encoder.s16ChannelMode, btc_sbc_encoder.s16NumOfSubBands,
|
||||
btc_sbc_encoder.s16NumOfBlocks,
|
||||
btc_sbc_encoder.s16AllocationMethod, btc_sbc_encoder.u16BitRate,
|
||||
btc_sbc_encoder.s16SamplingFreq);
|
||||
|
||||
/* Reset entirely the SBC encoder */
|
||||
SBC_Encoder_Init(&(btc_aa_src_cb.encoder));
|
||||
APPL_TRACE_DEBUG("btc_a2dp_source_enc_init bit pool %d", btc_aa_src_cb.encoder.s16BitPool);
|
||||
SBC_Encoder_Init(&(btc_sbc_encoder));
|
||||
APPL_TRACE_DEBUG("btc_a2dp_source_enc_init bit pool %d", btc_sbc_encoder.s16BitPool);
|
||||
}
|
||||
|
||||
|
||||
|
@ -835,7 +862,7 @@ static void btc_a2dp_source_enc_init(BT_HDR *p_msg)
|
|||
static void btc_a2dp_source_enc_update(BT_HDR *p_msg)
|
||||
{
|
||||
tBTC_MEDIA_UPDATE_AUDIO *pUpdateAudio = (tBTC_MEDIA_UPDATE_AUDIO *) p_msg;
|
||||
SBC_ENC_PARAMS *pstrEncParams = &btc_aa_src_cb.encoder;
|
||||
SBC_ENC_PARAMS *pstrEncParams = &btc_sbc_encoder;
|
||||
UINT16 s16SamplingFreq;
|
||||
SINT16 s16BitPool = 0;
|
||||
SINT16 s16BitRate;
|
||||
|
@ -928,19 +955,19 @@ static void btc_a2dp_source_enc_update(BT_HDR *p_msg)
|
|||
if (s16BitPool > pUpdateAudio->MaxBitPool) {
|
||||
APPL_TRACE_DEBUG("%s computed bitpool too large (%d)", __FUNCTION__, s16BitPool);
|
||||
/* Decrease bitrate */
|
||||
btc_aa_src_cb.encoder.u16BitRate -= BTC_MEDIA_BITRATE_STEP;
|
||||
btc_sbc_encoder.u16BitRate -= BTC_MEDIA_BITRATE_STEP;
|
||||
/* Record that we have decreased the bitrate */
|
||||
protect |= 1;
|
||||
} else if (s16BitPool < pUpdateAudio->MinBitPool) {
|
||||
APPL_TRACE_WARNING("%s computed bitpool too small (%d)", __FUNCTION__, s16BitPool);
|
||||
|
||||
/* Increase bitrate */
|
||||
UINT16 previous_u16BitRate = btc_aa_src_cb.encoder.u16BitRate;
|
||||
btc_aa_src_cb.encoder.u16BitRate += BTC_MEDIA_BITRATE_STEP;
|
||||
UINT16 previous_u16BitRate = btc_sbc_encoder.u16BitRate;
|
||||
btc_sbc_encoder.u16BitRate += BTC_MEDIA_BITRATE_STEP;
|
||||
/* Record that we have increased the bitrate */
|
||||
protect |= 2;
|
||||
/* Check over-flow */
|
||||
if (btc_aa_src_cb.encoder.u16BitRate < previous_u16BitRate) {
|
||||
if (btc_sbc_encoder.u16BitRate < previous_u16BitRate) {
|
||||
protect |= 3;
|
||||
}
|
||||
} else {
|
||||
|
@ -957,10 +984,10 @@ static void btc_a2dp_source_enc_update(BT_HDR *p_msg)
|
|||
pstrEncParams->s16BitPool = s16BitPool;
|
||||
|
||||
APPL_TRACE_DEBUG("%s final bit rate %d, final bit pool %d", __FUNCTION__,
|
||||
btc_aa_src_cb.encoder.u16BitRate, btc_aa_src_cb.encoder.s16BitPool);
|
||||
btc_sbc_encoder.u16BitRate, btc_sbc_encoder.s16BitPool);
|
||||
|
||||
/* make sure we reinitialize encoder with new settings */
|
||||
SBC_Encoder_Init(&(btc_aa_src_cb.encoder));
|
||||
SBC_Encoder_Init(&(btc_sbc_encoder));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -991,10 +1018,10 @@ static void btc_a2dp_source_pcm2sbc_init(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_feedin
|
|||
case 32000:
|
||||
case 48000:
|
||||
/* For these sampling_freq the AV connection must be 48000 */
|
||||
if (btc_aa_src_cb.encoder.s16SamplingFreq != SBC_sf48000) {
|
||||
if (btc_sbc_encoder.s16SamplingFreq != SBC_sf48000) {
|
||||
/* Reconfiguration needed at 48000 */
|
||||
APPL_TRACE_DEBUG("SBC Reconfiguration needed at 48000");
|
||||
btc_aa_src_cb.encoder.s16SamplingFreq = SBC_sf48000;
|
||||
btc_sbc_encoder.s16SamplingFreq = SBC_sf48000;
|
||||
reconfig_needed = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -1003,10 +1030,10 @@ static void btc_a2dp_source_pcm2sbc_init(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_feedin
|
|||
case 22050:
|
||||
case 44100:
|
||||
/* For these sampling_freq the AV connection must be 44100 */
|
||||
if (btc_aa_src_cb.encoder.s16SamplingFreq != SBC_sf44100) {
|
||||
if (btc_sbc_encoder.s16SamplingFreq != SBC_sf44100) {
|
||||
/* Reconfiguration needed at 44100 */
|
||||
APPL_TRACE_DEBUG("SBC Reconfiguration needed at 44100");
|
||||
btc_aa_src_cb.encoder.s16SamplingFreq = SBC_sf44100;
|
||||
btc_sbc_encoder.s16SamplingFreq = SBC_sf44100;
|
||||
reconfig_needed = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -1016,21 +1043,21 @@ static void btc_a2dp_source_pcm2sbc_init(tBTC_MEDIA_INIT_AUDIO_FEEDING *p_feedin
|
|||
}
|
||||
|
||||
/* Some AV Headsets do not support Mono => always ask for Stereo */
|
||||
if (btc_aa_src_cb.encoder.s16ChannelMode == SBC_MONO) {
|
||||
if (btc_sbc_encoder.s16ChannelMode == SBC_MONO) {
|
||||
APPL_TRACE_DEBUG("SBC Reconfiguration needed in Stereo");
|
||||
btc_aa_src_cb.encoder.s16ChannelMode = SBC_JOINT_STEREO;
|
||||
btc_sbc_encoder.s16ChannelMode = SBC_JOINT_STEREO;
|
||||
reconfig_needed = TRUE;
|
||||
}
|
||||
|
||||
if (reconfig_needed != FALSE) {
|
||||
APPL_TRACE_DEBUG("%s :: mtu %d", __FUNCTION__, btc_aa_src_cb.TxAaMtuSize);
|
||||
APPL_TRACE_DEBUG("ch mode %d, nbsubd %d, nb %d, alloc %d, rate %d, freq %d",
|
||||
btc_aa_src_cb.encoder.s16ChannelMode,
|
||||
btc_aa_src_cb.encoder.s16NumOfSubBands, btc_aa_src_cb.encoder.s16NumOfBlocks,
|
||||
btc_aa_src_cb.encoder.s16AllocationMethod, btc_aa_src_cb.encoder.u16BitRate,
|
||||
btc_aa_src_cb.encoder.s16SamplingFreq);
|
||||
btc_sbc_encoder.s16ChannelMode,
|
||||
btc_sbc_encoder.s16NumOfSubBands, btc_sbc_encoder.s16NumOfBlocks,
|
||||
btc_sbc_encoder.s16AllocationMethod, btc_sbc_encoder.u16BitRate,
|
||||
btc_sbc_encoder.s16SamplingFreq);
|
||||
|
||||
SBC_Encoder_Init(&(btc_aa_src_cb.encoder));
|
||||
SBC_Encoder_Init(&(btc_sbc_encoder));
|
||||
} else {
|
||||
APPL_TRACE_DEBUG("%s no SBC reconfig needed", __FUNCTION__);
|
||||
}
|
||||
|
@ -1105,8 +1132,8 @@ static UINT8 btc_get_num_aa_frame(void)
|
|||
|
||||
switch (btc_aa_src_cb.TxTranscoding) {
|
||||
case BTC_MEDIA_TRSCD_PCM_2_SBC: {
|
||||
UINT32 pcm_bytes_per_frame = btc_aa_src_cb.encoder.s16NumOfSubBands *
|
||||
btc_aa_src_cb.encoder.s16NumOfBlocks *
|
||||
UINT32 pcm_bytes_per_frame = btc_sbc_encoder.s16NumOfSubBands *
|
||||
btc_sbc_encoder.s16NumOfBlocks *
|
||||
btc_aa_src_cb.media_feeding.cfg.pcm.num_channel *
|
||||
btc_aa_src_cb.media_feeding.cfg.pcm.bit_per_sample / 8;
|
||||
|
||||
|
@ -1129,10 +1156,16 @@ static UINT8 btc_get_num_aa_frame(void)
|
|||
|
||||
/* calculate nbr of frames pending for this media tick */
|
||||
result = btc_aa_src_cb.media_feeding_state.pcm.counter / pcm_bytes_per_frame;
|
||||
if (result > MAX_PCM_FRAME_NUM_PER_TICK) {
|
||||
APPL_TRACE_WARNING("%s() - Limiting frames to be sent from %d to %d"
|
||||
, __FUNCTION__, result, MAX_PCM_FRAME_NUM_PER_TICK);
|
||||
result = MAX_PCM_FRAME_NUM_PER_TICK;
|
||||
|
||||
/* limit the frames to be sent */
|
||||
UINT32 frm_nb_threshold = MAX_OUTPUT_A2DP_SRC_FRAME_QUEUE_SZ - fixed_queue_length(btc_aa_src_cb.TxAaQ);
|
||||
if (frm_nb_threshold > MAX_PCM_FRAME_NUM_PER_TICK) {
|
||||
frm_nb_threshold = MAX_PCM_FRAME_NUM_PER_TICK;
|
||||
}
|
||||
|
||||
if (result > frm_nb_threshold) {
|
||||
APPL_TRACE_EVENT("Limit frms to send from %d to %d", result, frm_nb_threshold);
|
||||
result = frm_nb_threshold;
|
||||
}
|
||||
btc_aa_src_cb.media_feeding_state.pcm.counter -= result * pcm_bytes_per_frame;
|
||||
|
||||
|
@ -1162,12 +1195,12 @@ static UINT8 btc_get_num_aa_frame(void)
|
|||
|
||||
BOOLEAN btc_media_aa_read_feeding(void)
|
||||
{
|
||||
UINT16 blocm_x_subband = btc_aa_src_cb.encoder.s16NumOfSubBands * \
|
||||
btc_aa_src_cb.encoder.s16NumOfBlocks;
|
||||
UINT16 blocm_x_subband = btc_sbc_encoder.s16NumOfSubBands * \
|
||||
btc_sbc_encoder.s16NumOfBlocks;
|
||||
UINT32 read_size;
|
||||
UINT16 sbc_sampling = 48000;
|
||||
UINT32 src_samples;
|
||||
UINT16 bytes_needed = blocm_x_subband * btc_aa_src_cb.encoder.s16NumOfChannels * \
|
||||
UINT16 bytes_needed = blocm_x_subband * btc_sbc_encoder.s16NumOfChannels * \
|
||||
btc_aa_src_cb.media_feeding.cfg.pcm.bit_per_sample / 8;
|
||||
static UINT16 up_sampled_buffer[SBC_MAX_NUM_FRAME * SBC_MAX_NUM_OF_BLOCKS
|
||||
* SBC_MAX_NUM_OF_CHANNELS * SBC_MAX_NUM_OF_SUBBANDS * 2];
|
||||
|
@ -1181,7 +1214,7 @@ BOOLEAN btc_media_aa_read_feeding(void)
|
|||
UINT32 nb_byte_read = 0;
|
||||
|
||||
/* Get the SBC sampling rate */
|
||||
switch (btc_aa_src_cb.encoder.s16SamplingFreq) {
|
||||
switch (btc_sbc_encoder.s16SamplingFreq) {
|
||||
case SBC_sf48000:
|
||||
sbc_sampling = 48000;
|
||||
break;
|
||||
|
@ -1199,7 +1232,7 @@ BOOLEAN btc_media_aa_read_feeding(void)
|
|||
if (sbc_sampling == btc_aa_src_cb.media_feeding.cfg.pcm.sampling_freq) {
|
||||
read_size = bytes_needed - btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue;
|
||||
nb_byte_read = btc_aa_src_data_read(
|
||||
((uint8_t *)btc_aa_src_cb.encoder.as16PcmBuffer) +
|
||||
((uint8_t *)btc_sbc_encoder.as16PcmBuffer) +
|
||||
btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue,
|
||||
read_size);
|
||||
if (nb_byte_read == read_size) {
|
||||
|
@ -1293,7 +1326,7 @@ BOOLEAN btc_media_aa_read_feeding(void)
|
|||
/* only copy the pcm sample when we have up-sampled enough PCM */
|
||||
if (btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue >= bytes_needed) {
|
||||
/* Copy the output pcm samples in SBC encoding buffer */
|
||||
memcpy((UINT8 *)btc_aa_src_cb.encoder.as16PcmBuffer,
|
||||
memcpy((UINT8 *)btc_sbc_encoder.as16PcmBuffer,
|
||||
(UINT8 *)up_sampled_buffer,
|
||||
bytes_needed);
|
||||
/* update the residue */
|
||||
|
@ -1322,8 +1355,8 @@ BOOLEAN btc_media_aa_read_feeding(void)
|
|||
static void btc_media_aa_prep_sbc_2_send(UINT8 nb_frame)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
UINT16 blocm_x_subband = btc_aa_src_cb.encoder.s16NumOfSubBands *
|
||||
btc_aa_src_cb.encoder.s16NumOfBlocks;
|
||||
UINT16 blocm_x_subband = btc_sbc_encoder.s16NumOfSubBands *
|
||||
btc_sbc_encoder.s16NumOfBlocks;
|
||||
|
||||
while (nb_frame) {
|
||||
if (NULL == (p_buf = osi_malloc(BTC_MEDIA_AA_BUF_SIZE))) {
|
||||
|
@ -1339,27 +1372,27 @@ static void btc_media_aa_prep_sbc_2_send(UINT8 nb_frame)
|
|||
|
||||
do {
|
||||
/* Write @ of allocated buffer in encoder.pu8Packet */
|
||||
btc_aa_src_cb.encoder.pu8Packet = (UINT8 *) (p_buf + 1) + p_buf->offset + p_buf->len;
|
||||
btc_sbc_encoder.pu8Packet = (UINT8 *) (p_buf + 1) + p_buf->offset + p_buf->len;
|
||||
/* Fill allocated buffer with 0 */
|
||||
memset(btc_aa_src_cb.encoder.as16PcmBuffer, 0, blocm_x_subband
|
||||
* btc_aa_src_cb.encoder.s16NumOfChannels);
|
||||
memset(btc_sbc_encoder.as16PcmBuffer, 0, blocm_x_subband
|
||||
* btc_sbc_encoder.s16NumOfChannels);
|
||||
|
||||
/* Read PCM data and upsample them if needed */
|
||||
if (btc_media_aa_read_feeding()) {
|
||||
/* SBC encode and descramble frame */
|
||||
SBC_Encoder(&(btc_aa_src_cb.encoder));
|
||||
A2D_SbcChkFrInit(btc_aa_src_cb.encoder.pu8Packet);
|
||||
A2D_SbcDescramble(btc_aa_src_cb.encoder.pu8Packet, btc_aa_src_cb.encoder.u16PacketLength);
|
||||
SBC_Encoder(&(btc_sbc_encoder));
|
||||
A2D_SbcChkFrInit(btc_sbc_encoder.pu8Packet);
|
||||
A2D_SbcDescramble(btc_sbc_encoder.pu8Packet, btc_sbc_encoder.u16PacketLength);
|
||||
/* Update SBC frame length */
|
||||
p_buf->len += btc_aa_src_cb.encoder.u16PacketLength;
|
||||
p_buf->len += btc_sbc_encoder.u16PacketLength;
|
||||
nb_frame--;
|
||||
p_buf->layer_specific++;
|
||||
} else {
|
||||
APPL_TRACE_WARNING("btc_media_aa_prep_sbc_2_send underflow %d, %d",
|
||||
nb_frame, btc_aa_src_cb.media_feeding_state.pcm.aa_feed_residue);
|
||||
btc_aa_src_cb.media_feeding_state.pcm.counter += nb_frame *
|
||||
btc_aa_src_cb.encoder.s16NumOfSubBands *
|
||||
btc_aa_src_cb.encoder.s16NumOfBlocks *
|
||||
btc_sbc_encoder.s16NumOfSubBands *
|
||||
btc_sbc_encoder.s16NumOfBlocks *
|
||||
btc_aa_src_cb.media_feeding.cfg.pcm.num_channel *
|
||||
btc_aa_src_cb.media_feeding.cfg.pcm.bit_per_sample / 8;
|
||||
/* no more pcm to read */
|
||||
|
@ -1372,7 +1405,7 @@ static void btc_media_aa_prep_sbc_2_send(UINT8 nb_frame)
|
|||
}
|
||||
}
|
||||
|
||||
} while (((p_buf->len + btc_aa_src_cb.encoder.u16PacketLength) < btc_aa_src_cb.TxAaMtuSize)
|
||||
} while (((p_buf->len + btc_sbc_encoder.u16PacketLength) < btc_aa_src_cb.TxAaMtuSize)
|
||||
&& (p_buf->layer_specific < 0x0F) && nb_frame);
|
||||
|
||||
if (p_buf->len) {
|
||||
|
|
|
@ -1199,10 +1199,13 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
|
|||
BTC_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status);
|
||||
}
|
||||
}
|
||||
UNUSED(que_len);
|
||||
}
|
||||
#else
|
||||
static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
|
||||
{
|
||||
UNUSED(event);
|
||||
UNUSED(p_data);
|
||||
BTC_TRACE_WARNING("%s : event %u\n", __func__, event);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -335,6 +335,8 @@ static void handle_rc_passthrough_rsp ( tBTA_AV_REMOTE_RSP *p_remote_rsp)
|
|||
} else {
|
||||
BTC_TRACE_ERROR("%s DUT does not support AVRCP controller role", __FUNCTION__);
|
||||
}
|
||||
|
||||
UNUSED(status);
|
||||
#else
|
||||
BTC_TRACE_ERROR("%s AVRCP controller role is not enabled", __FUNCTION__);
|
||||
#endif
|
||||
|
|
|
@ -426,6 +426,35 @@ static void btc_stop_adv_callback(uint8_t status)
|
|||
}
|
||||
}
|
||||
|
||||
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg;
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT;
|
||||
param.update_duplicate_exceptional_list_cmpl.status = status;
|
||||
param.update_duplicate_exceptional_list_cmpl.subcode = subcode;
|
||||
if(length > sizeof(param.update_duplicate_exceptional_list_cmpl.device_info)) {
|
||||
length = sizeof(param.update_duplicate_exceptional_list_cmpl.device_info);
|
||||
}
|
||||
param.update_duplicate_exceptional_list_cmpl.length = length;
|
||||
memcpy(param.update_duplicate_exceptional_list_cmpl.device_info, device_info, length);
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_ble_update_duplicate_exceptional_list(uint8_t subcode, uint32_t info_type, BD_ADDR device_info,
|
||||
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_ignore_list_cback)
|
||||
{
|
||||
BTA_DmUpdateDuplicateExceptionalList(subcode, info_type, device_info, p_update_duplicate_ignore_list_cback);
|
||||
}
|
||||
|
||||
static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBTA_START_ADV_CMPL_CBACK start_adv_cback)
|
||||
{
|
||||
tBLE_BD_ADDR peer_addr;
|
||||
|
@ -452,6 +481,10 @@ static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBT
|
|||
status = ESP_BT_STATUS_PARM_INVALID;
|
||||
BTC_TRACE_ERROR("Invalid advertisting channel map parameters.\n");
|
||||
}
|
||||
if (!BLE_ISVALID_PARAM(ble_adv_params->peer_addr_type, BLE_ADDR_TYPE_PUBLIC, BLE_ADDR_TYPE_RANDOM)) {
|
||||
status = ESP_BT_STATUS_PARM_INVALID;
|
||||
BTC_TRACE_ERROR("Invalid advertisting peer address type parameters.\n");
|
||||
}
|
||||
if(status != ESP_BT_STATUS_SUCCESS) {
|
||||
if(start_adv_cback) {
|
||||
start_adv_cback(status);
|
||||
|
@ -571,6 +604,9 @@ static void btc_search_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data
|
|||
case BTA_DM_SEARCH_CANCEL_CMPL_EVT:
|
||||
BTC_TRACE_DEBUG("BTA_DM_SEARCH_CANCEL_CMPL_EVT\n");
|
||||
break;
|
||||
case BTA_DM_INQ_DISCARD_NUM_EVT:
|
||||
param.scan_rst.num_dis = p_data->inq_dis.num_dis;
|
||||
break;
|
||||
default:
|
||||
BTC_TRACE_ERROR("%s : Unknown event 0x%x\n", __FUNCTION__, event);
|
||||
return;
|
||||
|
@ -831,7 +867,7 @@ static void btc_ble_set_rand_addr (BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *
|
|||
BTA_DmSetRandAddress(rand_addr, btc_set_rand_addr_callback);
|
||||
} else {
|
||||
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
|
||||
BTC_TRACE_ERROR("Invalid random address, the high bit should be 0b11, all bits of the random part shall not be to 1 or 0");
|
||||
BTC_TRACE_ERROR("Invalid random address, the high bit should be 0b11, bits of the random part shall not be all 1 or 0");
|
||||
}
|
||||
} else {
|
||||
btc_set_rand_addr_callback(BTM_INVALID_STATIC_RAND_ADDR);
|
||||
|
@ -1082,6 +1118,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
|||
arg->cfg_scan_rsp_data_raw.raw_scan_rsp_len,
|
||||
btc_scan_rsp_data_raw_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST:
|
||||
btc_ble_update_duplicate_exceptional_list(arg->update_duplicate_exceptional_list.subcode,
|
||||
arg->update_duplicate_exceptional_list.info_type,
|
||||
arg->update_duplicate_exceptional_list.device_info,
|
||||
btc_update_duplicate_exceptional_list_callback);
|
||||
break;
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
case BTC_GAP_BLE_SET_ENCRYPTION_EVT: {
|
||||
BD_ADDR bd_addr;
|
||||
|
|
|
@ -750,7 +750,7 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
|
|||
break;
|
||||
#endif ///BT_SSP_INCLUDED == TRUE
|
||||
default:
|
||||
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
|
||||
BTC_TRACE_ERROR("Unhandled deep copy %d, arg: %p\n", msg->act, arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -690,10 +690,13 @@ void btc_gatts_call_handler(btc_msg_t *msg)
|
|||
#else
|
||||
//BTA_DmAddBleDevice(p_cb->bd_addr.address, addr_type, device_type);
|
||||
#endif
|
||||
/*
|
||||
not support background connection
|
||||
// Mark background connections
|
||||
if (!arg->open.is_direct) {
|
||||
BTA_DmBleSetBgConnType(BTM_BLE_CONN_AUTO, NULL);
|
||||
}
|
||||
*/
|
||||
|
||||
transport = BTA_GATT_TRANSPORT_LE;
|
||||
|
||||
|
@ -802,6 +805,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
|
|||
gatts_if = BTC_GATT_GET_GATT_IF(p_data->req_data.conn_id);
|
||||
param.conf.conn_id = BTC_GATT_GET_CONN_ID(p_data->req_data.conn_id);
|
||||
param.conf.status = p_data->req_data.status;
|
||||
param.conf.handle = p_data->req_data.handle;
|
||||
|
||||
if (p_data->req_data.status != ESP_GATT_OK && p_data->req_data.value){
|
||||
param.conf.len = p_data->req_data.data_len;
|
||||
|
|
|
@ -195,8 +195,9 @@ bt_status_t btc_hf_client_init(void)
|
|||
*******************************************************************************/
|
||||
static bt_status_t connect_int( bt_bdaddr_t *bd_addr, uint16_t uuid )
|
||||
{
|
||||
if (is_connected(bd_addr))
|
||||
if (is_connected(bd_addr)) {
|
||||
return BT_STATUS_BUSY;
|
||||
}
|
||||
|
||||
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_CONNECTING;
|
||||
bdcpy(btc_hf_client_cb.connected_bda.address, bd_addr->address);
|
||||
|
@ -713,14 +714,14 @@ static void process_ind_evt(tBTA_HF_CLIENT_IND *ind)
|
|||
{
|
||||
esp_hf_client_cb_param_t param;
|
||||
memset(¶m, 0, sizeof(esp_hf_client_cb_param_t));
|
||||
|
||||
|
||||
switch (ind->type)
|
||||
{
|
||||
case BTA_HF_CLIENT_IND_CALL:
|
||||
param.call.status = ind->value;
|
||||
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CIND_CALL_EVT, ¶m);
|
||||
break;
|
||||
|
||||
|
||||
case BTA_HF_CLIENT_IND_CALLSETUP:
|
||||
param.call_setup.status = ind->value;
|
||||
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CIND_CALL_SETUP_EVT, ¶m);
|
||||
|
@ -787,6 +788,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
|||
{
|
||||
BTC_TRACE_WARNING("%s: HF CLient open failed, but another device connected. status=%d state=%d connected device=%s",
|
||||
__FUNCTION__, p_data->open.status, btc_hf_client_cb.state, bdaddr_to_string(&btc_hf_client_cb.connected_bda, bdstr, sizeof(bdstr)));
|
||||
UNUSED(bdstr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -795,18 +797,20 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
|||
param.conn_stat.state = btc_hf_client_cb.state;
|
||||
param.conn_stat.peer_feat = 0;
|
||||
param.conn_stat.chld_feat = 0;
|
||||
|
||||
|
||||
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
|
||||
sizeof(esp_bd_addr_t));
|
||||
|
||||
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, ¶m);
|
||||
} while (0);
|
||||
|
||||
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED)
|
||||
bdsetany(btc_hf_client_cb.connected_bda.address);
|
||||
|
||||
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS)
|
||||
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED) {
|
||||
bdsetany(btc_hf_client_cb.connected_bda.address);
|
||||
}
|
||||
|
||||
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS) {
|
||||
btc_queue_advance();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -820,13 +824,13 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
|||
param.conn_stat.state = btc_hf_client_cb.state;
|
||||
param.conn_stat.peer_feat = btc_hf_client_cb.peer_feat;
|
||||
param.conn_stat.chld_feat = btc_hf_client_cb.chld_feat;
|
||||
|
||||
|
||||
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
|
||||
sizeof(esp_bd_addr_t));
|
||||
|
||||
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, ¶m);
|
||||
} while (0);
|
||||
|
||||
|
||||
/* Inform the application about in-band ringtone */
|
||||
if (btc_hf_client_cb.peer_feat & BTA_HF_CLIENT_PEER_INBAND)
|
||||
{
|
||||
|
@ -839,7 +843,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
|||
|
||||
btc_queue_advance();
|
||||
break;
|
||||
|
||||
|
||||
case BTA_HF_CLIENT_CLOSE_EVT:
|
||||
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED;
|
||||
do {
|
||||
|
@ -847,7 +851,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
|||
param.conn_stat.state = ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED;
|
||||
param.conn_stat.peer_feat = 0;
|
||||
param.conn_stat.chld_feat = 0;
|
||||
|
||||
|
||||
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
|
||||
sizeof(esp_bd_addr_t));
|
||||
|
||||
|
@ -980,7 +984,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
|||
memset(¶m, 0, sizeof(esp_hf_client_cb_param_t));
|
||||
param.audio_stat.state = ESP_HF_CLIENT_AUDIO_STATE_CONNECTED;
|
||||
memcpy(param.audio_stat.remote_bda, &btc_hf_client_cb.connected_bda,
|
||||
sizeof(esp_bd_addr_t));
|
||||
sizeof(esp_bd_addr_t));
|
||||
btc_hf_client_cb_to_app(ESP_HF_CLIENT_AUDIO_STATE_EVT, ¶m);
|
||||
} while (0);
|
||||
break;
|
||||
|
@ -989,7 +993,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
|||
memset(¶m, 0, sizeof(esp_hf_client_cb_param_t));
|
||||
param.audio_stat.state = ESP_HF_CLIENT_AUDIO_STATE_CONNECTED_MSBC;
|
||||
memcpy(param.audio_stat.remote_bda, &btc_hf_client_cb.connected_bda,
|
||||
sizeof(esp_bd_addr_t));
|
||||
sizeof(esp_bd_addr_t));
|
||||
btc_hf_client_cb_to_app(ESP_HF_CLIENT_AUDIO_STATE_EVT, ¶m);
|
||||
} while (0);
|
||||
break;
|
||||
|
|
|
@ -46,6 +46,7 @@ typedef enum {
|
|||
BTC_GAP_BLE_CONFIRM_REPLY_EVT,
|
||||
BTC_GAP_BLE_DISCONNECT_EVT,
|
||||
BTC_GAP_BLE_REMOVE_BOND_DEV_EVT,
|
||||
BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST,
|
||||
} btc_gap_ble_act_t;
|
||||
|
||||
/* btc_ble_gap_args_t */
|
||||
|
@ -94,6 +95,12 @@ typedef union {
|
|||
bool add_remove;
|
||||
esp_bd_addr_t remote_bda;
|
||||
}update_white_list;
|
||||
//BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST
|
||||
struct update_duplicate_exceptional_list_args {
|
||||
uint8_t subcode;
|
||||
uint32_t info_type;
|
||||
esp_duplicate_info_t device_info;
|
||||
}update_duplicate_exceptional_list;
|
||||
//BTC_GAP_BLE_ACT_SET_CONN_PARAMS
|
||||
struct set_conn_params_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef struct {
|
|||
list_t *list;
|
||||
list_t *incoming_list;
|
||||
uint8_t service_uuid[16];
|
||||
char service_name[ESP_SPP_SERVER_NAME_MAX];
|
||||
char service_name[ESP_SPP_SERVER_NAME_MAX + 1];
|
||||
} spp_slot_t;
|
||||
|
||||
static struct spp_local_param_t {
|
||||
|
@ -204,6 +204,7 @@ static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *u
|
|||
slot->connected = TRUE;
|
||||
slot->rfc_handle = p_data->rfc_srv_open.handle;
|
||||
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.handle);
|
||||
BTA_JvSetPmProfile(p_data->rfc_srv_open.handle, BTA_JV_PM_ALL, BTA_JV_CONN_OPEN);
|
||||
break;
|
||||
case BTA_JV_RFCOMM_OPEN_EVT:
|
||||
slot = spp_find_slot_by_id(id);
|
||||
|
@ -214,6 +215,7 @@ static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *u
|
|||
slot->connected = TRUE;
|
||||
slot->rfc_handle = p_data->rfc_open.handle;
|
||||
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_open.handle);
|
||||
BTA_JvSetPmProfile(p_data->rfc_open.handle, BTA_JV_PM_ID_1, BTA_JV_CONN_OPEN);
|
||||
break;
|
||||
case BTA_JV_RFCOMM_CLOSE_EVT:
|
||||
slot = spp_find_slot_by_id(id);
|
||||
|
@ -313,6 +315,7 @@ static void btc_spp_init(btc_spp_args_t *arg)
|
|||
{
|
||||
if (osi_mutex_new(&spp_local_param.spp_slot_mutex) != 0) {
|
||||
BTC_TRACE_ERROR("%s osi_mutex_new failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
spp_local_param.spp_mode = arg->init.mode;
|
||||
spp_local_param.spp_slot_id = 0;
|
||||
|
@ -321,6 +324,10 @@ static void btc_spp_init(btc_spp_args_t *arg)
|
|||
|
||||
static void btc_spp_uninit(void)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
|
||||
|
|
|
@ -130,11 +130,45 @@
|
|||
#define BLE_PRIVACY_SPT FALSE
|
||||
#endif /* CONFIG_SMP_ENABLE */
|
||||
|
||||
#ifdef CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE
|
||||
#if(CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE)
|
||||
#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE TRUE
|
||||
#else
|
||||
#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
|
||||
#endif
|
||||
#else
|
||||
#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL FALSE
|
||||
#else
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED
|
||||
#endif /* CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED */
|
||||
|
||||
#ifndef CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM 100
|
||||
#else
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
|
||||
#endif /* CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM */
|
||||
|
||||
#ifndef CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
|
||||
#define BLE_ADV_REPORT_DISCARD_THRSHOLD 20
|
||||
#else
|
||||
#define BLE_ADV_REPORT_DISCARD_THRSHOLD CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
|
||||
#endif /* CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD */
|
||||
|
||||
#if (CONFIG_BT_ACL_CONNECTIONS)
|
||||
#define MAX_ACL_CONNECTIONS CONFIG_BT_ACL_CONNECTIONS
|
||||
#define GATT_MAX_PHY_CHANNEL CONFIG_BT_ACL_CONNECTIONS
|
||||
#endif /* CONFIG_BT_ACL_CONNECTIONS */
|
||||
|
||||
#if(CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT)
|
||||
#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT
|
||||
#else
|
||||
#define BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT 30
|
||||
#endif
|
||||
|
||||
//------------------Added from bdroid_buildcfg.h---------------------
|
||||
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
|
||||
#define L2CAP_EXTFEA_SUPPORTED_MASK (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | L2CAP_EXTFEA_FIXED_CHNLS)
|
||||
|
@ -324,6 +358,12 @@
|
|||
#define GATTS_SEND_SERVICE_CHANGE_MODE CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
|
||||
#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY FALSE
|
||||
#else
|
||||
#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
|
||||
#endif
|
||||
|
||||
/* This feature is used to eanble interleaved scan*/
|
||||
#ifndef BTA_HOST_INTERLEAVE_SEARCH
|
||||
#define BTA_HOST_INTERLEAVE_SEARCH FALSE//FALSE
|
||||
|
@ -362,6 +402,9 @@
|
|||
#ifndef BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS
|
||||
#define BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS 7000
|
||||
#endif
|
||||
#ifndef BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS
|
||||
#define BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS 5000
|
||||
#endif
|
||||
|
||||
//------------------End added from bdroid_buildcfg.h---------------------
|
||||
|
||||
|
@ -617,9 +660,18 @@
|
|||
*/
|
||||
#define BTA_DM_COD_LOUDSPEAKER {0x2C, 0x04, 0x14}
|
||||
|
||||
/*
|
||||
* {SERVICE_CLASS, MAJOR_CLASS, MINOR_CLASS}
|
||||
*
|
||||
* SERVICE_CLASS:0x00 None
|
||||
* MAJOR_CLASS:0x1f - Uncategorized: device code not specified
|
||||
* MINOR_CLASS:0x00 - None
|
||||
*/
|
||||
#define BTA_DM_COD_UNCLASSIFIED {0x00, 0x1f, 0x00}
|
||||
|
||||
/* Default class of device */
|
||||
#ifndef BTA_DM_COD
|
||||
#define BTA_DM_COD BTA_DM_COD_LOUDSPEAKER
|
||||
#define BTA_DM_COD BTA_DM_COD_UNCLASSIFIED
|
||||
#endif
|
||||
|
||||
/* The number of SCO links. */
|
||||
|
|
|
@ -100,7 +100,11 @@ static void start_up(void)
|
|||
response = AWAIT_COMMAND(packet_factory->make_set_c2h_flow_control(HCI_HOST_FLOW_CTRL_ACL_ON));
|
||||
packet_parser->parse_generic_command_complete(response);
|
||||
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
|
||||
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
// Enable adv flow control
|
||||
response = AWAIT_COMMAND(packet_factory->make_set_adv_report_flow_control(HCI_HOST_FLOW_CTRL_ADV_REPORT_ON, (uint16_t)BLE_ADV_REPORT_FLOW_CONTROL_NUM, (uint16_t)BLE_ADV_REPORT_DISCARD_THRSHOLD));
|
||||
packet_parser->parse_generic_command_complete(response);
|
||||
#endif
|
||||
// Tell the controller about our buffer sizes and buffer counts next
|
||||
// TODO(zachoverflow): factor this out. eww l2cap contamination. And why just a hardcoded 10?
|
||||
response = AWAIT_COMMAND(
|
||||
|
@ -250,10 +254,10 @@ static void start_up(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (simple_pairing_supported) {
|
||||
response = AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
|
||||
packet_parser->parse_generic_command_complete(response);
|
||||
}
|
||||
|
||||
response = AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
|
||||
packet_parser->parse_generic_command_complete(response);
|
||||
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
response = AWAIT_COMMAND(packet_factory->make_write_sync_flow_control_enable(1));
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#define CASE_RETURN_STR(const) case const: return #const;
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
static const char *interop_feature_string(const interop_feature_t feature)
|
||||
{
|
||||
switch (feature) {
|
||||
|
@ -36,7 +37,7 @@ static const char *interop_feature_string(const interop_feature_t feature)
|
|||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
#endif // (!CONFIG_BT_STACK_NO_LOG)
|
||||
// Interface functions
|
||||
bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
|
||||
{
|
||||
|
@ -47,7 +48,9 @@ bool interop_match(const interop_feature_t feature, const bt_bdaddr_t *addr)
|
|||
for (size_t i = 0; i != db_size; ++i) {
|
||||
if (feature == interop_database[i].feature &&
|
||||
memcmp(addr, &interop_database[i].addr, interop_database[i].len) == 0) {
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
char bdstr[20] = {0};
|
||||
#endif
|
||||
LOG_WARN("%s() Device %s is a match for interop workaround %s", __func__,
|
||||
bdaddr_to_string(addr, bdstr, sizeof(bdstr)), interop_feature_string(feature));
|
||||
return true;
|
||||
|
|
|
@ -145,9 +145,10 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
|
|||
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
|
||||
if (*(ps16GenBufPtr) < s32BitSlice + 2) {
|
||||
*(ps16GenArrPtr) = 0;
|
||||
} else
|
||||
} else {
|
||||
*(ps16GenArrPtr) = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
|
||||
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
|
||||
}
|
||||
|
||||
ps16GenBufPtr++;
|
||||
ps16GenArrPtr++;
|
||||
|
|
|
@ -132,9 +132,10 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
|
|||
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
|
||||
if (*ps16GenBufPtr < s32BitSlice + 2) {
|
||||
*ps16GenArrPtr = 0;
|
||||
} else
|
||||
} else {
|
||||
*ps16GenArrPtr = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
|
||||
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
|
||||
}
|
||||
ps16GenBufPtr++;
|
||||
ps16GenArrPtr++;
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
#include "hci/hci_layer.h"
|
||||
#include "osi/thread.h"
|
||||
#include "esp_bt.h"
|
||||
#include "stack/hcimsgs.h"
|
||||
|
||||
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
|
||||
#include "l2c_int.h"
|
||||
#include "stack/hcimsgs.h"
|
||||
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
|
||||
|
||||
#define HCI_HAL_SERIAL_BUFFER_SIZE 1026
|
||||
|
@ -55,6 +55,7 @@ static const uint16_t outbound_event_types[] = {
|
|||
typedef struct {
|
||||
size_t buffer_size;
|
||||
fixed_queue_t *rx_q;
|
||||
uint16_t adv_free_num;
|
||||
} hci_hal_env_t;
|
||||
|
||||
|
||||
|
@ -81,6 +82,7 @@ static void hci_hal_env_init(
|
|||
assert(max_buffer_count > 0);
|
||||
|
||||
hci_hal_env.buffer_size = buffer_size;
|
||||
hci_hal_env.adv_free_num = 0;
|
||||
|
||||
hci_hal_env.rx_q = fixed_queue_new(max_buffer_count);
|
||||
if (hci_hal_env.rx_q) {
|
||||
|
@ -102,8 +104,11 @@ static bool hal_open(const hci_hal_callbacks_t *upper_callbacks)
|
|||
{
|
||||
assert(upper_callbacks != NULL);
|
||||
callbacks = upper_callbacks;
|
||||
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
hci_hal_env_init(HCI_HAL_SERIAL_BUFFER_SIZE, BLE_ADV_REPORT_FLOW_CONTROL_NUM + L2CAP_HOST_FC_ACL_BUFS + QUEUE_SIZE_MAX); // adv flow control num + ACL flow control num + hci cmd numeber
|
||||
#else
|
||||
hci_hal_env_init(HCI_HAL_SERIAL_BUFFER_SIZE, QUEUE_SIZE_MAX);
|
||||
#endif
|
||||
|
||||
xHciH4Queue = xQueueCreate(HCI_H4_QUEUE_LEN, sizeof(BtTaskEvt_t));
|
||||
xTaskCreatePinnedToCore(hci_hal_h4_rx_handler, HCI_H4_TASK_NAME, HCI_H4_TASK_STACK_SIZE, NULL, HCI_H4_TASK_PRIO, &xHciH4TaskHandle, HCI_H4_TASK_PINNED_TO_CORE);
|
||||
|
@ -223,12 +228,37 @@ static void hci_packet_complete(BT_HDR *packet){
|
|||
bool host_recv_adv_packet(BT_HDR *packet)
|
||||
{
|
||||
assert(packet);
|
||||
if(packet->data[0] == DATA_TYPE_EVENT && packet->data[1] == HCI_BLE_EVENT && packet->data[3] == HCI_BLE_ADV_PKT_RPT_EVT) {
|
||||
return true;
|
||||
if(packet->data[0] == DATA_TYPE_EVENT && packet->data[1] == HCI_BLE_EVENT) {
|
||||
if(packet->data[3] == HCI_BLE_ADV_PKT_RPT_EVT
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
|| packet->data[3] == HCI_BLE_ADV_DISCARD_REPORT_EVT
|
||||
#endif
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
static void hci_update_adv_report_flow_control(BT_HDR *packet)
|
||||
{
|
||||
// this is adv packet
|
||||
if(host_recv_adv_packet(packet)) {
|
||||
// update adv free number
|
||||
hci_hal_env.adv_free_num ++;
|
||||
if (esp_vhci_host_check_send_available()){
|
||||
// send hci cmd
|
||||
btsnd_hcic_ble_update_adv_report_flow_control(hci_hal_env.adv_free_num);
|
||||
hci_hal_env.adv_free_num = 0;
|
||||
} else {
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
|
||||
{
|
||||
uint8_t type, hdr_size;
|
||||
|
@ -247,8 +277,10 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
|
|||
packet->offset++;
|
||||
packet->len--;
|
||||
if (type == HCI_BLE_EVENT) {
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
uint8_t len = 0;
|
||||
STREAM_TO_UINT8(len, stream);
|
||||
#endif
|
||||
HCI_TRACE_ERROR("Workround stream corrupted during LE SCAN: pkt_len=%d ble_event_len=%d\n",
|
||||
packet->len, len);
|
||||
osi_free(packet);
|
||||
|
@ -282,6 +314,11 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
|
|||
osi_free(packet);
|
||||
return;
|
||||
}
|
||||
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
hci_update_adv_report_flow_control(packet);
|
||||
#endif
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
if(BTU_check_queue_is_congest() && host_recv_adv_packet(packet)) {
|
||||
HCI_TRACE_ERROR("BtuQueue is congested");
|
||||
|
@ -289,7 +326,6 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)];
|
||||
callbacks->packet_ready(packet);
|
||||
}
|
||||
|
@ -332,7 +368,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
|||
pkt->layer_specific = 0;
|
||||
memcpy(pkt->data, data, len);
|
||||
fixed_queue_enqueue(hci_hal_env.rx_q, pkt);
|
||||
hci_hal_h4_task_post(100 / portTICK_PERIOD_MS);
|
||||
hci_hal_h4_task_post(0);
|
||||
|
||||
BTTRC_DUMP_BUFFER("Recv Pkt", pkt->data, len);
|
||||
|
||||
|
|
|
@ -317,7 +317,11 @@ static void event_command_ready(fixed_queue_t *queue)
|
|||
|
||||
wait_entry = fixed_queue_dequeue(queue);
|
||||
|
||||
if(wait_entry->opcode == HCI_HOST_NUM_PACKETS_DONE){
|
||||
if(wait_entry->opcode == HCI_HOST_NUM_PACKETS_DONE
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
|| wait_entry->opcode == HCI_VENDOR_BLE_ADV_REPORT_FLOW_CONTROL
|
||||
#endif
|
||||
){
|
||||
packet_fragmenter->fragment_and_dispatch(wait_entry->command);
|
||||
osi_free(wait_entry->command);
|
||||
osi_free(wait_entry);
|
||||
|
|
|
@ -53,6 +53,18 @@ static BT_HDR *make_set_c2h_flow_control(uint8_t enable)
|
|||
return packet;
|
||||
}
|
||||
|
||||
static BT_HDR *make_set_adv_report_flow_control(uint8_t enable, uint16_t num, uint16_t lost_threshold)
|
||||
{
|
||||
uint8_t *stream;
|
||||
const uint8_t parameter_size = 1 + 2 + 2;
|
||||
BT_HDR *packet = make_command(HCI_VENDOR_BLE_SET_ADV_FLOW_CONTROL, parameter_size, &stream);
|
||||
|
||||
UINT8_TO_STREAM(stream, enable);
|
||||
UINT16_TO_STREAM(stream, num);
|
||||
UINT16_TO_STREAM(stream, lost_threshold);
|
||||
return packet;
|
||||
}
|
||||
|
||||
static BT_HDR *make_host_buffer_size(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count)
|
||||
{
|
||||
uint8_t *stream;
|
||||
|
@ -239,6 +251,7 @@ static const hci_packet_factory_t interface = {
|
|||
make_reset,
|
||||
make_read_buffer_size,
|
||||
make_set_c2h_flow_control,
|
||||
make_set_adv_report_flow_control,
|
||||
make_host_buffer_size,
|
||||
make_read_local_version_info,
|
||||
make_read_bd_addr,
|
||||
|
|
|
@ -26,6 +26,7 @@ typedef struct {
|
|||
BT_HDR *(*make_reset)(void);
|
||||
BT_HDR *(*make_read_buffer_size)(void);
|
||||
BT_HDR *(*make_set_c2h_flow_control)(uint8_t enable);
|
||||
BT_HDR *(*make_set_adv_report_flow_control)(uint8_t enable, uint16_t num, uint16_t lost_threshold);
|
||||
BT_HDR *(*make_host_buffer_size)(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count);
|
||||
BT_HDR *(*make_read_local_version_info)(void);
|
||||
BT_HDR *(*make_read_bd_addr)(void);
|
||||
|
|
|
@ -96,7 +96,7 @@ typedef enum {
|
|||
#define BTC_A2DP_SOURCE_TASK_STACK_SIZE (CONFIG_A2DP_SOURCE_TASK_STACK_SIZE + BT_TASK_EXTRA_STACK_SIZE) // by menuconfig
|
||||
#define BTC_A2DP_SOURCE_TASK_NAME "BtA2dSourceT"
|
||||
#define BTC_A2DP_SOURCE_TASK_PRIO (configMAX_PRIORITIES - 3)
|
||||
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (3)
|
||||
#define BTC_A2DP_SOURCE_DATA_QUEUE_LEN (1)
|
||||
#define BTC_A2DP_SOURCE_CTRL_QUEUE_LEN (5)
|
||||
#define BTC_A2DP_SOURCE_TASK_QUEUE_SET_LEN (BTC_A2DP_SOURCE_DATA_QUEUE_LEN + BTC_A2DP_SOURCE_CTRL_QUEUE_LEN)
|
||||
|
||||
|
|
|
@ -61,8 +61,9 @@ bool list_contains(const list_t *list, const void *data)
|
|||
assert(data != NULL);
|
||||
|
||||
for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node)) {
|
||||
if (list_node(node) == data)
|
||||
if (list_node(node) == data) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -201,8 +202,9 @@ list_node_t *list_foreach(const list_t *list, list_iter_cb callback, void *conte
|
|||
|
||||
for (list_node_t *node = list->head; node; ) {
|
||||
list_node_t *next = node->next;
|
||||
if (!callback(node->data, context))
|
||||
if (!callback(node->data, context)) {
|
||||
return node;
|
||||
}
|
||||
node = next;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -605,8 +605,9 @@ void avct_lcb_free_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
|||
{
|
||||
UNUSED(p_lcb);
|
||||
|
||||
if (p_data == NULL)
|
||||
if (p_data == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
osi_free(p_data->p_buf);
|
||||
p_data->p_buf = NULL;
|
||||
|
|
|
@ -345,8 +345,10 @@ UINT8 *avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
|
|||
p += 2;
|
||||
BE_STREAM_TO_UINT32(ssrc, p);
|
||||
|
||||
UNUSED(ssrc);
|
||||
UNUSED(o_p);
|
||||
UNUSED(o_v);
|
||||
UNUSED(o_cc);
|
||||
|
||||
switch (pt) {
|
||||
case AVDT_RTCP_PT_SR: /* the packet type - SR (Sender Report) */
|
||||
|
@ -627,15 +629,19 @@ void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||
avdt_scb_hdl_pkt_frag(p_scb, p_data);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#if AVDT_REPORTING == TRUE
|
||||
if (p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT) {
|
||||
p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
|
||||
avdt_scb_hdl_report(p_scb, p, p_data->p_pkt->len);
|
||||
osi_free(p_data->p_pkt);
|
||||
p_data->p_pkt = NULL;
|
||||
osi_free(p_data->p_pkt);
|
||||
p_data->p_pkt = NULL;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
avdt_scb_hdl_pkt_no_frag(p_scb, p_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1303,7 +1309,9 @@ void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
|||
#if AVDT_MULTIPLEXING == TRUE
|
||||
if (fixed_queue_is_empty(p_scb->frag_q))
|
||||
#endif
|
||||
{
|
||||
avdt_scb_hdl_write_req_no_frag(p_scb, p_data);
|
||||
}
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
else {
|
||||
avdt_scb_hdl_write_req_frag(p_scb, p_data);
|
||||
|
|
|
@ -120,10 +120,11 @@ BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value)
|
|||
result = TRUE;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
if (!result) {
|
||||
AVRC_TRACE_ERROR(
|
||||
"avrc_is_valid_player_attrib_value() found not matching attrib(x%x)-value(x%x) pair!",
|
||||
attrib, value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -261,9 +261,10 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
|
|||
#if BLE_INCLUDED == TRUE
|
||||
p->transport = transport;
|
||||
#if BLE_PRIVACY_SPT == TRUE
|
||||
if (transport == BT_TRANSPORT_LE)
|
||||
if (transport == BT_TRANSPORT_LE) {
|
||||
btm_ble_refresh_local_resolvable_private_addr(bda,
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr);
|
||||
}
|
||||
#else
|
||||
p->conn_addr_type = BLE_ADDR_PUBLIC;
|
||||
memcpy(p->conn_addr, &controller_get_interface()->get_address()->address, BD_ADDR_LEN);
|
||||
|
@ -2495,15 +2496,17 @@ void btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, UINT16 *p_pkt_type)
|
|||
}
|
||||
|
||||
/* 2 and 3 MPS support? */
|
||||
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0]))
|
||||
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])) {
|
||||
/* Not supported. Add 'not_supported' mask for all 2MPS packet types */
|
||||
*p_pkt_type |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH1 + BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 +
|
||||
BTM_ACL_PKT_TYPES_MASK_NO_2_DH5);
|
||||
}
|
||||
|
||||
if (!HCI_EDR_ACL_3MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0]))
|
||||
if (!HCI_EDR_ACL_3MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])) {
|
||||
/* Not supported. Add 'not_supported' mask for all 3MPS packet types */
|
||||
*p_pkt_type |= (BTM_ACL_PKT_TYPES_MASK_NO_3_DH1 + BTM_ACL_PKT_TYPES_MASK_NO_3_DH3 +
|
||||
BTM_ACL_PKT_TYPES_MASK_NO_3_DH5);
|
||||
}
|
||||
|
||||
/* EDR 3 and 5 slot support? */
|
||||
if (HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
//#include "osi/include/log.h"
|
||||
|
||||
#if SMP_INCLUDED == TRUE
|
||||
// The temp variable to pass parameter between functions when in the connected event comeback.
|
||||
// The temp variable to pass parameter between functions when in the connected event callback.
|
||||
static BOOLEAN temp_enhanced = FALSE;
|
||||
extern BOOLEAN aes_cipher_msg_auth_code(BT_OCTET16 key, UINT8 *input, UINT16 length,
|
||||
UINT16 tlen, UINT8 *p_signature);
|
||||
|
@ -66,13 +66,14 @@ extern void gatt_notify_enc_cmpl(BD_ADDR bd_addr);
|
|||
** bd_name - Name of the peer device. NULL if unknown.
|
||||
** dev_type - Remote device's device type.
|
||||
** addr_type - LE device address type.
|
||||
** auth_mode - auth mode
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE dev_type,
|
||||
tBLE_ADDR_TYPE addr_type)
|
||||
tBLE_ADDR_TYPE addr_type, UINT32 auth_mode)
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec;
|
||||
UINT8 i = 0;
|
||||
|
@ -125,6 +126,7 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
|
|||
}
|
||||
p_dev_rec->device_type |= dev_type;
|
||||
p_dev_rec->ble.ble_addr_type = addr_type;
|
||||
p_dev_rec->ble.auth_mode = auth_mode;
|
||||
|
||||
memcpy (p_dev_rec->ble.pseudo_addr, bd_addr, BD_ADDR_LEN);
|
||||
/* sync up with the Inq Data base*/
|
||||
|
@ -443,25 +445,6 @@ void BTM_BleSetStaticPasskey(BOOLEAN add, UINT32 passkey)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleSetAcceptAuthMode
|
||||
**
|
||||
** Description This function is called to set only accept specified Authentication
|
||||
**
|
||||
**
|
||||
** Parameters: enable - Whether to enable this function
|
||||
**
|
||||
** auth_mode - Authentication mode
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleSetAcceptAuthMode(UINT8 enable, UINT8 auth_mode)
|
||||
{
|
||||
#if SMP_INCLUDED == TRUE
|
||||
SMP_SetAcceptAuthMode(enable, auth_mode);
|
||||
#endif
|
||||
}
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleConfirmReply
|
||||
|
@ -648,7 +631,7 @@ void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, tBLE_ADDR
|
|||
|
||||
*p_addr_type = BLE_ADDR_PUBLIC;
|
||||
|
||||
if (!p_dev_rec) {
|
||||
if (!p_dev_rec) {
|
||||
*p_dev_type = BT_DEVICE_TYPE_BREDR;
|
||||
/* Check with the BT manager if details about remote device are known */
|
||||
if (p_inq_info != NULL) {
|
||||
|
@ -904,8 +887,9 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
|||
return BTM_SEC_OK;
|
||||
}
|
||||
|
||||
if (security_required & BTM_SEC_OUT_MITM)
|
||||
if (security_required & BTM_SEC_OUT_MITM) {
|
||||
auth_req |= BTM_LE_AUTH_REQ_MITM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -915,8 +899,9 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
|||
return BTM_SEC_OK;
|
||||
}
|
||||
|
||||
if (security_required & BTM_SEC_IN_MITM)
|
||||
if (security_required & BTM_SEC_IN_MITM) {
|
||||
auth_req |= BTM_LE_AUTH_REQ_MITM;
|
||||
}
|
||||
}
|
||||
|
||||
tBTM_BLE_SEC_REQ_ACT ble_sec_act = BTM_BLE_SEC_REQ_ACT_NONE;
|
||||
|
@ -924,11 +909,13 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
|||
|
||||
BTM_TRACE_DEBUG ("%s ble_sec_act %d", __func__ , ble_sec_act);
|
||||
|
||||
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_DISCARD)
|
||||
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_DISCARD) {
|
||||
return BTM_SEC_ENC_PENDING;
|
||||
}
|
||||
|
||||
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_NONE)
|
||||
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_NONE) {
|
||||
return BTM_SEC_OK;
|
||||
}
|
||||
|
||||
UINT8 sec_flag = 0;
|
||||
BTM_GetSecurityFlagsByTransport(bdaddr, &sec_flag, BT_TRANSPORT_LE);
|
||||
|
@ -937,11 +924,13 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
|||
BOOLEAN is_key_mitm = FALSE;
|
||||
if (sec_flag & (BTM_SEC_FLAG_ENCRYPTED| BTM_SEC_FLAG_LKEY_KNOWN))
|
||||
{
|
||||
if (sec_flag & BTM_SEC_FLAG_ENCRYPTED)
|
||||
if (sec_flag & BTM_SEC_FLAG_ENCRYPTED) {
|
||||
is_link_encrypted = TRUE;
|
||||
}
|
||||
|
||||
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED)
|
||||
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED) {
|
||||
is_key_mitm = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (auth_req & BTM_LE_AUTH_REQ_MITM)
|
||||
|
@ -950,16 +939,18 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
|||
{
|
||||
return BTM_SEC_ENCRYPT_MITM;
|
||||
} else {
|
||||
if (is_link_encrypted)
|
||||
if (is_link_encrypted) {
|
||||
return BTM_SEC_OK;
|
||||
else
|
||||
} else {
|
||||
return BTM_SEC_ENCRYPT;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (is_link_encrypted)
|
||||
if (is_link_encrypted) {
|
||||
return BTM_SEC_OK;
|
||||
else
|
||||
} else {
|
||||
return BTM_SEC_ENCRYPT_NO_MITM;
|
||||
}
|
||||
}
|
||||
|
||||
return BTM_SEC_OK;
|
||||
|
@ -1029,8 +1020,9 @@ BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originat
|
|||
break;
|
||||
}
|
||||
|
||||
if (ble_sec_act == BTM_BLE_SEC_NONE)
|
||||
if (ble_sec_act == BTM_BLE_SEC_NONE) {
|
||||
return status;
|
||||
}
|
||||
|
||||
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_LE);
|
||||
p_lcb->sec_act = sec_act;
|
||||
|
@ -1485,13 +1477,14 @@ tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 lin
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
|
||||
// already have encrypted information, do not need to update connection parameters
|
||||
if(link_role == BTM_ROLE_SLAVE && (p_rec->ble.key_type & BTM_LE_KEY_PENC)) {
|
||||
p_rec->ble.skip_update_conn_param = true;
|
||||
} else {
|
||||
p_rec->ble.skip_update_conn_param = false;
|
||||
p_rec->ble.skip_update_conn_param = false;
|
||||
}
|
||||
#endif
|
||||
if (SMP_Pair(bd_addr) == SMP_STARTED) {
|
||||
cmd = BTM_CMD_STARTED;
|
||||
p_rec->sec_state = BTM_SEC_STATE_AUTHENTICATING;
|
||||
|
@ -1639,7 +1632,7 @@ void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable)
|
|||
/* to notify GATT to send data if any request is pending */
|
||||
gatt_notify_enc_cmpl(p_dev_rec->ble.pseudo_addr);
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1938,9 +1931,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
|
|||
UINT8 role, status, bda_type;
|
||||
UINT16 handle;
|
||||
BD_ADDR bda;
|
||||
#if (BLE_PRIVACY_SPT == TRUE)
|
||||
BD_ADDR local_rpa, peer_rpa;
|
||||
#endif ///BLE_PRIVACY_SPT == TRUE
|
||||
UINT16 conn_interval, conn_latency, conn_timeout;
|
||||
BOOLEAN match = FALSE;
|
||||
UNUSED(evt_len);
|
||||
|
@ -1951,24 +1942,23 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
|
|||
STREAM_TO_BDADDR (bda, p);
|
||||
BTM_TRACE_DEBUG("status = %d, handle = %d, role = %d, bda_type = %d",status,handle,role,bda_type);
|
||||
if (status == 0) {
|
||||
#if (BLE_PRIVACY_SPT == TRUE )
|
||||
peer_addr_type = bda_type;
|
||||
match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE);
|
||||
|
||||
if (enhanced) {
|
||||
STREAM_TO_BDADDR (local_rpa, p);
|
||||
STREAM_TO_BDADDR (peer_rpa, p);
|
||||
}
|
||||
#if (BLE_PRIVACY_SPT == TRUE )
|
||||
peer_addr_type = bda_type;
|
||||
match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE);
|
||||
|
||||
/* possiblly receive connection complete with resolvable random on
|
||||
slave role while the device has been paired */
|
||||
|
||||
/* It will cause that scanner doesn't send scan request to advertiser
|
||||
* which has sent IRK to us and we have stored the IRK in controller.
|
||||
* It is a design problem of hardware. The temporal solution is not to
|
||||
* send the key to the controller and then resolve the random address in host.
|
||||
* so we need send the real address information to controller to connect.
|
||||
* Once the connection is successful, resolve device address whether it is
|
||||
* It is a hardware limitation. The preliminary solution is not to
|
||||
* send key to the controller, but to resolve the random address in host.
|
||||
* so we need send the real address information to controller to connect.
|
||||
* Once the connection is successful, resolve device address whether it is
|
||||
* slave or master*/
|
||||
|
||||
/* if (!match && role == HCI_ROLE_SLAVE && BTM_BLE_IS_RESOLVE_BDA(bda)) { */
|
||||
|
@ -2013,9 +2003,18 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
|
|||
btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
btm_ble_update_mode_operation(role, bda, status);
|
||||
BOOLEAN bg_con = btm_ble_update_mode_operation(role, bda, status);
|
||||
if (status != HCI_SUCCESS && !bg_con) {
|
||||
// notify connection failed
|
||||
l2c_link_hci_disc_comp (handle, status);
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
/* Notify security manager */
|
||||
btm_sec_disconnected (handle, status);
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -312,9 +312,10 @@ void btm_ble_scan_pf_cmpl_cback(tBTM_VSC_CMPL *p_params)
|
|||
if (HCI_SUCCESS == status) {
|
||||
if (memcmp(&btm_ble_adv_filt_cb.cur_filter_target.bda, &na_bda, BD_ADDR_LEN) == 0) {
|
||||
btm_ble_cs_update_pf_counter(action, cond_type, NULL, num_avail);
|
||||
} else
|
||||
} else {
|
||||
btm_ble_cs_update_pf_counter(action, cond_type,
|
||||
&btm_ble_adv_filt_cb.cur_filter_target, num_avail);
|
||||
}
|
||||
}
|
||||
|
||||
/* send ADV PF operation complete */
|
||||
|
@ -855,9 +856,10 @@ tBTM_STATUS btm_ble_update_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
|
|||
len,
|
||||
param,
|
||||
btm_ble_scan_pf_cmpl_cback)) != BTM_NO_RESOURCES) {
|
||||
if (p_uuid_cond && p_uuid_cond->p_target_addr)
|
||||
if (p_uuid_cond && p_uuid_cond->p_target_addr) {
|
||||
memcpy(&btm_ble_adv_filt_cb.cur_filter_target, p_uuid_cond->p_target_addr,
|
||||
sizeof(tBLE_BD_ADDR));
|
||||
}
|
||||
else {
|
||||
memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
|
||||
}
|
||||
|
@ -914,15 +916,17 @@ tBTM_STATUS btm_ble_clear_scan_pf_filter(tBTM_BLE_SCAN_COND_OP action,
|
|||
/* clear manufactuer data filter */
|
||||
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
||||
BTM_BLE_PF_MANU_DATA, cb_evt, ref_value);
|
||||
if (BTM_CMD_STARTED == st)
|
||||
if (BTM_CMD_STARTED == st) {
|
||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_MANU_DATA, cb_evt,
|
||||
ref_value, NULL, NULL);
|
||||
}
|
||||
|
||||
/* clear local name filter */
|
||||
st = btm_ble_update_pf_local_name(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL);
|
||||
if (BTM_CMD_STARTED == st)
|
||||
if (BTM_CMD_STARTED == st) {
|
||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_LOCAL_NAME, cb_evt,
|
||||
ref_value, NULL, NULL);
|
||||
}
|
||||
|
||||
/* update the counter for service data */
|
||||
st = btm_ble_update_srvc_data_change(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL);
|
||||
|
@ -936,16 +940,18 @@ tBTM_STATUS btm_ble_clear_scan_pf_filter(tBTM_BLE_SCAN_COND_OP action,
|
|||
|
||||
st = btm_ble_update_uuid_filter(BTM_BLE_SCAN_COND_CLEAR, filt_index,
|
||||
BTM_BLE_PF_SRVC_SOL_UUID, NULL, cb_evt, ref_value);
|
||||
if (BTM_CMD_STARTED == st)
|
||||
if (BTM_CMD_STARTED == st) {
|
||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_SOL_UUID, cb_evt,
|
||||
ref_value, NULL, NULL);
|
||||
}
|
||||
|
||||
/* clear service data filter */
|
||||
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
||||
BTM_BLE_PF_SRVC_DATA_PATTERN, cb_evt, ref_value);
|
||||
if (BTM_CMD_STARTED == st)
|
||||
if (BTM_CMD_STARTED == st) {
|
||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_SRVC_DATA, cb_evt,
|
||||
ref_value, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* select feature based on control block settings */
|
||||
|
@ -1053,9 +1059,10 @@ tBTM_STATUS BTM_BleAdvFilterParamSetup(int action, tBTM_BLE_PF_FILT_INDEX filt_i
|
|||
|
||||
if (cmn_ble_vsc_cb.version_supported == BTM_VSC_CHIP_CAPABILITY_L_VERSION) {
|
||||
len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN;
|
||||
} else
|
||||
} else {
|
||||
len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN +
|
||||
BTM_BLE_ADV_FILT_TRACK_NUM;
|
||||
}
|
||||
|
||||
if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
|
||||
(UINT8)len,
|
||||
|
|
|
@ -427,9 +427,10 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
|
|||
if (0 == num_records) {
|
||||
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
|
||||
&p_data, &data_len);
|
||||
if (NULL != ble_batchscan_cb.p_scan_rep_cback)
|
||||
if (NULL != ble_batchscan_cb.p_scan_rep_cback) {
|
||||
ble_batchscan_cb.p_scan_rep_cback(ref_value, report_format, num_records,
|
||||
data_len, p_data, status);
|
||||
}
|
||||
} else {
|
||||
if ((len - 4) > 0) {
|
||||
btm_ble_batchscan_enq_rep_data(report_format, num_records, p, len - 4);
|
||||
|
@ -439,9 +440,10 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
|
|||
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
|
||||
&p_data, &data_len);
|
||||
/* Send whatever is available, in case of a command failure */
|
||||
if (NULL != ble_batchscan_cb.p_scan_rep_cback && NULL != p_data)
|
||||
if (NULL != ble_batchscan_cb.p_scan_rep_cback && NULL != p_data) {
|
||||
ble_batchscan_cb.p_scan_rep_cback(ref_value, report_format,
|
||||
num_records, data_len, p_data, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,9 +62,10 @@ void btm_ble_cont_energy_cmpl_cback (tBTM_VSC_CMPL *p_params)
|
|||
BTM_TRACE_DEBUG("energy_info status=%d,tx_t=%u, rx_t=%u, ener_used=%u, idle_t=%u",
|
||||
status, total_tx_time, total_rx_time, total_energy_used, total_idle_time);
|
||||
|
||||
if (NULL != ble_energy_info_cb.p_ener_cback)
|
||||
if (NULL != ble_energy_info_cb.p_ener_cback) {
|
||||
ble_energy_info_cb.p_ener_cback(total_tx_time, total_rx_time, total_idle_time,
|
||||
total_energy_used, status);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -280,9 +280,10 @@ void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy)
|
|||
/* if adv active, stop and restart */
|
||||
btm_ble_stop_adv ();
|
||||
|
||||
if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE)
|
||||
if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE) {
|
||||
p_cb->evt_type = btm_set_conn_mode_adv_init_addr(p_cb, p_addr_ptr, &init_addr_type,
|
||||
&p_cb->adv_addr_type);
|
||||
}
|
||||
|
||||
btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
|
||||
BTM_BLE_GAP_ADV_SLOW_INT),
|
||||
|
@ -439,7 +440,7 @@ tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration,
|
|||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_BleScan(BOOLEAN start, UINT32 duration,
|
||||
tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb)
|
||||
tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb, tBTM_INQ_DIS_CB *p_discard_cb)
|
||||
{
|
||||
tBTM_BLE_INQ_CB *p_inq = &btm_cb.ble_ctr_cb.inq_var;
|
||||
tBTM_STATUS status = BTM_WRONG_MODE;
|
||||
|
@ -457,6 +458,7 @@ tBTM_STATUS BTM_BleScan(BOOLEAN start, UINT32 duration,
|
|||
|
||||
btm_cb.ble_ctr_cb.p_scan_results_cb = p_results_cb;
|
||||
btm_cb.ble_ctr_cb.p_scan_cmpl_cb = p_cmpl_cb;
|
||||
btm_cb.ble_ctr_cb.p_obs_discard_cb = p_discard_cb;
|
||||
status = BTM_CMD_STARTED;
|
||||
|
||||
/* scan is not started */
|
||||
|
@ -708,6 +710,39 @@ extern void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK *p_vsc_c
|
|||
return ;
|
||||
}
|
||||
|
||||
void BTM_VendorHciEchoCmdCallback(tBTM_VSC_CMPL *p1)
|
||||
{
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
if (!p1) {
|
||||
return;
|
||||
}
|
||||
uint8_t *p = p1->p_param_buf;
|
||||
uint8_t status, echo;
|
||||
STREAM_TO_UINT8 (status, p);
|
||||
STREAM_TO_UINT8 (echo, p);
|
||||
#endif
|
||||
BTM_TRACE_DEBUG("%s status 0x%x echo 0x%x", __func__, status, echo);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function BTM_VendorHciEchoCmdTest
|
||||
**
|
||||
** Description vendor common echo hci cmd test, controller will return status and echo
|
||||
**
|
||||
** Parameters: echo : echo value
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_VendorHciEchoCmdTest(uint8_t echo)
|
||||
{
|
||||
BTM_VendorSpecificCommand (HCI_VENDOR_COMMON_ECHO_CMD_OPCODE,
|
||||
1,
|
||||
&echo,
|
||||
BTM_VendorHciEchoCmdCallback);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleEnableMixedPrivacyMode
|
||||
|
@ -1220,7 +1255,7 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
|
|||
}
|
||||
|
||||
if(own_bda_type == BLE_ADDR_RANDOM) {
|
||||
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RANDOM) == BTM_BLE_GAP_ADDR_BIT_RANDOM) {
|
||||
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RANDOM) == BTM_BLE_GAP_ADDR_BIT_RANDOM) {
|
||||
//close privacy
|
||||
#if BLE_PRIVACY_SPT == TRUE
|
||||
if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE) {
|
||||
|
@ -1229,9 +1264,9 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
|
|||
#endif
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
|
||||
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, BD_ADDR_LEN);
|
||||
// set address to controller
|
||||
// set address to controller
|
||||
btsnd_hcic_ble_set_random_addr(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr);
|
||||
|
||||
|
||||
} else if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
|
||||
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr, BD_ADDR_LEN);
|
||||
|
@ -1241,7 +1276,7 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
|
|||
if(adv_cb) {
|
||||
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
|
||||
}
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
} else if(own_bda_type == BLE_ADDR_PUBLIC_ID || own_bda_type == BLE_ADDR_RANDOM_ID) {
|
||||
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
|
||||
|
@ -1256,7 +1291,7 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
|
|||
if(adv_cb) {
|
||||
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
|
||||
}
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
#endif
|
||||
if(own_bda_type == BLE_ADDR_PUBLIC_ID) {
|
||||
|
@ -1273,17 +1308,17 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
|
|||
if(adv_cb) {
|
||||
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
|
||||
}
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
|
||||
}
|
||||
|
||||
if (!BTM_BLE_ISVALID_PARAM(adv_int_min, BTM_BLE_ADV_INT_MIN, BTM_BLE_ADV_INT_MAX) ||
|
||||
!BTM_BLE_ISVALID_PARAM(adv_int_max, BTM_BLE_ADV_INT_MIN, BTM_BLE_ADV_INT_MAX)) {
|
||||
BTM_TRACE_ERROR ("adv_int_min or adv_int_max is invalid\n");
|
||||
BTM_TRACE_ERROR ("adv_int_min or adv_int_max is invalid\n");
|
||||
if(adv_cb) {
|
||||
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
|
||||
}
|
||||
|
@ -1338,7 +1373,6 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
|
|||
p_dir_bda->bda,
|
||||
chnl_map,
|
||||
p_cb->afp);
|
||||
|
||||
return btm_ble_start_adv();
|
||||
}
|
||||
|
||||
|
@ -1458,11 +1492,11 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
|
|||
BTM_BleConfigPrivacy(FALSE, NULL);
|
||||
}
|
||||
#endif
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
|
||||
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, BD_ADDR_LEN);
|
||||
// set address to controller
|
||||
// set address to controller
|
||||
btsnd_hcic_ble_set_random_addr(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr);
|
||||
|
||||
|
||||
} else if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
|
||||
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr, BD_ADDR_LEN);
|
||||
|
@ -1472,12 +1506,12 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
|
|||
scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE);
|
||||
}
|
||||
BTM_TRACE_ERROR ("No random address yet, please set random address and try\n");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
} else if(addr_type_own == BLE_ADDR_PUBLIC_ID || addr_type_own == BLE_ADDR_RANDOM_ID) {
|
||||
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
|
||||
addr_type_own = BLE_ADDR_RANDOM;
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
|
||||
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr, BD_ADDR_LEN);
|
||||
btsnd_hcic_ble_set_random_addr(btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr);
|
||||
} else {
|
||||
|
@ -1487,12 +1521,12 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
|
|||
if (scan_setup_status_cback != NULL) {
|
||||
scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE);
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if(addr_type_own == BLE_ADDR_PUBLIC_ID) {
|
||||
addr_type_own = BLE_ADDR_PUBLIC;
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
|
||||
} else {
|
||||
//own_bda_type == BLE_ADDR_RANDOM_ID
|
||||
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RANDOM) == BTM_BLE_GAP_ADDR_BIT_RANDOM) {
|
||||
|
@ -1505,12 +1539,12 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
|
|||
if (scan_setup_status_cback != NULL) {
|
||||
scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE);
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
|
||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
|
||||
}
|
||||
|
||||
/* If not supporting extended scan support, use the older range for checking */
|
||||
|
@ -1526,7 +1560,7 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
|
|||
if (BTM_BLE_ISVALID_PARAM(scan_interval, BTM_BLE_SCAN_INT_MIN, max_scan_interval) &&
|
||||
BTM_BLE_ISVALID_PARAM(scan_window, BTM_BLE_SCAN_WIN_MIN, max_scan_window) &&
|
||||
(scan_mode == BTM_BLE_SCAN_MODE_ACTI || scan_mode == BTM_BLE_SCAN_MODE_PASS) &&
|
||||
(scan_duplicate_filter < BTM_BLE_SCAN_DUPLICATE_MAX)) {
|
||||
(scan_duplicate_filter < BTM_BLE_SCAN_DUPLICATE_MAX) && (scan_window <= scan_interval)) {
|
||||
p_cb->scan_type = scan_mode;
|
||||
p_cb->scan_interval = scan_interval;
|
||||
p_cb->scan_window = scan_window;
|
||||
|
@ -1615,6 +1649,72 @@ tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_le
|
|||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_UpdateBleDuplicateExceptionalList
|
||||
**
|
||||
** Description This function is called to update duplicate scan exceptional list.
|
||||
**
|
||||
** Parameters: subcode: add, remove or clean duplicate scan exceptional list.
|
||||
** type: device info type
|
||||
** device_info: device information
|
||||
** update_exceptional_list_cmp_cb: complete callback
|
||||
**
|
||||
** Returns status
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info,
|
||||
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb)
|
||||
{
|
||||
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
|
||||
ble_cb->update_exceptional_list_cmp_cb = update_exceptional_list_cmp_cb;
|
||||
tBTM_STATUS status = BTM_NO_RESOURCES;
|
||||
if (!controller_get_interface()->supports_ble()) {
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
if(!device_info) {
|
||||
return BTM_ILLEGAL_VALUE;
|
||||
}
|
||||
// subcoe + type + device info
|
||||
uint8_t device_info_array[1 + 4 + BD_ADDR_LEN] = {0};
|
||||
device_info_array[0] = subcode;
|
||||
device_info_array[1] = type & 0xff;
|
||||
device_info_array[2] = (type >> 8) & 0xff;
|
||||
device_info_array[3] = (type >> 16) & 0xff;
|
||||
device_info_array[4] = (type >> 24) & 0xff;
|
||||
switch (type)
|
||||
{
|
||||
case BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR:
|
||||
bt_rcopy(&device_info_array[5], device_info, BD_ADDR_LEN);
|
||||
break;
|
||||
case BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID:
|
||||
memcpy(&device_info_array[5], device_info, 4);
|
||||
break;
|
||||
case BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE:
|
||||
//do nothing
|
||||
break;
|
||||
case BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV:
|
||||
//do nothing
|
||||
break;
|
||||
case BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV:
|
||||
//do nothing
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
break;
|
||||
}
|
||||
if(status == BTM_ILLEGAL_VALUE) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = BTM_VendorSpecificCommand(HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST, 1 + 4 + BD_ADDR_LEN, device_info_array, NULL);
|
||||
if(status == BTM_CMD_STARTED) {
|
||||
status = BTM_SUCCESS;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleWriteAdvData
|
||||
|
@ -1696,8 +1796,9 @@ tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len)
|
|||
*******************************************************************************/
|
||||
tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr)
|
||||
{
|
||||
if (rand_addr == NULL)
|
||||
if (rand_addr == NULL) {
|
||||
return BTM_SET_STATIC_RAND_ADDR_FAIL;
|
||||
}
|
||||
|
||||
if (!(btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_STOP_SCAN || btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_STOP_ADV || btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_IDLE)) {
|
||||
BTM_TRACE_ERROR("Advertising or scaning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
|
||||
|
@ -1764,7 +1865,7 @@ BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type)
|
|||
memset(addr, 0, BD_ADDR_LEN);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -2747,7 +2848,7 @@ void btm_ble_cache_adv_data(BD_ADDR bda, tBTM_INQ_RESULTS *p_cur, UINT8 data_len
|
|||
memset(p_le_inq_cb->adv_data_cache, 0, BTM_BLE_CACHE_ADV_DATA_MAX);
|
||||
p_cur->adv_data_len = 0;
|
||||
p_cur->scan_rsp_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the adv cache if the addresses are not equal
|
||||
if(memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN) != 0) {
|
||||
|
@ -3019,7 +3120,9 @@ BOOLEAN btm_ble_update_inq_result(BD_ADDR bda, tINQ_DB_ENT *p_i, UINT8 addr_type
|
|||
BTM_TRACE_DEBUG("btm_ble_update_inq_result scan_rsp=false, to_report=false,\
|
||||
scan_type_active=%d", btm_cb.ble_ctr_cb.inq_var.scan_type);
|
||||
p_i->scan_rsp = FALSE;
|
||||
#if BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY == FALSE
|
||||
to_report = FALSE;
|
||||
#endif
|
||||
} else {
|
||||
p_i->scan_rsp = TRUE;
|
||||
}
|
||||
|
@ -3199,7 +3302,7 @@ void btm_ble_process_adv_pkt (UINT8 *p_data)
|
|||
#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
|
||||
temp_addr_type = addr_type;
|
||||
memcpy(temp_bda, bda, BD_ADDR_LEN);
|
||||
|
||||
|
||||
/* map address to security record */
|
||||
match = btm_identity_addr_to_random_pseudo(bda, &addr_type, FALSE);
|
||||
|
||||
|
@ -3316,9 +3419,26 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
|
|||
BOOLEAN update = TRUE;
|
||||
UINT8 result = 0;
|
||||
|
||||
//if scan duplicate is enabled, the adv packet without scan response is allowed to report to higgher layer
|
||||
/* Event_Type:
|
||||
0x00 Connectable undirected advertising (ADV_IND).
|
||||
0x01 Connectable directed advertising (ADV_DIRECT_IND)
|
||||
0x02 Scannable undirected advertising (ADV_SCAN_IND)
|
||||
0x03 Non connectable undirected advertising (ADV_NONCONN_IND)
|
||||
0x04 Scan Response (SCAN_RSP)
|
||||
0x05-0xFF Reserved for future use
|
||||
*/
|
||||
//if scan duplicate is enabled, the adv packet without scan response is allowed to report to higher layer
|
||||
if(p_le_inq_cb->scan_duplicate_filter == BTM_BLE_SCAN_DUPLICATE_ENABLE) {
|
||||
if(memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN) != 0) {
|
||||
/*
|
||||
Bluedroid will put the advertising packet and scan response into a packet and send it to the higher layer.
|
||||
If two advertising packets are not with the same address, or can't be combined into a packet, then the first advertising
|
||||
packet will be discarded. So we added the following judgment:
|
||||
1. For different addresses, send the last advertising packet to higher layer
|
||||
2. For same address and same advertising type (not scan response), send the last advertising packet to higher layer
|
||||
3. For same address and scan response, do nothing
|
||||
*/
|
||||
int same_addr = memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN);
|
||||
if (same_addr != 0 || (same_addr == 0 && evt_type != BTM_BLE_SCAN_RSP_EVT)) {
|
||||
btm_ble_process_last_adv_pkt();
|
||||
}
|
||||
}
|
||||
|
@ -3417,6 +3537,17 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
|
|||
}
|
||||
}
|
||||
|
||||
void btm_ble_process_adv_discard_evt(UINT8 *p)
|
||||
{
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
uint32_t num_dis = 0;
|
||||
STREAM_TO_UINT32 (num_dis, p);
|
||||
tBTM_INQ_DIS_CB *p_obs_discard_cb = btm_cb.ble_ctr_cb.p_obs_discard_cb;
|
||||
if(p_obs_discard_cb) {
|
||||
(p_obs_discard_cb)(num_dis);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_start_scan
|
||||
|
@ -3648,7 +3779,7 @@ tBTM_STATUS btm_ble_start_adv(void)
|
|||
btm_execute_wl_dev_operation();
|
||||
btm_cb.ble_ctr_cb.wl_state |= BTM_BLE_WL_ADV;
|
||||
}
|
||||
/* The complete event comes up immediately after the 'btsnd_hcic_ble_set_adv_enable' being called in dual core,
|
||||
/* The complete event comes up immediately after the 'btsnd_hcic_ble_set_adv_enable' being called in dual core,
|
||||
this causes the 'adv_mode' and 'state' not be set yet, so we set the state first */
|
||||
tBTM_BLE_GAP_STATE temp_state = p_cb->state;
|
||||
UINT8 adv_mode = p_cb->adv_mode;
|
||||
|
@ -3957,7 +4088,7 @@ BOOLEAN btm_ble_clear_topology_mask (tBTM_BLE_STATE_MASK request_state_mask)
|
|||
**
|
||||
** Description Get BLE topology bit mask
|
||||
**
|
||||
** Returns state mask.
|
||||
** Returns state mask.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTM_BLE_STATE_MASK btm_ble_get_topology_mask (void)
|
||||
|
@ -4011,8 +4142,9 @@ void btm_ble_update_link_topology_mask(UINT8 link_role, BOOLEAN increase)
|
|||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 status)
|
||||
BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 status)
|
||||
{
|
||||
BOOLEAN bg_con = FALSE;
|
||||
if (status == HCI_ERR_DIRECTED_ADVERTISING_TIMEOUT) {
|
||||
btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
|
||||
/* make device fall back into undirected adv mode by default */
|
||||
|
@ -4031,8 +4163,10 @@ void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 statu
|
|||
now in order */
|
||||
if (btm_ble_get_conn_st() == BLE_CONN_IDLE && status != HCI_ERR_HOST_REJECT_RESOURCES &&
|
||||
!btm_send_pending_direct_conn()) {
|
||||
btm_ble_resume_bg_conn();
|
||||
bg_con = btm_ble_resume_bg_conn();
|
||||
}
|
||||
|
||||
return bg_con;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -521,9 +521,10 @@ tBTM_STATUS btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC *p_dev_rec)
|
|||
btm_ble_resolving_list_vsc_op_cmpl);
|
||||
}
|
||||
|
||||
if (st == BTM_CMD_STARTED)
|
||||
if (st == BTM_CMD_STARTED) {
|
||||
btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr,
|
||||
BTM_BLE_META_READ_IRK_ENTRY);
|
||||
}
|
||||
|
||||
return st;
|
||||
}
|
||||
|
@ -771,8 +772,8 @@ BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
|
|||
}
|
||||
/* It will cause that scanner doesn't send scan request to advertiser
|
||||
* which has sent IRK to us and we have stored the IRK in controller.
|
||||
* It is a design problem of hardware. The temporal solution is not to
|
||||
* send the key to the controller and then resolve the random address in host. */
|
||||
* It is a hardware limitation. The preliminary solution is not to
|
||||
* send key to the controller, but to resolve the random address in host. */
|
||||
/*
|
||||
BTM_TRACE_DEBUG("%s:adding device to controller resolving list\n", __func__);
|
||||
UINT8 *peer_irk = p_dev_rec->ble.keys.irk;
|
||||
|
@ -799,9 +800,10 @@ BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
|
|||
}
|
||||
}
|
||||
|
||||
if (rt)
|
||||
if (rt) {
|
||||
btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr,
|
||||
BTM_BLE_META_ADD_IRK_ENTRY);
|
||||
}
|
||||
|
||||
/* if resolving list has been turned on, re-enable it */
|
||||
if (rl_mask) {
|
||||
|
|
|
@ -207,8 +207,9 @@ BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr, tBT_TRANSPORT transport)
|
|||
extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr)
|
||||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
|
||||
if (p_dev_rec == NULL)
|
||||
if (p_dev_rec == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
p_dev_rec->sec_flags = 0;
|
||||
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
|
||||
|
|
|
@ -273,13 +273,15 @@ static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_feat
|
|||
btm_cb.btm_acl_pkt_types_supported = (BTM_ACL_PKT_TYPES_MASK_DH1 +
|
||||
BTM_ACL_PKT_TYPES_MASK_DM1);
|
||||
|
||||
if (HCI_3_SLOT_PACKETS_SUPPORTED(p_features))
|
||||
if (HCI_3_SLOT_PACKETS_SUPPORTED(p_features)) {
|
||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH3 +
|
||||
BTM_ACL_PKT_TYPES_MASK_DM3);
|
||||
}
|
||||
|
||||
if (HCI_5_SLOT_PACKETS_SUPPORTED(p_features))
|
||||
if (HCI_5_SLOT_PACKETS_SUPPORTED(p_features)) {
|
||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH5 +
|
||||
BTM_ACL_PKT_TYPES_MASK_DM5);
|
||||
}
|
||||
|
||||
/* Add in EDR related ACL types */
|
||||
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p_features)) {
|
||||
|
@ -297,13 +299,15 @@ static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_feat
|
|||
/* Check to see if 3 and 5 slot packets are available */
|
||||
if (HCI_EDR_ACL_2MPS_SUPPORTED(p_features) ||
|
||||
HCI_EDR_ACL_3MPS_SUPPORTED(p_features)) {
|
||||
if (!HCI_3_SLOT_EDR_ACL_SUPPORTED(p_features))
|
||||
if (!HCI_3_SLOT_EDR_ACL_SUPPORTED(p_features)) {
|
||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 +
|
||||
BTM_ACL_PKT_TYPES_MASK_NO_3_DH3);
|
||||
}
|
||||
|
||||
if (!HCI_5_SLOT_EDR_ACL_SUPPORTED(p_features))
|
||||
if (!HCI_5_SLOT_EDR_ACL_SUPPORTED(p_features)) {
|
||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH5 +
|
||||
BTM_ACL_PKT_TYPES_MASK_NO_3_DH5);
|
||||
}
|
||||
}
|
||||
|
||||
BTM_TRACE_DEBUG("Local supported ACL packet types: 0x%04x",
|
||||
|
@ -689,6 +693,21 @@ tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode, UINT8 param_len,
|
|||
void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
|
||||
tBTM_CMPL_CB *p_vsc_cplt_cback)
|
||||
{
|
||||
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
|
||||
switch(opcode) {
|
||||
case HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST: {
|
||||
uint8_t subcode, status; uint32_t length;
|
||||
STREAM_TO_UINT8(status, p);
|
||||
STREAM_TO_UINT8(subcode, p);
|
||||
STREAM_TO_UINT32(length, p);
|
||||
if(ble_cb && ble_cb->update_exceptional_list_cmp_cb) {
|
||||
(*ble_cb->update_exceptional_list_cmp_cb)(status, subcode, length, p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
tBTM_VSC_CMPL vcs_cplt_params;
|
||||
|
||||
/* If there was a callback address for vcs complete, call it */
|
||||
|
|
|
@ -1042,9 +1042,10 @@ tBTM_STATUS BTM_ReadRemoteDeviceName (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb
|
|||
return btm_ble_read_remote_name(remote_bda, p_cur, p_cb);
|
||||
} else
|
||||
#endif
|
||||
|
||||
{
|
||||
return (btm_initiate_rem_name (remote_bda, p_cur, BTM_RMT_NAME_EXT,
|
||||
BTM_EXT_RMT_NAME_TIMEOUT, p_cb));
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1080,11 +1081,13 @@ tBTM_STATUS BTM_CancelRemoteDeviceName (void)
|
|||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (btsnd_hcic_rmt_name_req_cancel (p_inq->remname_bda)) {
|
||||
return (BTM_CMD_STARTED);
|
||||
} else {
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return (BTM_WRONG_MODE);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,9 @@ const UINT8 btm_pm_md_comp_matrix[BTM_PM_NUM_SET_MODES * BTM_PM_NUM_SET_MODES] =
|
|||
/* function prototype */
|
||||
static int btm_pm_find_acl_ind(BD_ADDR remote_bda);
|
||||
static tBTM_STATUS btm_pm_snd_md_req( UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *p_mode );
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
static const char *mode_to_string(tBTM_PM_MODE mode);
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef BTM_PM_DEBUG
|
||||
|
@ -950,6 +952,7 @@ tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
static const char *mode_to_string(tBTM_PM_MODE mode)
|
||||
{
|
||||
switch (mode) {
|
||||
|
@ -960,3 +963,4 @@ static const char *mode_to_string(tBTM_PM_MODE mode)
|
|||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -887,7 +887,9 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
|
|||
#ifdef APPL_AUTH_WRITE_EXCEPTION
|
||||
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
|
||||
#endif
|
||||
{
|
||||
btsnd_hcic_write_auth_enable (TRUE);
|
||||
}
|
||||
|
||||
btm_cb.acl_disc_reason = 0xff ;
|
||||
|
||||
|
@ -907,9 +909,10 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
|
|||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||
p_dev_rec->sec_flags &= ~BTM_SEC_LINK_KEY_AUTHED;
|
||||
|
||||
if (btm_cb.api.p_auth_complete_callback)
|
||||
if (btm_cb.api.p_auth_complete_callback) {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_ERR_AUTH_FAILURE);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -949,7 +952,9 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
|||
{
|
||||
tBTM_SEC_DEV_REC *p_dev_rec;
|
||||
tBTM_STATUS status;
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
UINT8 *p_features;
|
||||
#endif
|
||||
UINT8 ii;
|
||||
tACL_CONN *p = btm_bda_to_acl(bd_addr, transport);
|
||||
BTM_TRACE_API ("btm_sec_bond_by_transport BDA: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
|
@ -1042,7 +1047,9 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
|||
}
|
||||
|
||||
for (ii = 0; ii <= HCI_EXT_FEATURES_PAGE_MAX; ii++) {
|
||||
#if (!CONFIG_BT_STACK_NO_LOG)
|
||||
p_features = p_dev_rec->features[ii];
|
||||
#endif
|
||||
BTM_TRACE_EVENT(" remote_features page[%1d] = %02x-%02x-%02x-%02x\n",
|
||||
ii, p_features[0], p_features[1], p_features[2], p_features[3]);
|
||||
BTM_TRACE_EVENT(" %02x-%02x-%02x-%02x\n",
|
||||
|
@ -1396,7 +1403,9 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE
|
|||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
rc = btm_sec_execute_procedure (p_dev_rec);
|
||||
}
|
||||
|
||||
if (rc != BTM_CMD_STARTED && rc != BTM_BUSY) {
|
||||
if (p_callback) {
|
||||
|
@ -2163,9 +2172,10 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle
|
|||
"rmt_support_for_sc : %d -> fail pairing\n", __FUNCTION__,
|
||||
local_supports_sc,
|
||||
p_dev_rec->remote_supports_secure_connections);
|
||||
if (p_callback)
|
||||
if (p_callback) {
|
||||
(*p_callback) (bd_addr, transport, (void *)p_ref_data,
|
||||
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||
}
|
||||
|
@ -2525,9 +2535,10 @@ tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_o
|
|||
"remote_support_for_sc %d: fail pairing\n", __FUNCTION__,
|
||||
local_supports_sc, p_dev_rec->remote_supports_secure_connections);
|
||||
|
||||
if (p_callback)
|
||||
if (p_callback) {
|
||||
(*p_callback) (bd_addr, transport, (void *)p_ref_data,
|
||||
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||
}
|
||||
|
@ -3013,9 +3024,10 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
|
|||
|
||||
/* Notify all clients waiting for name to be resolved */
|
||||
for (i = 0; i < BTM_SEC_MAX_RMT_NAME_CALLBACKS; i++) {
|
||||
if (btm_cb.p_rmt_name_callback[i] && p_bd_addr)
|
||||
if (btm_cb.p_rmt_name_callback[i] && p_bd_addr) {
|
||||
(*btm_cb.p_rmt_name_callback[i])(p_bd_addr, p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dev_class[0] = 0;
|
||||
|
@ -3100,9 +3112,10 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
|
|||
|
||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||
|
||||
if (btm_cb.api.p_auth_complete_callback)
|
||||
if (btm_cb.api.p_auth_complete_callback) {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -3128,10 +3141,11 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
|
|||
/* that some authentication has been completed */
|
||||
/* This is required when different entities receive link notification and auth complete */
|
||||
if (!(p_dev_rec->security_required & BTM_SEC_OUT_AUTHENTICATE)) {
|
||||
if (btm_cb.api.p_auth_complete_callback)
|
||||
if (btm_cb.api.p_auth_complete_callback) {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||
p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3907,10 +3921,11 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status)
|
|||
/* User probably Disabled the keyboard while it was asleap. Let her try */
|
||||
if (btm_cb.api.p_auth_complete_callback) {
|
||||
/* report the suthentication status */
|
||||
if (old_state != BTM_PAIR_STATE_IDLE)
|
||||
if (old_state != BTM_PAIR_STATE_IDLE) {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||
p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, status);
|
||||
}
|
||||
}
|
||||
|
||||
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
|
||||
|
@ -4181,9 +4196,10 @@ static void btm_sec_connect_after_reject_timeout (TIMER_LIST_ENT *p_tle)
|
|||
|
||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||
|
||||
if (btm_cb.api.p_auth_complete_callback)
|
||||
if (btm_cb.api.p_auth_complete_callback) {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
@ -4408,10 +4424,11 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
|
|||
res = FALSE;
|
||||
}
|
||||
|
||||
if (btm_cb.api.p_auth_complete_callback)
|
||||
if (btm_cb.api.p_auth_complete_callback) {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||
p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
||||
}
|
||||
|
||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||
|
||||
|
@ -4717,9 +4734,10 @@ void btm_sec_link_key_notification (UINT8 *p_bda, UINT8 *p_link_key, UINT8 key_t
|
|||
if (!(p_dev_rec->security_required & BTM_SEC_OUT_AUTHENTICATE)
|
||||
/* for derived key, always send authentication callback for BR channel */
|
||||
|| ltk_derived_lk) {
|
||||
if (btm_cb.api.p_auth_complete_callback)
|
||||
if (btm_cb.api.p_auth_complete_callback) {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
/* We will save link key only if the user authorized it - BTE report link key in all cases */
|
||||
|
@ -4829,10 +4847,11 @@ static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle)
|
|||
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
|
||||
NULL,
|
||||
name, HCI_ERR_CONNECTION_TOUT);
|
||||
} else
|
||||
} else {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||
p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_ERR_CONNECTION_TOUT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -4888,10 +4907,11 @@ static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle)
|
|||
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
|
||||
NULL,
|
||||
name, HCI_ERR_CONNECTION_TOUT);
|
||||
} else
|
||||
} else {
|
||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||
p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, HCI_ERR_CONNECTION_TOUT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -5030,42 +5050,13 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
|
|||
memcpy (p_cb->connecting_bda, p_bda, BD_ADDR_LEN);
|
||||
memcpy (p_cb->connecting_dc, p_dev_rec->dev_class, DEV_CLASS_LEN);
|
||||
|
||||
/* Check if the name is known */
|
||||
/* Even if name is not known we might not be able to get one */
|
||||
/* this is the case when we are already getting something from the */
|
||||
/* device, so HCI level is flow controlled */
|
||||
/* Also cannot send remote name request while paging, i.e. connection is not completed */
|
||||
if (p_dev_rec->sec_flags & BTM_SEC_NAME_KNOWN) {
|
||||
BTM_TRACE_EVENT ("btm_sec_pin_code_request going for callback\n");
|
||||
|
||||
btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
|
||||
if (p_cb->api.p_pin_callback) {
|
||||
(*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name,
|
||||
(p_dev_rec->p_cur_service == NULL) ? FALSE
|
||||
: (p_dev_rec->p_cur_service->security_flags
|
||||
& BTM_SEC_IN_MIN_16_DIGIT_PIN));
|
||||
}
|
||||
} else {
|
||||
BTM_TRACE_EVENT ("btm_sec_pin_code_request going for remote name\n");
|
||||
|
||||
/* We received PIN code request for the device with unknown name */
|
||||
/* it is not user friendly just to ask for the PIN without name */
|
||||
/* try to get name at first */
|
||||
if (!btsnd_hcic_rmt_name_req (p_dev_rec->bd_addr,
|
||||
HCI_PAGE_SCAN_REP_MODE_R1,
|
||||
HCI_MANDATARY_PAGE_SCAN_MODE, 0)) {
|
||||
p_dev_rec->sec_flags |= BTM_SEC_NAME_KNOWN;
|
||||
p_dev_rec->sec_bd_name[0] = 'f';
|
||||
p_dev_rec->sec_bd_name[1] = '0';
|
||||
BTM_TRACE_ERROR ("can not send rmt_name_req?? fake a name and call callback\n");
|
||||
|
||||
btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
|
||||
if (p_cb->api.p_pin_callback)
|
||||
(*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, (p_dev_rec->p_cur_service == NULL) ? FALSE
|
||||
: (p_dev_rec->p_cur_service->security_flags
|
||||
& BTM_SEC_IN_MIN_16_DIGIT_PIN));
|
||||
}
|
||||
BTM_TRACE_EVENT ("btm_sec_pin_code_request going for callback\n");
|
||||
btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
|
||||
if (p_cb->api.p_pin_callback) {
|
||||
(*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name,
|
||||
(p_dev_rec->p_cur_service == NULL) ? FALSE
|
||||
: (p_dev_rec->p_cur_service->security_flags
|
||||
& BTM_SEC_IN_MIN_16_DIGIT_PIN));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -5549,10 +5540,11 @@ static void btm_sec_collision_timeout (TIMER_LIST_ENT *p_tle)
|
|||
*******************************************************************************/
|
||||
static void btm_send_link_key_notif (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
{
|
||||
if (btm_cb.api.p_link_key_callback)
|
||||
if (btm_cb.api.p_link_key_callback) {
|
||||
(*btm_cb.api.p_link_key_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||
p_dev_rec->sec_bd_name, p_dev_rec->link_key,
|
||||
p_dev_rec->link_key_type);
|
||||
}
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
|
@ -5732,7 +5724,9 @@ void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEA
|
|||
(*p_callback) (p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE, p_dev_rec->p_ref_data, res);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
(*p_callback) (p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR, p_dev_rec->p_ref_data, res);
|
||||
}
|
||||
}
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
btm_sec_check_pending_reqs();
|
||||
|
@ -5790,7 +5784,9 @@ static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
|
|||
#ifdef APPL_AUTH_WRITE_EXCEPTION
|
||||
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
|
||||
#endif
|
||||
{
|
||||
btsnd_hcic_write_auth_enable (TRUE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_LOCAL_PIN);
|
||||
|
@ -5942,8 +5938,9 @@ static BOOLEAN btm_sec_is_serv_level0(UINT16 psm)
|
|||
static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRANSPORT transport,
|
||||
UINT8 encr_enable)
|
||||
{
|
||||
if (fixed_queue_is_empty(btm_cb.sec_pending_q))
|
||||
if (fixed_queue_is_empty(btm_cb.sec_pending_q)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UINT8 res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING;
|
||||
list_t *list = fixed_queue_get_list(btm_cb.sec_pending_q);
|
||||
|
|
|
@ -280,6 +280,12 @@ typedef UINT16 tBTM_BLE_STATE_MASK;
|
|||
#define BTM_LE_RESOLVING_LIST_MAX 0x20
|
||||
#endif
|
||||
|
||||
#define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR 0
|
||||
#define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID 1
|
||||
#define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE 2
|
||||
#define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV 3
|
||||
#define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV 4
|
||||
|
||||
typedef struct {
|
||||
BD_ADDR *resolve_q_random_pseudo;
|
||||
UINT8 *resolve_q_action;
|
||||
|
@ -317,6 +323,7 @@ typedef struct {
|
|||
/* observer callback and timer */
|
||||
tBTM_INQ_RESULTS_CB *p_obs_results_cb;
|
||||
tBTM_CMPL_CB *p_obs_cmpl_cb;
|
||||
tBTM_INQ_DIS_CB *p_obs_discard_cb;
|
||||
TIMER_LIST_ENT obs_timer_ent;
|
||||
|
||||
/* scan callback and timer */
|
||||
|
@ -357,6 +364,7 @@ typedef struct {
|
|||
/* current BLE link state */
|
||||
tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */
|
||||
UINT8 link_count[2]; /* total link count master and slave*/
|
||||
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *update_exceptional_list_cmp_cb;
|
||||
} tBTM_BLE_CB;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -365,6 +373,7 @@ extern "C" {
|
|||
|
||||
void btm_ble_timeout(TIMER_LIST_ENT *p_tle);
|
||||
void btm_ble_process_adv_pkt (UINT8 *p);
|
||||
void btm_ble_process_adv_discard_evt(UINT8 *p);
|
||||
void btm_ble_proc_scan_rsp_rpt (UINT8 *p);
|
||||
tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb);
|
||||
BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda);
|
||||
|
@ -440,7 +449,7 @@ BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);
|
|||
BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback);
|
||||
BOOLEAN btm_ble_renew_bg_conn_params(BOOLEAN add, BD_ADDR bd_addr);
|
||||
void btm_write_dir_conn_wl(BD_ADDR target_addr);
|
||||
void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, UINT8 status);
|
||||
BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, UINT8 status);
|
||||
BOOLEAN btm_execute_wl_dev_operation(void);
|
||||
void btm_ble_update_link_topology_mask(UINT8 role, BOOLEAN increase);
|
||||
|
||||
|
|
|
@ -488,7 +488,10 @@ typedef struct {
|
|||
#if SMP_INCLUDED == TRUE
|
||||
tBTM_LE_KEY_TYPE key_type; /* bit mask of valid key types in record */
|
||||
tBTM_SEC_BLE_KEYS keys; /* LE device security info in slave rode */
|
||||
#if (SMP_SLAVE_CON_PARAMS_UPD_ENABLE == TRUE)
|
||||
bool skip_update_conn_param; /* skip update connection paraams or not*/
|
||||
#endif
|
||||
UINT16 auth_mode; /* Authentication mode */
|
||||
#endif
|
||||
#if (BLE_PRIVACY_SPT == TRUE)
|
||||
tBLE_ADDR_TYPE current_addr_type; /* current adv addr type*/
|
||||
|
|
|
@ -122,6 +122,7 @@ static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len);
|
|||
#if BLE_INCLUDED == TRUE
|
||||
static void btu_ble_ll_conn_complete_evt (UINT8 *p, UINT16 evt_len);
|
||||
static void btu_ble_process_adv_pkt (UINT8 *p);
|
||||
static void btu_ble_process_adv_dis(UINT8 *p);
|
||||
static void btu_ble_read_remote_feat_evt (UINT8 *p);
|
||||
static void btu_ble_ll_conn_param_upd_evt (UINT8 *p, UINT16 evt_len);
|
||||
static void btu_ble_ll_get_conn_param_format_err_from_contoller (UINT8 status, UINT16 handle);
|
||||
|
@ -331,6 +332,9 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
|
|||
case HCI_BLE_ADV_PKT_RPT_EVT: /* result of inquiry */
|
||||
btu_ble_process_adv_pkt(p);
|
||||
break;
|
||||
case HCI_BLE_ADV_DISCARD_REPORT_EVT:
|
||||
btu_ble_process_adv_dis(p);
|
||||
break;
|
||||
case HCI_BLE_CONN_COMPLETE_EVT:
|
||||
btu_ble_ll_conn_complete_evt(p, hci_evt_len);
|
||||
break;
|
||||
|
@ -1764,6 +1768,11 @@ static void btu_ble_process_adv_pkt (UINT8 *p)
|
|||
btm_ble_process_adv_pkt(p);
|
||||
}
|
||||
|
||||
static void btu_ble_process_adv_dis(UINT8 *p)
|
||||
{
|
||||
btm_ble_process_adv_discard_evt(p);
|
||||
}
|
||||
|
||||
static void btu_ble_ll_conn_complete_evt ( UINT8 *p, UINT16 evt_len)
|
||||
{
|
||||
btm_ble_conn_complete(p, evt_len, FALSE);
|
||||
|
|
|
@ -437,6 +437,9 @@ void gap_attr_db_init(void)
|
|||
memset (&app_uuid.uu.uuid128, 0x81, LEN_UUID_128);
|
||||
|
||||
status = GATTS_StartService(gap_cb.gatt_if, service_handle, GAP_TRANSPORT_SUPPORTED );
|
||||
#if (CONFIG_BT_STACK_NO_LOG)
|
||||
(void) status;
|
||||
#endif
|
||||
|
||||
GAP_TRACE_EVENT ("GAP App gatt_if: %d s_hdl = %d start_status=%d",
|
||||
gap_cb.gatt_if, service_handle, status);
|
||||
|
|
|
@ -292,7 +292,7 @@ UINT16 GATTS_AddIncludeService (UINT16 service_handle, UINT16 include_svc_handle
|
|||
**
|
||||
*******************************************************************************/
|
||||
UINT16 GATTS_AddCharacteristic (UINT16 service_handle, tBT_UUID *p_char_uuid,
|
||||
tGATT_PERM perm, tGATT_CHAR_PROP property,
|
||||
tGATT_PERM perm, tGATT_CHAR_PROP property,
|
||||
tGATT_ATTR_VAL *attr_val, tGATTS_ATTR_CONTROL *control)
|
||||
{
|
||||
tGATT_HDL_LIST_ELEM *p_decl;
|
||||
|
@ -311,7 +311,7 @@ UINT16 GATTS_AddCharacteristic (UINT16 service_handle, tBT_UUID *p_char_uuid,
|
|||
return gatts_add_characteristic(&p_decl->svc_db,
|
||||
perm,
|
||||
property,
|
||||
p_char_uuid,
|
||||
p_char_uuid,
|
||||
attr_val, control);
|
||||
}
|
||||
/*******************************************************************************
|
||||
|
@ -734,7 +734,7 @@ tGATT_STATUS GATTS_SetAttributeValue(UINT16 attr_handle, UINT16 length, UINT8 *v
|
|||
return GATT_INVALID_ATTR_LEN;
|
||||
}
|
||||
if ((p_decl = gatt_find_hdl_buffer_by_attr_handle(attr_handle)) == NULL) {
|
||||
GATT_TRACE_DEBUG("Service not created\n");
|
||||
GATT_TRACE_DEBUG("Service not created\n");
|
||||
return GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,8 @@ tGATT_STATUS GATTS_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 *
|
|||
attr_handle);
|
||||
|
||||
if ((p_decl = gatt_find_hdl_buffer_by_attr_handle(attr_handle)) == NULL) {
|
||||
GATT_TRACE_ERROR("Service not created\n");
|
||||
GATT_TRACE_ERROR("Service not created\n");
|
||||
*length = 0;
|
||||
return GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
@ -1160,14 +1161,19 @@ void GATT_SetIdleTimeout (BD_ADDR bd_addr, UINT16 idle_tout, tBT_TRANSPORT trans
|
|||
if (p_tcb->att_lcid == L2CAP_ATT_CID) {
|
||||
status = L2CA_SetFixedChannelTout (bd_addr, L2CAP_ATT_CID, idle_tout);
|
||||
|
||||
if (idle_tout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP)
|
||||
if (idle_tout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP) {
|
||||
L2CA_SetIdleTimeoutByBdAddr(p_tcb->peer_bda,
|
||||
GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP, BT_TRANSPORT_LE);
|
||||
}
|
||||
} else {
|
||||
status = L2CA_SetIdleTimeout (p_tcb->att_lcid, idle_tout, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
#if (CONFIG_BT_STACK_NO_LOG)
|
||||
(void) status;
|
||||
#endif
|
||||
|
||||
GATT_TRACE_API ("GATT_SetIdleTimeout idle_tout=%d status=%d(1-OK 0-not performed)",
|
||||
idle_tout, status);
|
||||
}
|
||||
|
@ -1506,7 +1512,7 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr)
|
|||
srv_chg_ind_pending = gatt_is_srv_chg_ind_pending(p_tcb);
|
||||
|
||||
if (!srv_chg_ind_pending) {
|
||||
status = gatt_send_srv_chg_ind(addr);
|
||||
status = gatt_send_srv_chg_ind(addr);
|
||||
} else {
|
||||
status = GATT_BUSY;
|
||||
GATT_TRACE_DEBUG("discard srv chg - already has one in the queue");
|
||||
|
|
|
@ -374,6 +374,10 @@ void gatt_profile_db_init (void)
|
|||
*/
|
||||
status = GATTS_StartService (gatt_cb.gatt_if, service_handle, GATTP_TRANSPORT_SUPPORTED );
|
||||
|
||||
#if (CONFIG_BT_STACK_NO_LOG)
|
||||
(void) status;
|
||||
#endif
|
||||
|
||||
GATT_TRACE_DEBUG ("gatt_profile_db_init: gatt_if=%d start status%d\n",
|
||||
gatt_cb.gatt_if, status);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue