forked from espressif/esp-idf
Compare commits
511 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38eeba213a | ||
|
|
1db39dfea9 | ||
|
|
f327ddf6ad | ||
|
|
40fe00a65c | ||
|
|
1cf1f4ef9a | ||
|
|
7f20e696b6 | ||
|
|
3bffba71c0 | ||
|
|
6d2153d703 | ||
|
|
6897e4e0fa | ||
|
|
e2e03ced38 | ||
|
|
6fa8029146 | ||
|
|
b2146b8aa3 | ||
|
|
27bc69a6df | ||
|
|
de32c62e90 | ||
|
|
02312e6a31 | ||
|
|
49961221ed | ||
|
|
21b041fe75 | ||
|
|
abd29905ae | ||
|
|
37bf723057 | ||
|
|
a43e575bb0 | ||
|
|
674f322b87 | ||
|
|
16a6523220 | ||
|
|
a8e38106d7 | ||
|
|
0bfa176435 | ||
|
|
2d60e58888 | ||
|
|
247cb8b72f | ||
|
|
839719a287 | ||
|
|
8ef5dcee5d | ||
|
|
5adad46929 | ||
|
|
2b490aeb2d | ||
|
|
d9a9c0cc9d | ||
|
|
c2c7f53b94 | ||
|
|
30dbf89909 | ||
|
|
730537b50c | ||
|
|
4ddb8587d9 | ||
|
|
52f7624853 | ||
|
|
6b57f04cc8 | ||
|
|
875317f9eb | ||
|
|
bae43759c8 | ||
|
|
b6c46fa270 | ||
|
|
0456f9746a | ||
|
|
650c64a840 | ||
|
|
acfc9130c0 | ||
|
|
5684098285 | ||
|
|
8efc66495b | ||
|
|
2a6797d016 | ||
|
|
87182c9c76 | ||
|
|
7bfc2b0418 | ||
|
|
2ded73b2f4 | ||
|
|
23173d3d72 | ||
|
|
205173d241 | ||
|
|
93ae438d59 | ||
|
|
577a076bff | ||
|
|
94853f775b | ||
|
|
61e7464645 | ||
|
|
80b7b6caf1 | ||
|
|
3afb4b5446 | ||
|
|
7e8f62cfb4 | ||
|
|
8e41d56dbe | ||
|
|
2a7e9fc485 | ||
|
|
fe0da0eef3 | ||
|
|
8f53bdb834 | ||
|
|
6391316f30 | ||
|
|
d2a4247f8d | ||
|
|
28ac68224d | ||
|
|
b244b6e86b | ||
|
|
27ec26d2d3 | ||
|
|
7c8aabda7d | ||
|
|
944862de25 | ||
|
|
6340b958fe | ||
|
|
3f0f8f3ed6 | ||
|
|
449ab48101 | ||
|
|
b9124d3ab3 | ||
|
|
75b4fb5a66 | ||
|
|
a589ecdca8 | ||
|
|
dd0e27ad74 | ||
|
|
2746916f21 | ||
|
|
6627b4edd7 | ||
|
|
b13dfdceed | ||
|
|
3811384d6e | ||
|
|
ff14780dfd | ||
|
|
b4148534f6 | ||
|
|
2d244b521d | ||
|
|
b11b9dabb3 | ||
|
|
eef6f5f392 | ||
|
|
a1c2e7161b | ||
|
|
cb0287f01c | ||
|
|
6c5268da38 | ||
|
|
8847d25638 | ||
|
|
e61e19b64e | ||
|
|
d225370c31 | ||
|
|
9186e0e22d | ||
|
|
753bed36c4 | ||
|
|
fd06a6e74c | ||
|
|
53dd2baa6b | ||
|
|
f765235123 | ||
|
|
9a9533d5a4 | ||
|
|
0bce68089c | ||
|
|
2acfd88a47 | ||
|
|
90f913734b | ||
|
|
bcc7ea3137 | ||
|
|
bc11b9183b | ||
|
|
bb46e6529c | ||
|
|
97934f52ea | ||
|
|
3afa52bb88 | ||
|
|
9c6ccec971 | ||
|
|
8f581352e0 | ||
|
|
8b66455e5c | ||
|
|
2a6cbd0d3d | ||
|
|
474d150477 | ||
|
|
b9cf89ac23 | ||
|
|
8a97a02001 | ||
|
|
f6a76d8e09 | ||
|
|
f0dc5aecf6 | ||
|
|
256f03471e | ||
|
|
56c4d34fca | ||
|
|
5b644edfd4 | ||
|
|
6d55e5e7bf | ||
|
|
d54c947628 | ||
|
|
fafab20b3f | ||
|
|
19c9202768 | ||
|
|
2a1133c1cc | ||
|
|
af2ce6de13 | ||
|
|
edf80c574e | ||
|
|
7af69b9ddb | ||
|
|
cd7cef5ceb | ||
|
|
efe283f16f | ||
|
|
73152761f6 | ||
|
|
517a2c5132 | ||
|
|
ca7cc8e903 | ||
|
|
61ac7f8a91 | ||
|
|
bb8dd9d35b | ||
|
|
88aae9e8d6 | ||
|
|
c272210e74 | ||
|
|
471c3263b5 | ||
|
|
520fb6ab09 | ||
|
|
0406d64dd2 | ||
|
|
a2e2bfdbd4 | ||
|
|
1ddeab56a9 | ||
|
|
8262c19a51 | ||
|
|
ece1bf242e | ||
|
|
4404659605 | ||
|
|
8ddc31a001 | ||
|
|
c1c69210de | ||
|
|
54c529a21b | ||
|
|
6d853f0525 | ||
|
|
4cdd3bcc4e | ||
|
|
48594fc6e7 | ||
|
|
7142dbafe3 | ||
|
|
3aecd14840 | ||
|
|
9490f87838 | ||
|
|
72ab07a68d | ||
|
|
ebb65b27db | ||
|
|
06f28ca17b | ||
|
|
f810eb7a39 | ||
|
|
70d6d09d60 | ||
|
|
40f42289a0 | ||
|
|
a0e8f75336 | ||
|
|
41b8238cf3 | ||
|
|
54ba0f88e9 | ||
|
|
0662ac672e | ||
|
|
265b54a015 | ||
|
|
73da4fe25d | ||
|
|
69bb72a5c1 | ||
|
|
3fb1a627ac | ||
|
|
05ab87ca27 | ||
|
|
53a1bb853c | ||
|
|
8430331e6b | ||
|
|
493a161875 | ||
|
|
11f9081a0e | ||
|
|
0dc2f2410d | ||
|
|
cdc3baac87 | ||
|
|
1ba5757fed | ||
|
|
36169e6beb | ||
|
|
ad44330e8e | ||
|
|
3263b4e75f | ||
|
|
7364d276f7 | ||
|
|
7f9636f6ea | ||
|
|
979a56386d | ||
|
|
4c4e95cae9 | ||
|
|
ef543e8e56 | ||
|
|
a362b87809 | ||
|
|
f19f6e0561 | ||
|
|
6007eb82fa | ||
|
|
d82f42a464 | ||
|
|
b167df155f | ||
|
|
8103512379 | ||
|
|
45caba87f1 | ||
|
|
8f928f77e8 | ||
|
|
aad82378bb | ||
|
|
b92c24a9ba | ||
|
|
c392dad1dc | ||
|
|
3192aca478 | ||
|
|
0bb983f9d5 | ||
|
|
dbb71c010f | ||
|
|
91ca4a74aa | ||
|
|
aa264cab8f | ||
|
|
3f117c79d9 | ||
|
|
aa8822bbf1 | ||
|
|
95873f4c33 | ||
|
|
e47fe5df8e | ||
|
|
ab3ed9ee44 | ||
|
|
ba81334bf5 | ||
|
|
1a0f4524da | ||
|
|
a2b4ddc113 | ||
|
|
c452233a6e | ||
|
|
0ae5b6c0b2 | ||
|
|
3f0152978d | ||
|
|
7a0a868603 | ||
|
|
8812baf39f | ||
|
|
a24f51431d | ||
|
|
e6db7ddf2a | ||
|
|
cff118820f | ||
|
|
09089c3fdf | ||
|
|
2e973e28dc | ||
|
|
69f63b2a16 | ||
|
|
597a4d4926 | ||
|
|
77a7eb217a | ||
|
|
083eb06028 | ||
|
|
2026c783ed | ||
|
|
2f850519ef | ||
|
|
4e518185c5 | ||
|
|
8eec988290 | ||
|
|
72315ed011 | ||
|
|
c908325d3d | ||
|
|
148ee05b87 | ||
|
|
ad3891b94b | ||
|
|
2c9fa2702e | ||
|
|
22637ff824 | ||
|
|
78f44f115d | ||
|
|
ce2102eed4 | ||
|
|
bbd1bb2025 | ||
|
|
e6330d9cdc | ||
|
|
b57653b21c | ||
|
|
68915490b0 | ||
|
|
8e41f7b9d8 | ||
|
|
f157786e2d | ||
|
|
d6f65b1472 | ||
|
|
a1e8a7be4e | ||
|
|
a1b3ef5cef | ||
|
|
e9f29de687 | ||
|
|
3e4f49606b | ||
|
|
e8fcdc3ebf | ||
|
|
9e61344890 | ||
|
|
edef8d5fae | ||
|
|
7147f84f64 | ||
|
|
26fb320beb | ||
|
|
2fa6dabbb1 | ||
|
|
ca25bf834f | ||
|
|
4c0245d9e7 | ||
|
|
f886d0f1ba | ||
|
|
50511114e1 | ||
|
|
e62727886e | ||
|
|
153f4b8f4f | ||
|
|
58f51147cf | ||
|
|
2be3fa2e27 | ||
|
|
9be22d2d18 | ||
|
|
260920a18a | ||
|
|
f2f2de1a66 | ||
|
|
1ac20fb4ac | ||
|
|
0a1282bd24 | ||
|
|
43dbb702c4 | ||
|
|
4cc2340265 | ||
|
|
e08f93de6d | ||
|
|
254cf65464 | ||
|
|
00919c3967 | ||
|
|
bffe5d2864 | ||
|
|
09076b53eb | ||
|
|
4f57ec7c26 | ||
|
|
23e7fa801b | ||
|
|
629c3b4d9c | ||
|
|
e31f8581a2 | ||
|
|
24e208eca1 | ||
|
|
8b473bee24 | ||
|
|
ca78fb58bc | ||
|
|
403d656698 | ||
|
|
ffddf278f5 | ||
|
|
bb22c4323d | ||
|
|
ef202b3ecd | ||
|
|
79954fe559 | ||
|
|
dfc4b7b6b7 | ||
|
|
72e87fc035 | ||
|
|
af166180f2 | ||
|
|
560e1f899d | ||
|
|
7eef2771fe | ||
|
|
a61fd4bf70 | ||
|
|
1fb6de14e6 | ||
|
|
b34d4825d3 | ||
|
|
3329d64278 | ||
|
|
7e5f4df8e2 | ||
|
|
d3cf0d04ae | ||
|
|
c0d6131e83 | ||
|
|
891edc0f0d | ||
|
|
e1e191638a | ||
|
|
d11c83c9a0 | ||
|
|
8eb33e1b36 | ||
|
|
0e8f4c9b3d | ||
|
|
fa017871f2 | ||
|
|
fe4eb82500 | ||
|
|
93b64fd6d6 | ||
|
|
9a1e54d485 | ||
|
|
d5e628229f | ||
|
|
de59abad0a | ||
|
|
2923fd5265 | ||
|
|
5c2142eedb | ||
|
|
d6b9fab066 | ||
|
|
bf5b36954a | ||
|
|
0d08c81ae0 | ||
|
|
0f679c740f | ||
|
|
409c7e5610 | ||
|
|
9374a2d9ac | ||
|
|
b3370564f8 | ||
|
|
42904820c9 | ||
|
|
cf828f1c8d | ||
|
|
86fe60ad5a | ||
|
|
5fc7faf47e | ||
|
|
2a90241d7d | ||
|
|
236883728d | ||
|
|
27cf25e42c | ||
|
|
7c68678ddc | ||
|
|
fd3576eca6 | ||
|
|
6b44b42904 | ||
|
|
bc2ea111fb | ||
|
|
03040db7c1 | ||
|
|
0ae141c197 | ||
|
|
7ba6903f4b | ||
|
|
9ba36e8c55 | ||
|
|
716e78f3a6 | ||
|
|
44b7e8ed10 | ||
|
|
6bb6de5b35 | ||
|
|
47c455c177 | ||
|
|
4ef8121157 | ||
|
|
25cd984ad9 | ||
|
|
5576a60b4f | ||
|
|
4bc424258f | ||
|
|
6df29acf39 | ||
|
|
60efb8a3ba | ||
|
|
3dc07f49f3 | ||
|
|
8ddb3d6812 | ||
|
|
93d44d1e08 | ||
|
|
03bdeb46a5 | ||
|
|
df801011bd | ||
|
|
e8c4156fc2 | ||
|
|
2e4f63e62f | ||
|
|
9d4d612b56 | ||
|
|
dea8532e2d | ||
|
|
1bca827217 | ||
|
|
a4388a3321 | ||
|
|
6f38dfe22b | ||
|
|
9b2661c91c | ||
|
|
1edb6668ba | ||
|
|
c90faf5d03 | ||
|
|
94a8591586 | ||
|
|
1ee2c4db75 | ||
|
|
3b9450b59d | ||
|
|
46e71e43ba | ||
|
|
2bab3b36bc | ||
|
|
e5996b3e86 | ||
|
|
60c5dbad59 | ||
|
|
9a428c4019 | ||
|
|
13b649ab95 | ||
|
|
7a83052809 | ||
|
|
4c0bc4b7f5 | ||
|
|
6475f7f119 | ||
|
|
ae5470910e | ||
|
|
4b2972c7c3 | ||
|
|
a70d469e49 | ||
|
|
0cdc3284ce | ||
|
|
8b63bba2e8 | ||
|
|
87466a55bf | ||
|
|
335db4c5aa | ||
|
|
643b0abca2 | ||
|
|
d665b47ae1 | ||
|
|
d845742038 | ||
|
|
980a15a9cd | ||
|
|
bca0de4fe5 | ||
|
|
c841f802cf | ||
|
|
b7e3eb101d | ||
|
|
07ba91f926 | ||
|
|
2559757c30 | ||
|
|
d6d14d0caa | ||
|
|
c9de8b1cef | ||
|
|
64c3bf6e20 | ||
|
|
62832d6901 | ||
|
|
b2a1097d4c | ||
|
|
a80fb72f77 | ||
|
|
5690b2fa0a | ||
|
|
439d6440ea | ||
|
|
aee6e63337 | ||
|
|
f265656a37 | ||
|
|
8ff419aaf4 | ||
|
|
0a8340ddc2 | ||
|
|
a8a9ee9c23 | ||
|
|
25a2ff985e | ||
|
|
6ce00445b8 | ||
|
|
7952b1cbe9 | ||
|
|
cb80773b88 | ||
|
|
08e5cae591 | ||
|
|
72e67e3cf7 | ||
|
|
467225c795 | ||
|
|
69563f06c9 | ||
|
|
45877f3176 | ||
|
|
7911e997ff | ||
|
|
3f81b1a387 | ||
|
|
d0a79c9cc9 | ||
|
|
fa5c3bcd09 | ||
|
|
101c6abf04 | ||
|
|
5f257494c5 | ||
|
|
9494b58b32 | ||
|
|
7a60a294c5 | ||
|
|
b080931067 | ||
|
|
01796f3386 | ||
|
|
9f48c5eaf5 | ||
|
|
0b31c7ab79 | ||
|
|
6087eb201f | ||
|
|
006f0768e1 | ||
|
|
4068ba14b2 | ||
|
|
59f3da56bd | ||
|
|
253660f812 | ||
|
|
fe50a75d0f | ||
|
|
edd4c861f2 | ||
|
|
967cae5892 | ||
|
|
a319ccb552 | ||
|
|
9c4cf20ee1 | ||
|
|
2fa1213528 | ||
|
|
c8b90970b4 | ||
|
|
30f067faff | ||
|
|
0b5aec08e0 | ||
|
|
038c935ed7 | ||
|
|
5f3065d975 | ||
|
|
79d7f33ff6 | ||
|
|
3d85e81be2 | ||
|
|
31ddcba269 | ||
|
|
d990842ca1 | ||
|
|
f7054481ed | ||
|
|
d735ca0483 | ||
|
|
f5c113ed5c | ||
|
|
597d13f2d9 | ||
|
|
94a6e253e4 | ||
|
|
182c1f9c91 | ||
|
|
b25e486cd6 | ||
|
|
6e6ea289b7 | ||
|
|
b306d702c6 | ||
|
|
a62b41064b | ||
|
|
9be4decab7 | ||
|
|
987a77505b | ||
|
|
1c498307cf | ||
|
|
c84896af7a | ||
|
|
c1d9e6197c | ||
|
|
61e344a057 | ||
|
|
6c9e406d67 | ||
|
|
8cb1f37e50 | ||
|
|
271083be3d | ||
|
|
cdd72ac1d4 | ||
|
|
8dde99b024 | ||
|
|
bcccf0c3d8 | ||
|
|
f94d517723 | ||
|
|
182303a93c | ||
|
|
939f55dd80 | ||
|
|
f65d665e9b | ||
|
|
9e0a101b12 | ||
|
|
6e44a7f589 | ||
|
|
0e0beeb591 | ||
|
|
d52e0874c9 | ||
|
|
c82223b60e | ||
|
|
3f492c218d | ||
|
|
ea3dd4c393 | ||
|
|
fcc43ef8ed | ||
|
|
95ed121192 | ||
|
|
fd07086a2a | ||
|
|
d9a6dbe3a6 | ||
|
|
919819e682 | ||
|
|
5f7d4aac6b | ||
|
|
69f6838b4b | ||
|
|
68df9125f6 | ||
|
|
fbdeff2108 | ||
|
|
6e47cc1059 | ||
|
|
b550086d0e | ||
|
|
cafc087cc5 | ||
|
|
bdf8dd3d10 | ||
|
|
05cde47281 | ||
|
|
0f66c73f67 | ||
|
|
7e14e7f5bd | ||
|
|
b7e76d96fb | ||
|
|
375be9e109 | ||
|
|
b68fb2be7c | ||
|
|
ea2f6455a0 | ||
|
|
f9077cb073 | ||
|
|
c30e238b16 | ||
|
|
146c8f24a6 | ||
|
|
7ca602e86b | ||
|
|
fa12d24f1c | ||
|
|
0b02441fe7 | ||
|
|
a2682d4ffb | ||
|
|
c266f260fb | ||
|
|
bf78b03cdc | ||
|
|
e557ed94fb | ||
|
|
484c77bdc9 | ||
|
|
b266352f2f | ||
|
|
edcb1b58b7 | ||
|
|
482532b7d7 | ||
|
|
21dfae06e4 | ||
|
|
8a6298c98e | ||
|
|
13842a9e68 | ||
|
|
d1d736d471 | ||
|
|
87d4d95e59 | ||
|
|
7723d1bada | ||
|
|
d8e806de63 | ||
|
|
68e469d55f | ||
|
|
7db846e809 | ||
|
|
41c50a21ef |
@@ -12,7 +12,7 @@ stages:
|
||||
workflow:
|
||||
rules:
|
||||
# Disable those non-protected push triggered pipelines
|
||||
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"'
|
||||
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_COMMIT_TAG !~ /^qa-test/ && $CI_PIPELINE_SOURCE == "push"'
|
||||
when: never
|
||||
# when running merged result pipelines, it would create a temp commit id. use $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA instead of $CI_COMMIT_SHA.
|
||||
# Please use PIPELINE_COMMIT_SHA at all places that require a commit sha
|
||||
@@ -62,12 +62,17 @@ variables:
|
||||
CLANG_STATIC_ANALYSIS_IMAGE: "${CI_DOCKER_REGISTRY}/clang-static-analysis:v4.4-1-2"
|
||||
SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:3"
|
||||
|
||||
# target test config file, used by assign test job
|
||||
# target test config file, used by scan test and assign test job
|
||||
CI_TARGET_TEST_CONFIG_FILE: "$CI_PROJECT_DIR/.gitlab/ci/target-test.yml"
|
||||
|
||||
# target test repo parameters
|
||||
TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git"
|
||||
|
||||
# Set this variable to specify the file name for the known failure cases.
|
||||
KNOWN_FAILURE_CASES_FILE_NAME: "4.4.txt"
|
||||
|
||||
IDF_CI_BUILD: 1
|
||||
|
||||
.setup_tools_unless_target_test: &setup_tools_unless_target_test |
|
||||
if [[ -n "$IDF_DONT_USE_MIRRORS" ]]; then
|
||||
export IDF_MIRROR_PREFIX_MAP=
|
||||
@@ -140,6 +145,7 @@ include:
|
||||
- '.gitlab/ci/pre_check.yml'
|
||||
- '.gitlab/ci/build.yml'
|
||||
- '.gitlab/ci/assign-test.yml'
|
||||
- '.gitlab/ci/integration_test.yml'
|
||||
- '.gitlab/ci/host-test.yml'
|
||||
- '.gitlab/ci/target-test.yml'
|
||||
- '.gitlab/ci/deploy.yml'
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
- `example_test[_esp32/esp32s2/...]`
|
||||
- `fuzzer_test`
|
||||
- `host_test`
|
||||
- `integration_test[_wifi/ble]`
|
||||
- `integration_test`
|
||||
- `iperf_stress_test`
|
||||
- `macos`
|
||||
- `macos_test`
|
||||
@@ -136,10 +136,11 @@ check if there's a suitable `.if-<if-anchor-you-need>` anchor
|
||||
1. if there is, create a rule following [`rules` Template Naming Rules](#rules-template-naming-rules).For detail information, please refer to [GitLab Documentation `rules-if`](https://docs.gitlab.com/ee/ci/yaml/README.html#rulesif). Here's an example.
|
||||
|
||||
```yaml
|
||||
.rules:dev:
|
||||
.rules:patterns:python-files:
|
||||
rules:
|
||||
- <<: *if-trigger
|
||||
- <<: *if-protected
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-python-files
|
||||
```
|
||||
|
||||
2. if there isn't
|
||||
|
||||
@@ -103,69 +103,3 @@ assign_unit_test:
|
||||
BUILD_DIR: ${CI_PROJECT_DIR}/tools/unit-test-app/builds
|
||||
script:
|
||||
- python tools/ci/python_packages/ttfw_idf/IDFAssignTest.py $TEST_TYPE $TEST_DIR -c $CI_TARGET_TEST_CONFIG_FILE -o $TEST_DIR/test_configs
|
||||
|
||||
assign_integration_test:
|
||||
extends:
|
||||
- .assign_test_template
|
||||
- .rules:test:integration_test
|
||||
- .before_script_minimal
|
||||
image: ${CI_INTEGRATION_TEST_ENV_IMAGE}
|
||||
needs:
|
||||
- build_ssc_esp32
|
||||
- build_ssc_esp32c3
|
||||
artifacts:
|
||||
paths:
|
||||
- $TEST_DIR/test_configs
|
||||
variables:
|
||||
TEST_DIR: ${CI_PROJECT_DIR}/tools/ci/integration_test
|
||||
BUILD_DIR: ${CI_PROJECT_DIR}/SSC/ssc_bin
|
||||
INTEGRATION_TEST_CASE_PATH: "${CI_PROJECT_DIR}/auto_test_script/TestCaseFiles"
|
||||
ASSIGN_TEST_CASE_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIAssignTestCases.py"
|
||||
PYTHONPATH: ${CI_PROJECT_DIR}/auto_test_script/packages
|
||||
GIT_LFS_SKIP_SMUDGE: 1
|
||||
script:
|
||||
- add_gitlab_ssh_keys
|
||||
# clone test script to assign tests
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- ./tools/ci/setup_idfci.sh
|
||||
# assign integration test cases
|
||||
- python ${ASSIGN_TEST_CASE_SCRIPT} -t ${INTEGRATION_TEST_CASE_PATH} -c $CI_TARGET_TEST_CONFIG_FILE -b ${BUILD_DIR} -o $TEST_DIR/test_configs
|
||||
|
||||
update_test_cases:
|
||||
extends: .rules:ref:master-schedule
|
||||
stage: assign_test
|
||||
image: $CI_DOCKER_REGISTRY/ubuntu-test-env
|
||||
tags:
|
||||
- deploy_test
|
||||
needs:
|
||||
- build_esp_idf_tests_cmake_esp32
|
||||
- build_esp_idf_tests_cmake_esp32s2
|
||||
- build_esp_idf_tests_cmake_esp32s3
|
||||
- build_esp_idf_tests_cmake_esp32c3
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- ${CI_PROJECT_DIR}/test-management/*.log
|
||||
expire_in: 1 week
|
||||
variables:
|
||||
SUBMODULES_TO_FETCH: "components/esptool_py/esptool"
|
||||
UNIT_TEST_DIR: "${CI_PROJECT_DIR}/components/idf_test/unit_test"
|
||||
BOT_ACCOUNT_CONFIG_FILE: "${CI_PROJECT_DIR}/test-management/Config/Account.local.yml"
|
||||
PYTHONPATH: ${CI_PROJECT_DIR}/auto_test_script/packages
|
||||
PYTHON_VER: 3.7.7
|
||||
script:
|
||||
- export GIT_SHA=$(echo ${PIPELINE_COMMIT_SHA} | cut -c 1-8)
|
||||
- retry_failed git clone $TEST_MANAGEMENT_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT test-management test-management
|
||||
- cd test-management
|
||||
- echo $BOT_JIRA_ACCOUNT > ${BOT_ACCOUNT_CONFIG_FILE}
|
||||
# update unit test cases
|
||||
- export UNIT_TEST_CASE_FILES=$(find $UNIT_TEST_DIR -maxdepth 1 -name "*.yml" | xargs)
|
||||
- python ImportTestCase.py $JIRA_TEST_MANAGEMENT_PROJECT unity -d $UNIT_TEST_CASE_FILES -r $GIT_SHA
|
||||
# update example test cases
|
||||
- python ImportTestCase.py $JIRA_TEST_MANAGEMENT_PROJECT tiny_test_fw -d ${CI_PROJECT_DIR}/examples -r $GIT_SHA
|
||||
- python ImportTestCase.py $JIRA_TEST_MANAGEMENT_PROJECT tiny_test_fw -d ${CI_PROJECT_DIR}/tools/test_apps -r $GIT_SHA
|
||||
# organize test cases
|
||||
- python OrganizeTestCases.py $JIRA_TEST_MANAGEMENT_PROJECT
|
||||
|
||||
@@ -51,44 +51,6 @@ fast_template_app:
|
||||
BUILD_COMMAND_ARGS: "-p"
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
.build_ssc_template:
|
||||
extends:
|
||||
- .build_template
|
||||
- .rules:build:integration_test
|
||||
artifacts:
|
||||
paths:
|
||||
- SSC/ssc_bin
|
||||
expire_in: 1 week
|
||||
script:
|
||||
- retry_failed git clone $SSC_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT SSC SSC
|
||||
- cd SSC
|
||||
- MAKEFLAGS= ./ci_build_ssc.sh $TARGET_NAME
|
||||
|
||||
build_ssc_esp32:
|
||||
extends: .build_ssc_template
|
||||
parallel: 3
|
||||
variables:
|
||||
TARGET_NAME: "ESP32"
|
||||
|
||||
build_ssc_esp32s2:
|
||||
extends: .build_ssc_template
|
||||
parallel: 2
|
||||
variables:
|
||||
TARGET_NAME: "ESP32S2"
|
||||
|
||||
build_ssc_esp32c3:
|
||||
extends: .build_ssc_template
|
||||
parallel: 3
|
||||
variables:
|
||||
TARGET_NAME: "ESP32C3"
|
||||
|
||||
build_ssc_esp32s3:
|
||||
extends: .build_ssc_template
|
||||
parallel: 3
|
||||
variables:
|
||||
TARGET_NAME: "ESP32S3"
|
||||
|
||||
.build_esp_idf_tests_cmake_template:
|
||||
extends: .build_template
|
||||
dependencies: # set dependencies to null to avoid missing artifacts issue
|
||||
|
||||
@@ -65,15 +65,6 @@
|
||||
- "build:{0}"
|
||||
- build:target_test
|
||||
|
||||
build:integration_test:
|
||||
labels:
|
||||
- build
|
||||
patterns:
|
||||
- build_components
|
||||
- build_system
|
||||
included_in:
|
||||
- build:target_test
|
||||
|
||||
####################
|
||||
# Target Test Jobs #
|
||||
####################
|
||||
@@ -113,22 +104,6 @@ build:integration_test:
|
||||
- "build:component_ut-{0}"
|
||||
- build:target_test
|
||||
|
||||
"test:integration_test_{0}":
|
||||
matrix:
|
||||
- - wifi
|
||||
- ble
|
||||
labels:
|
||||
- integration_test_{0}
|
||||
- integration_test
|
||||
- target_test
|
||||
patterns:
|
||||
- integration_test_{0}
|
||||
# - maybe others
|
||||
included_in:
|
||||
- test:integration_test
|
||||
- build:integration_test
|
||||
- build:target_test
|
||||
|
||||
"test:host_test":
|
||||
labels:
|
||||
- host_test
|
||||
|
||||
@@ -9,49 +9,15 @@ push_to_github:
|
||||
extends:
|
||||
- .deploy_job_template
|
||||
- .before_script_minimal
|
||||
- .rules:protected-no_label
|
||||
dependencies: []
|
||||
- .rules:push_to_github
|
||||
needs:
|
||||
- check_submodule_sync
|
||||
script:
|
||||
- add_github_ssh_keys
|
||||
- git remote remove github &>/dev/null || true
|
||||
- git remote add github git@github.com:espressif/esp-idf.git
|
||||
- tools/ci/push_to_github.sh
|
||||
|
||||
deploy_test_result:
|
||||
extends:
|
||||
- .deploy_job_template
|
||||
- .before_script_minimal
|
||||
- .rules:ref:master-always
|
||||
image: $CI_DOCKER_REGISTRY/bot-env
|
||||
tags:
|
||||
- deploy_test
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- ${CI_PROJECT_DIR}/test-management/*.log
|
||||
# save all test logs as artifacts, make it easier to track errors
|
||||
- ${CI_PROJECT_DIR}/TEST_LOGS
|
||||
expire_in: 1 mos
|
||||
variables:
|
||||
UNIT_TEST_CASE_FILE: "${CI_PROJECT_DIR}/components/idf_test/unit_test/TestCaseAll.yml"
|
||||
BOT_ACCOUNT_CONFIG_FILE: "${CI_PROJECT_DIR}/test-management/Config/Account.local.yml"
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
AUTO_TEST_SCRIPT_PATH: "${CI_PROJECT_DIR}/auto_test_script"
|
||||
script:
|
||||
- add_gitlab_ssh_keys
|
||||
- export GIT_SHA=$(echo ${PIPELINE_COMMIT_SHA} | cut -c 1-8)
|
||||
- export REV_COUNT=$(git rev-list --count ${PIPELINE_COMMIT_SHA} --)
|
||||
- export SUMMARY="IDF CI test result for $GIT_SHA (r${REV_COUNT})"
|
||||
# artifacts of job update_test_cases creates test-management folder
|
||||
# we need to remove it so we can clone test-management folder again
|
||||
- rm -rf test-management
|
||||
- retry_failed git clone $TEST_MANAGEMENT_REPO
|
||||
- python3 $CHECKOUT_REF_SCRIPT test-management test-management
|
||||
- cd test-management
|
||||
- echo $BOT_JIRA_ACCOUNT > ${BOT_ACCOUNT_CONFIG_FILE}
|
||||
# update test results
|
||||
- python3 ImportTestResult.py -r "$GIT_SHA (r${REV_COUNT})" -j $JIRA_TEST_MANAGEMENT_PROJECT -s "$SUMMARY" -l CI -p ${CI_PROJECT_DIR}/TEST_LOGS --pipeline_url ${CI_PIPELINE_URL}
|
||||
|
||||
check_submodule_sync:
|
||||
extends:
|
||||
- .deploy_job_template
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
.if-protected-no_label: &if-protected-no_label
|
||||
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && $BOT_TRIGGER_WITH_LABEL == null'
|
||||
|
||||
.if-qa-test-tag: &if-qa-test-tag
|
||||
if: '$CI_COMMIT_TAG =~ /^qa-test/'
|
||||
|
||||
.if-label-build_docs: &if-label-build_docs
|
||||
if: '$BOT_LABEL_BUILD_DOCS || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build_docs(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
@@ -27,10 +30,12 @@
|
||||
if: '$BOT_LABEL_DOCS_FULL || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*docs_full(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
.if-dev-push: &if-dev-push
|
||||
if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")'
|
||||
if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_COMMIT_TAG !~ /^qa-test/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")'
|
||||
|
||||
.doc-rules:build:docs:
|
||||
rules:
|
||||
- <<: *if-qa-test-tag
|
||||
when: never
|
||||
- <<: *if-protected
|
||||
- <<: *if-label-build_docs
|
||||
- <<: *if-label-docs
|
||||
|
||||
@@ -281,13 +281,6 @@ test_mkuf2:
|
||||
- cd ${IDF_PATH}/tools/test_mkuf2
|
||||
- ./test_mkuf2.py
|
||||
|
||||
test_sbom:
|
||||
extends:
|
||||
- .host_test_template
|
||||
- .rules:patterns:sbom
|
||||
script:
|
||||
- python ${IDF_PATH}/tools/test_sbom/test_submodules.py
|
||||
|
||||
test_autocomplete:
|
||||
extends: .host_test_template
|
||||
image: $CI_DOCKER_REGISTRY/linux-shells:1
|
||||
|
||||
69
.gitlab/ci/integration_test.yml
Normal file
69
.gitlab/ci/integration_test.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
# generate dynamic integration pipeline by `idf-integration-ci` project
|
||||
|
||||
.patterns-integration_test: &patterns-integration_test
|
||||
# add all possible patterns to make sure `gen_integration_pipeline` can be triggered.
|
||||
# fine-grained control will be done while generating the pipeline
|
||||
# find `patterns` in `idf-integration-ci` project
|
||||
- "components/**/*"
|
||||
- "tools/**/*"
|
||||
- ".gitlab-ci.yml"
|
||||
- ".gitlab/ci/common.yml"
|
||||
- ".gitlab/ci/integration_test.yml"
|
||||
- ".gitmodules"
|
||||
- "CMakeLists.txt"
|
||||
- "install.sh"
|
||||
- "export.sh"
|
||||
- "Kconfig"
|
||||
- "sdkconfig.rename"
|
||||
|
||||
# Simplify the rules
|
||||
.integration_test_rules:
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE != "merge_request_event"'
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
changes: *patterns-integration_test
|
||||
# support trigger by ci labels
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*target_test(?:,[^,\n\r]+)*$/i'
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test(?:,[^,\n\r]+)*$/i'
|
||||
- if: '$CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
gen_integration_pipeline:
|
||||
extends:
|
||||
- .before_script_minimal
|
||||
- .integration_test_rules
|
||||
image: ${CI_INTEGRATION_ASSIGN_ENV}
|
||||
stage: assign_test
|
||||
cache: []
|
||||
tags:
|
||||
- assign_test
|
||||
variables:
|
||||
SUBMODULES_TO_FETCH: "none"
|
||||
GIT_LFS_SKIP_SMUDGE: 1
|
||||
needs:
|
||||
- job: fast_template_app
|
||||
artifacts: false
|
||||
optional: true
|
||||
artifacts:
|
||||
paths:
|
||||
- idf-integration-ci/child_pipeline/
|
||||
expire_in: 2 weeks
|
||||
script:
|
||||
- add_gitlab_ssh_keys
|
||||
- retry_failed git clone ${CI_GEN_INTEGRATION_PIPELINE_REPO} idf-integration-ci
|
||||
- python $CHECKOUT_REF_SCRIPT idf-integration-ci idf-integration-ci
|
||||
- cd idf-integration-ci
|
||||
- python tools/generate_child_pipeline.py -o child_pipeline/
|
||||
|
||||
child_integration_test_pipeline:
|
||||
extends:
|
||||
- .integration_test_rules
|
||||
stage: assign_test
|
||||
needs:
|
||||
- gen_integration_pipeline
|
||||
trigger:
|
||||
include:
|
||||
- artifact: idf-integration-ci/child_pipeline/pipeline.yml
|
||||
job: gen_integration_pipeline
|
||||
forward:
|
||||
yaml_variables: false
|
||||
strategy: depend
|
||||
@@ -24,13 +24,15 @@ check_pre_commit_master_release:
|
||||
- .rules:protected
|
||||
script:
|
||||
- git diff-tree --no-commit-id --name-only -r $PIPELINE_COMMIT_SHA | xargs pre-commit run --files
|
||||
- pre-commit run --hook-stage post-commit validate-sbom-manifest
|
||||
|
||||
check_pre_commit_MR:
|
||||
extends:
|
||||
- .check_pre_commit_template
|
||||
- .rules:dev
|
||||
- .rules:mr
|
||||
script:
|
||||
- python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py files ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} | xargs pre-commit run --files
|
||||
- pre-commit run --hook-stage post-commit validate-sbom-manifest
|
||||
|
||||
check_version:
|
||||
# Don't run this for feature/bugfix branches, so that it is possible to modify
|
||||
|
||||
@@ -48,9 +48,6 @@
|
||||
- "tools/tools.json"
|
||||
- "tools/ci/test_build_system*.sh"
|
||||
|
||||
.patterns-sbom: &patterns-sbom
|
||||
- "tools/test_sbom/*"
|
||||
|
||||
.patterns-custom_test: &patterns-custom_test
|
||||
- "tools/ci/python_packages/gitlab_api.py"
|
||||
- "tools/ci/python_packages/tiny_test_fw/**/*"
|
||||
@@ -88,20 +85,6 @@
|
||||
|
||||
- "components/**/test_apps/**/*"
|
||||
|
||||
.patterns-integration_test_ble: &patterns-integration_test_ble
|
||||
- "tools/ci/python_packages/gitlab_api.py"
|
||||
- "tools/ci/integration_test/**/*"
|
||||
- "components/bt/controller/lib_esp32"
|
||||
- "components/bt/controller/lib_esp32c3_family"
|
||||
- "components/bt/host/nimble/nimble"
|
||||
- "components/esp_phy/lib"
|
||||
|
||||
.patterns-integration_test_wifi: &patterns-integration_test_wifi
|
||||
- "tools/ci/python_packages/gitlab_api.py"
|
||||
- "tools/ci/integration_test/**/*"
|
||||
- "components/esp_wifi/lib"
|
||||
- "components/esp_phy/lib"
|
||||
|
||||
.patterns-host_test: &patterns-host_test
|
||||
- ".gitlab/ci/host-test.yml"
|
||||
|
||||
@@ -191,13 +174,19 @@
|
||||
if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/'
|
||||
|
||||
.if-protected: &if-protected
|
||||
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)'
|
||||
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) || $CI_COMMIT_TAG =~ /^qa-test/'
|
||||
|
||||
.if-protected-no_label: &if-protected-no_label
|
||||
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && $BOT_TRIGGER_WITH_LABEL == null'
|
||||
|
||||
.if-qa-test-tag: &if-qa-test-tag
|
||||
if: '$CI_COMMIT_TAG =~ /^qa-test/'
|
||||
|
||||
.if-dev-push: &if-dev-push
|
||||
if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")'
|
||||
if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_COMMIT_TAG !~ /^qa-test/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")'
|
||||
|
||||
.if-merge_request: &if-merge_request
|
||||
if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
|
||||
.if-schedule: &if-schedule
|
||||
if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
@@ -215,10 +204,16 @@
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
|
||||
.rules:protected-no_label:
|
||||
.rules:push_to_github:
|
||||
rules:
|
||||
- <<: *if-qa-test-tag
|
||||
when: never
|
||||
- <<: *if-protected-no_label
|
||||
|
||||
.rules:mr:
|
||||
rules:
|
||||
- <<: *if-merge_request
|
||||
|
||||
.rules:dev:
|
||||
rules:
|
||||
- <<: *if-trigger
|
||||
@@ -259,14 +254,6 @@
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-sonarqube-files
|
||||
|
||||
.rules:patterns:sbom:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-sbom
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-submodule
|
||||
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# DO NOT place comments or maintain any code from this line
|
||||
#
|
||||
@@ -336,15 +323,6 @@
|
||||
.if-label-host_test: &if-label-host_test
|
||||
if: '$BOT_LABEL_HOST_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*host_test(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
.if-label-integration_test: &if-label-integration_test
|
||||
if: '$BOT_LABEL_INTEGRATION_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
.if-label-integration_test_ble: &if-label-integration_test_ble
|
||||
if: '$BOT_LABEL_INTEGRATION_TEST_BLE || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test_ble(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
.if-label-integration_test_wifi: &if-label-integration_test_wifi
|
||||
if: '$BOT_LABEL_INTEGRATION_TEST_WIFI || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*integration_test_wifi(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
.if-label-iperf_stress_test: &if-label-iperf_stress_test
|
||||
if: '$BOT_LABEL_IPERF_STRESS_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*iperf_stress_test(?:,[^,\n\r]+)*$/i'
|
||||
|
||||
@@ -647,23 +625,6 @@
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-example_test
|
||||
|
||||
.rules:build:integration_test:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-label-build
|
||||
- <<: *if-label-integration_test
|
||||
- <<: *if-label-integration_test_ble
|
||||
- <<: *if-label-integration_test_wifi
|
||||
- <<: *if-label-target_test
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-build_components
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-build_system
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_ble
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_wifi
|
||||
|
||||
.rules:build:macos:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
@@ -692,9 +653,6 @@
|
||||
- <<: *if-label-example_test_esp32c3
|
||||
- <<: *if-label-example_test_esp32s2
|
||||
- <<: *if-label-example_test_esp32s3
|
||||
- <<: *if-label-integration_test
|
||||
- <<: *if-label-integration_test_ble
|
||||
- <<: *if-label-integration_test_wifi
|
||||
- <<: *if-label-iperf_stress_test
|
||||
- <<: *if-label-target_test
|
||||
- <<: *if-label-unit_test
|
||||
@@ -715,10 +673,6 @@
|
||||
changes: *patterns-custom_test
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-example_test
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_ble
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_wifi
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-unit_test
|
||||
|
||||
@@ -979,42 +933,6 @@
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-host_test
|
||||
|
||||
.rules:test:integration_test:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-label-build-only
|
||||
when: never
|
||||
- <<: *if-label-integration_test
|
||||
- <<: *if-label-integration_test_ble
|
||||
- <<: *if-label-integration_test_wifi
|
||||
- <<: *if-label-target_test
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_ble
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_wifi
|
||||
|
||||
.rules:test:integration_test_ble:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-label-build-only
|
||||
when: never
|
||||
- <<: *if-label-integration_test
|
||||
- <<: *if-label-integration_test_ble
|
||||
- <<: *if-label-target_test
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_ble
|
||||
|
||||
.rules:test:integration_test_wifi:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-label-build-only
|
||||
when: never
|
||||
- <<: *if-label-integration_test
|
||||
- <<: *if-label-integration_test_wifi
|
||||
- <<: *if-label-target_test
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-integration_test_wifi
|
||||
|
||||
.rules:test:submodule:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
|
||||
@@ -31,10 +31,11 @@
|
||||
- retry_failed git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
# git clone the known failure cases repo, run test
|
||||
- retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases
|
||||
- pip install minio
|
||||
- python tools/ci/get_known_failure_cases_file.py
|
||||
# run test
|
||||
- cd tools/ci/python_packages/tiny_test_fw/bin
|
||||
- run_cmd python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE --known_failure_cases_file $CI_PROJECT_DIR/known_failure_cases/known_failure_cases.txt
|
||||
- run_cmd python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE --known_failure_cases_file $CI_PROJECT_DIR/${KNOWN_FAILURE_CASES_FILE_NAME}
|
||||
|
||||
.example_test_template:
|
||||
extends: .target_test_job_template
|
||||
@@ -363,7 +364,6 @@ test_app_test_003:
|
||||
|
||||
test_app_test_004:
|
||||
extends: .test_app_esp32s2_template
|
||||
parallel: 2
|
||||
tags:
|
||||
- ESP32S2
|
||||
- Example_GENERIC
|
||||
@@ -407,17 +407,11 @@ test_app_test_flash_psram_f8r8:
|
||||
- ESP32S3
|
||||
- MSPI_F8R8
|
||||
|
||||
test_app_test_xip_psram_esp32s2:
|
||||
extends: .test_app_esp32s2_template
|
||||
test_app_test_flash_psram_esp32:
|
||||
extends: .test_app_esp32_template
|
||||
tags:
|
||||
- ESP32S2
|
||||
- Example_GENERIC
|
||||
|
||||
test_app_test_xip_psram_esp32s3:
|
||||
extends: .test_app_esp32s3_template
|
||||
tags:
|
||||
- ESP32S3
|
||||
- MSPI_F4R8
|
||||
- ESP32
|
||||
- psram
|
||||
|
||||
.component_ut_template:
|
||||
extends: .target_test_job_template
|
||||
@@ -434,10 +428,11 @@ test_app_test_xip_psram_esp32s3:
|
||||
- retry_failed git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
# git clone the known failure cases repo, run test
|
||||
- retry_failed git clone $KNOWN_FAILURE_CASES_REPO known_failure_cases
|
||||
- pip install minio
|
||||
- python tools/ci/get_known_failure_cases_file.py
|
||||
# run test
|
||||
- cd tools/ci/python_packages/tiny_test_fw/bin
|
||||
- run_cmd python Runner.py $COMPONENT_UT_DIRS -c $CONFIG_FILE -e $ENV_FILE --known_failure_cases_file $CI_PROJECT_DIR/known_failure_cases/known_failure_cases.txt
|
||||
- run_cmd python Runner.py $COMPONENT_UT_DIRS -c $CONFIG_FILE -e $ENV_FILE --known_failure_cases_file $CI_PROJECT_DIR/${KNOWN_FAILURE_CASES_FILE_NAME}
|
||||
|
||||
.component_ut_esp32_template:
|
||||
extends:
|
||||
@@ -522,7 +517,7 @@ UT_001:
|
||||
|
||||
UT_002:
|
||||
extends: .unit_test_esp32_template
|
||||
parallel: 15
|
||||
parallel: 16
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
@@ -708,7 +703,7 @@ UT_046:
|
||||
|
||||
UT_047:
|
||||
extends: .unit_test_esp32s2_template
|
||||
parallel: 7
|
||||
parallel: 8
|
||||
tags:
|
||||
- ESP32S2_IDF
|
||||
- UT_T1_1
|
||||
@@ -727,7 +722,7 @@ UT_S2_SDSPI:
|
||||
|
||||
UT_C3:
|
||||
extends: .unit_test_esp32c3_template
|
||||
parallel: 35
|
||||
parallel: 36
|
||||
tags:
|
||||
- ESP32C3_IDF
|
||||
- UT_T1_1
|
||||
@@ -791,284 +786,14 @@ UT_S3_FLASH:
|
||||
|
||||
component_ut_test_ip101:
|
||||
extends: .component_ut_esp32_template
|
||||
image: $CI_DOCKER_REGISTRY/ubuntu-test-env
|
||||
tags:
|
||||
- ESP32
|
||||
- COMPONENT_UT_IP101
|
||||
- eth_ip101
|
||||
|
||||
component_ut_test_lan8720:
|
||||
extends: .component_ut_esp32_template
|
||||
image: $CI_DOCKER_REGISTRY/ubuntu-test-env
|
||||
tags:
|
||||
- ESP32
|
||||
- COMPONENT_UT_LAN8720
|
||||
|
||||
.integration_test_template:
|
||||
extends:
|
||||
- .target_test_job_template
|
||||
- .rules:test:integration_test
|
||||
- .before_script_minimal
|
||||
image: ${CI_INTEGRATION_TEST_ENV_IMAGE}
|
||||
needs: # the assign already needs all the build jobs
|
||||
- assign_integration_test
|
||||
variables:
|
||||
LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
|
||||
LOG_PATH: "${CI_PROJECT_DIR}/TEST_LOGS"
|
||||
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
|
||||
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/tools/ci/integration_test/test_configs"
|
||||
KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/tools/ci/integration_test/KnownIssues"
|
||||
CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py"
|
||||
PREPARE_TEST_BIN_SCRIPT: "${CI_PROJECT_DIR}/tools/ci/integration_test/prepare_test_bins.py"
|
||||
PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages:${CI_PROJECT_DIR}/tools/ci/python_packages:${PYTHONPATH}"
|
||||
INITIAL_CONDITION_RETRY_COUNT: "1"
|
||||
GIT_LFS_SKIP_SMUDGE: 1
|
||||
script:
|
||||
- *define_config_file_name
|
||||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
- add_gitlab_ssh_keys
|
||||
# clone local test env configs
|
||||
- retry_failed git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
# clone test bench
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- ./tools/ci/setup_idfci.sh
|
||||
# Merge known issues
|
||||
- cat ${KNOWN_ISSUE_FILE} >> ${TEST_CASE_FILE_PATH}/KnownIssues
|
||||
# run test
|
||||
- python ${PREPARE_TEST_BIN_SCRIPT} $CONFIG_FILE
|
||||
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
|
||||
|
||||
.integration_test_esp32c3_template:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
variables:
|
||||
LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32C3_IDF"
|
||||
|
||||
nvs_compatible_test:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- $LOG_PATH
|
||||
- nvs_wifi.bin
|
||||
expire_in: 1 mos
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- NVS_Compatible
|
||||
script:
|
||||
- *define_config_file_name
|
||||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
- add_gitlab_ssh_keys
|
||||
# clone local test env configs
|
||||
- retry_failed git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
# clone test bench
|
||||
- retry_failed git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- ./tools/ci/setup_idfci.sh
|
||||
# prepare nvs bins
|
||||
- ./tools/prepare_nvs_bin.sh
|
||||
# run test
|
||||
- python ${PREPARE_TEST_BIN_SCRIPT} $CONFIG_FILE
|
||||
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
|
||||
|
||||
IT_T1_Simple:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
parallel: 2
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_Simple
|
||||
|
||||
IT_T1_WAP:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_WAP
|
||||
|
||||
IT_T2_Simple:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
parallel: 9
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_Simple
|
||||
|
||||
IT_T5_BT_Simple:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_ble
|
||||
parallel: 3
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T5_BT_Simple
|
||||
|
||||
IT_T2_BT_Simple:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_ble
|
||||
parallel: 6
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_BT_Simple
|
||||
|
||||
IT_T1_BT_Dongle:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_ble
|
||||
parallel: 2
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_BT_Dongle
|
||||
|
||||
IT_T1_AP:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_AP
|
||||
|
||||
IT_T1_AP_E:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
parallel: 5
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_AP_E
|
||||
|
||||
IT_T1_WNIC_AP:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_WNIC_AP
|
||||
|
||||
IT_T1_WNIC_AP_E:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_WNIC_AP_E
|
||||
|
||||
IT_T1_MESH1:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_MESH1
|
||||
|
||||
IT_T2_MESH1:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
parallel: 2
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_MESH1
|
||||
|
||||
IT_T3_MESH1:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T3_MESH1
|
||||
|
||||
IT_T6_MESH1:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T6_MESH1
|
||||
|
||||
IT_T12_MESH1:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T12_MESH1
|
||||
|
||||
IT_T50_MESH1:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
allow_failure: true
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T50_MESH1
|
||||
|
||||
IT_T1_MESH2:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_MESH2
|
||||
|
||||
IT_T2_WNIC:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_WNIC
|
||||
|
||||
IT_T2_AP:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_AP
|
||||
|
||||
IT_T3_Simple:
|
||||
extends:
|
||||
- .integration_test_template
|
||||
- .rules:test:integration_test_wifi
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T3_Simple
|
||||
|
||||
IT_C3_T2_BT_Simple:
|
||||
extends:
|
||||
- .integration_test_esp32c3_template
|
||||
- .rules:test:integration_test_ble
|
||||
parallel: 9
|
||||
tags:
|
||||
- ESP32C3_IDF
|
||||
- SSC_T2_BT_Simple
|
||||
|
||||
IT_C3_T5_BT_Simple:
|
||||
extends:
|
||||
- .integration_test_esp32c3_template
|
||||
- .rules:test:integration_test_ble
|
||||
parallel: 5
|
||||
tags:
|
||||
- ESP32C3_IDF
|
||||
- SSC_T5_BT_Simple
|
||||
|
||||
IT_C3_T1_BT_Dongle:
|
||||
extends:
|
||||
- .integration_test_esp32c3_template
|
||||
- .rules:test:integration_test_ble
|
||||
image: gitlab.espressif.cn:5050/qa/dockerfiles/integration-test-env-dbg:1
|
||||
parallel: 2
|
||||
tags:
|
||||
- ESP32C3_IDF
|
||||
- SSC_T1_BT_Dongle
|
||||
- eth_lan8720
|
||||
|
||||
8
.gitmodules
vendored
8
.gitmodules
vendored
@@ -34,12 +34,12 @@
|
||||
[submodule "components/bootloader/subproject/components/micro-ecc/micro-ecc"]
|
||||
path = components/bootloader/subproject/components/micro-ecc/micro-ecc
|
||||
url = ../../kmackay/micro-ecc.git
|
||||
sbom-version = 1.0
|
||||
sbom-version = 1.1
|
||||
sbom-cpe = cpe:2.3:a:micro-ecc_project:micro-ecc:{}:*:*:*:*:*:*:*
|
||||
sbom-supplier = Person: Ken MacKay
|
||||
sbom-url = https://github.com/kmackay/micro-ecc
|
||||
sbom-description = A small and fast ECDH and ECDSA implementation for 8-bit, 32-bit, and 64-bit processors
|
||||
sbom-hash = d037ec89546fad14b5c4d5456c2e23a71e554966
|
||||
sbom-hash = 24c60e243580c7868f4334a1ba3123481fe1aa48
|
||||
|
||||
[submodule "components/coap/libcoap"]
|
||||
path = components/coap/libcoap
|
||||
@@ -65,12 +65,12 @@
|
||||
[submodule "components/json/cJSON"]
|
||||
path = components/json/cJSON
|
||||
url = ../../DaveGamble/cJSON.git
|
||||
sbom-version = 1.7.15
|
||||
sbom-version = 1.7.17
|
||||
sbom-cpe = cpe:2.3:a:cjson_project:cjson:{}:*:*:*:*:*:*:*
|
||||
sbom-supplier = Person: Dave Gamble
|
||||
sbom-url = https://github.com/DaveGamble/cJSON
|
||||
sbom-description = Ultralightweight JSON parser in ANSI C
|
||||
sbom-hash = d348621ca93571343a56862df7de4ff3bc9b5667
|
||||
sbom-hash = 87d8f0961a01bf09bef98ff89bae9fdec42181ee
|
||||
|
||||
[submodule "components/mbedtls/mbedtls"]
|
||||
path = components/mbedtls/mbedtls
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
|
||||
default_stages: [commit]
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.0.1
|
||||
@@ -34,11 +36,12 @@ repos:
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: ['--config=.flake8', '--tee', '--benchmark']
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.11.5 # python 3.7 compatible
|
||||
- repo: https://github.com/asottile/reorder-python-imports
|
||||
rev: v3.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort (python)
|
||||
- id: reorder-python-imports
|
||||
name: Reorder Python imports
|
||||
args: [--py36-plus]
|
||||
exclude: >
|
||||
(?x)^(
|
||||
.*_pb2.py
|
||||
@@ -123,3 +126,8 @@ repos:
|
||||
hooks:
|
||||
- id: file-contents-sorter
|
||||
files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt)'
|
||||
- repo: https://github.com/espressif/esp-idf-sbom.git
|
||||
rev: v0.13.0
|
||||
hooks:
|
||||
- id: validate-sbom-manifest
|
||||
stages: [post-commit]
|
||||
|
||||
4
Kconfig
4
Kconfig
@@ -13,6 +13,10 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
bool
|
||||
option env="IDF_ENV_FPGA"
|
||||
|
||||
config IDF_CI_BUILD
|
||||
bool
|
||||
default y if "$(IDF_CI_BUILD)" = "y" || "$(IDF_CI_BUILD)" = 1
|
||||
|
||||
config IDF_TARGET_ARCH_RISCV
|
||||
bool
|
||||
default "n"
|
||||
|
||||
@@ -181,13 +181,18 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
ESP_LOGD(TAG, "write data size is 0");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
// find ota handle in linked list
|
||||
for (it = LIST_FIRST(&s_ota_ops_entries_head); it != NULL; it = LIST_NEXT(it, entries)) {
|
||||
if (it->handle == handle) {
|
||||
if (it->need_erase) {
|
||||
// must erase the partition before writing to it
|
||||
uint32_t first_sector = it->wrote_size / SPI_FLASH_SEC_SIZE;
|
||||
uint32_t last_sector = (it->wrote_size + size) / SPI_FLASH_SEC_SIZE;
|
||||
uint32_t first_sector = it->wrote_size / SPI_FLASH_SEC_SIZE; // first affected sector
|
||||
uint32_t last_sector = (it->wrote_size + size - 1) / SPI_FLASH_SEC_SIZE; // last affected sector
|
||||
|
||||
ret = ESP_OK;
|
||||
if ((it->wrote_size % SPI_FLASH_SEC_SIZE) == 0) {
|
||||
@@ -919,8 +924,8 @@ esp_err_t esp_ota_revoke_secure_boot_public_key(esp_ota_secure_boot_public_key_i
|
||||
|
||||
if (trusted_keys.key_digests[i] != NULL) {
|
||||
bool all_zeroes = true;
|
||||
for (unsigned j = 0; j < ESP_SECURE_BOOT_DIGEST_LEN; j++) {
|
||||
all_zeroes = all_zeroes && (*(uint8_t *)(trusted_keys.key_digests[i] + j) == 0);
|
||||
for (unsigned j = 0; j < ESP_SECURE_BOOT_DIGEST_LEN; j+=4) {
|
||||
all_zeroes = all_zeroes && (*(uint32_t *)(trusted_keys.key_digests[i] + j) == 0);
|
||||
}
|
||||
if (!all_zeroes) {
|
||||
memcpy(trusted_digests.key_digests[trusted_digests.num_digests++], (uint8_t *)trusted_keys.key_digests[i], ESP_SECURE_BOOT_DIGEST_LEN);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -103,7 +103,7 @@ esp_err_t esp_ota_begin(const esp_partition_t* partition, size_t image_size, esp
|
||||
* @param size Size of data buffer in bytes.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: Data was written to flash successfully.
|
||||
* - ESP_OK: Data was written to flash successfully, or size = 0
|
||||
* - ESP_ERR_INVALID_ARG: handle is invalid.
|
||||
* - ESP_ERR_OTA_VALIDATE_FAILED: First byte of image contains invalid app image magic byte.
|
||||
* - ESP_ERR_FLASH_OP_TIMEOUT or ESP_ERR_FLASH_OP_FAIL: Flash write failed.
|
||||
|
||||
@@ -62,34 +62,66 @@ menu "Bootloader config"
|
||||
default 4 if BOOTLOADER_LOG_LEVEL_DEBUG
|
||||
default 5 if BOOTLOADER_LOG_LEVEL_VERBOSE
|
||||
|
||||
config BOOTLOADER_SPI_CUSTOM_WP_PIN
|
||||
bool "Use custom SPI Flash WP Pin when flash pins set in eFuse (read help)"
|
||||
depends on IDF_TARGET_ESP32 && (ESPTOOLPY_FLASHMODE_QIO || ESPTOOLPY_FLASHMODE_QOUT)
|
||||
default y if BOOTLOADER_SPI_WP_PIN != 7 # backwards compatibility, can remove in IDF 5
|
||||
default n
|
||||
help
|
||||
This setting is only used if the SPI flash pins have been overridden by setting the eFuses
|
||||
SPI_PAD_CONFIG_xxx, and the SPI flash mode is QIO or QOUT.
|
||||
menu "Serial Flash Configurations"
|
||||
config BOOTLOADER_SPI_CUSTOM_WP_PIN
|
||||
bool "Use custom SPI Flash WP Pin when flash pins set in eFuse (read help)"
|
||||
depends on IDF_TARGET_ESP32 && (ESPTOOLPY_FLASHMODE_QIO || ESPTOOLPY_FLASHMODE_QOUT)
|
||||
default y if BOOTLOADER_SPI_WP_PIN != 7 # backwards compatibility, can remove in IDF 5
|
||||
default n
|
||||
help
|
||||
This setting is only used if the SPI flash pins have been overridden by setting the eFuses
|
||||
SPI_PAD_CONFIG_xxx, and the SPI flash mode is QIO or QOUT.
|
||||
|
||||
When this is the case, the eFuse config only defines 3 of the 4 Quad I/O data pins. The WP pin (aka
|
||||
ESP32 pin "SD_DATA_3" or SPI flash pin "IO2") is not specified in eFuse. The same pin is also used
|
||||
for external SPIRAM if it is enabled.
|
||||
When this is the case, the eFuse config only defines 3 of the 4 Quad I/O data pins. The WP pin (aka
|
||||
ESP32 pin "SD_DATA_3" or SPI flash pin "IO2") is not specified in eFuse. The same pin is also used
|
||||
for external SPIRAM if it is enabled.
|
||||
|
||||
If this config item is set to N (default), the correct WP pin will be automatically used for any
|
||||
Espressif chip or module with integrated flash. If a custom setting is needed, set this config item to
|
||||
Y and specify the GPIO number connected to the WP.
|
||||
If this config item is set to N (default), the correct WP pin will be automatically used for any
|
||||
Espressif chip or module with integrated flash. If a custom setting is needed, set this config item to
|
||||
Y and specify the GPIO number connected to the WP.
|
||||
|
||||
config BOOTLOADER_SPI_WP_PIN
|
||||
int "Custom SPI Flash WP Pin"
|
||||
range 0 33
|
||||
default 7
|
||||
depends on IDF_TARGET_ESP32 && (ESPTOOLPY_FLASHMODE_QIO || ESPTOOLPY_FLASHMODE_QOUT)
|
||||
#depends on BOOTLOADER_SPI_CUSTOM_WP_PIN # backwards compatibility, can uncomment in IDF 5
|
||||
help
|
||||
The option "Use custom SPI Flash WP Pin" must be set or this value is ignored
|
||||
config BOOTLOADER_SPI_WP_PIN
|
||||
int "Custom SPI Flash WP Pin"
|
||||
range 0 33
|
||||
default 7
|
||||
depends on IDF_TARGET_ESP32 && (ESPTOOLPY_FLASHMODE_QIO || ESPTOOLPY_FLASHMODE_QOUT)
|
||||
#depends on BOOTLOADER_SPI_CUSTOM_WP_PIN # backwards compatibility, can uncomment in IDF 5
|
||||
help
|
||||
The option "Use custom SPI Flash WP Pin" must be set or this value is ignored
|
||||
|
||||
If burning a customized set of SPI flash pins in eFuse and using QIO or QOUT mode for flash, set this
|
||||
value to the GPIO number of the SPI flash WP pin.
|
||||
If burning a customized set of SPI flash pins in eFuse and using QIO or QOUT mode for flash, set this
|
||||
value to the GPIO number of the SPI flash WP pin.
|
||||
|
||||
config BOOTLOADER_FLASH_DC_AWARE
|
||||
bool "Allow app adjust Dummy Cycle bits in SPI Flash for higher frequency (READ HELP FIRST)"
|
||||
help
|
||||
This will force 2nd bootloader to be loaded by DOUT mode, and will restore Dummy Cycle setting by
|
||||
resetting the Flash
|
||||
|
||||
config BOOTLOADER_FLASH_XMC_SUPPORT
|
||||
bool "Enable the support for flash chips of XMC (READ DOCS FIRST)"
|
||||
default y
|
||||
help
|
||||
Perform the startup flow recommended by XMC. Please consult XMC for the details of this flow.
|
||||
XMC chips will be forbidden to be used, when this option is disabled.
|
||||
|
||||
DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
|
||||
|
||||
comment "Features below require specific hardware (READ DOCS FIRST!)"
|
||||
|
||||
config BOOTLOADER_FLASH_32BIT_ADDR
|
||||
bool
|
||||
default y if ESPTOOLPY_FLASHSIZE_32MB || ESPTOOLPY_FLASHSIZE_64MB || ESPTOOLPY_FLASHSIZE_128MB
|
||||
default n
|
||||
help
|
||||
This is a helper config for 32bits address flash. Invisible for users.
|
||||
|
||||
config BOOTLOADER_CACHE_32BIT_ADDR_OCTAL_FLASH
|
||||
bool
|
||||
default y if ESPTOOLPY_OCT_FLASH && BOOTLOADER_FLASH_32BIT_ADDR
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
choice BOOTLOADER_VDDSDIO_BOOST
|
||||
bool "VDDSDIO LDO voltage"
|
||||
@@ -393,14 +425,6 @@ menu "Bootloader config"
|
||||
in this area of memory, you can increase it. It must be a multiple of 4 bytes.
|
||||
This area (rtc_retain_mem_t) is reserved and has access from the bootloader and an application.
|
||||
|
||||
config BOOTLOADER_FLASH_XMC_SUPPORT
|
||||
bool "Enable the support for flash chips of XMC (READ HELP FIRST)"
|
||||
default y
|
||||
help
|
||||
Perform the startup flow recommended by XMC. Please consult XMC for the details of this flow.
|
||||
XMC chips will be forbidden to be used, when this option is disabled.
|
||||
|
||||
DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.
|
||||
|
||||
endmenu # Bootloader
|
||||
|
||||
|
||||
@@ -23,3 +23,5 @@ CONFIG_FLASH_ENCRYPTION_UART_BOOTLOADER_ALLOW_CACHE CONFIG_SECURE_FLASH_
|
||||
|
||||
# Secure Boot Scheme
|
||||
CONFIG_SECURE_BOOT_ENABLED CONFIG_SECURE_BOOT_V1_ENABLED
|
||||
|
||||
CONFIG_SPI_FLASH_OCTAL_32BIT_ADDR_ENABLE CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_OCTAL_FLASH
|
||||
|
||||
@@ -9,6 +9,17 @@
|
||||
#include <esp_spi_flash.h> /* including in bootloader for error values */
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/rom/spi_flash.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp32s2/rom/spi_flash.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/rom/spi_flash.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#include "esp32c3/rom/spi_flash.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32H2
|
||||
#include "esp32h2/rom/spi_flash.h"
|
||||
#endif
|
||||
#include "bootloader_flash_override.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -48,6 +59,12 @@ esp_err_t bootloader_flash_xmc_startup(void);
|
||||
*/
|
||||
esp_err_t IRAM_ATTR __attribute__((weak)) bootloader_flash_unlock(void);
|
||||
|
||||
/**
|
||||
* @brief Get the spi flash working mode.
|
||||
*
|
||||
* @return The mode of flash working mode, see `esp_rom_spiflash_read_mode_t`
|
||||
*/
|
||||
esp_rom_spiflash_read_mode_t bootloader_flash_get_spi_mode(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -96,6 +96,18 @@ extern const bootloader_qio_info_t __attribute__((weak)) bootloader_flash_qe_sup
|
||||
*/
|
||||
esp_err_t IRAM_ATTR __attribute__((weak)) bootloader_flash_unlock(void);
|
||||
|
||||
#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_OCTAL_FLASH
|
||||
/**
|
||||
* @brief Enable 32bits address flash(larger than 16MB) can map to cache.
|
||||
*
|
||||
* @param flash_mode SPI flash working mode.
|
||||
*
|
||||
* @note This can be overridden because it's attribute weak.
|
||||
*/
|
||||
void __attribute__((weak)) bootloader_flash_32bits_address_map_enable(esp_rom_spiflash_read_mode_t flash_mode);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -130,4 +130,5 @@ typedef struct {
|
||||
|
||||
/** @cond */
|
||||
_Static_assert(sizeof(esp_app_desc_t) == 256, "esp_app_desc_t should be 256 bytes");
|
||||
_Static_assert(offsetof(esp_app_desc_t, secure_version) == 4, "secure_version field must be at 4 offset");
|
||||
/** @endcond */
|
||||
|
||||
@@ -33,6 +33,7 @@ typedef struct {
|
||||
uint32_t segment_data[ESP_IMAGE_MAX_SEGMENTS]; /* Data offsets for each segment */
|
||||
uint32_t image_len; /* Length of image on flash, in bytes */
|
||||
uint8_t image_digest[32]; /* appended SHA-256 digest */
|
||||
uint32_t secure_version; /* secure version for anti-rollback, it is covered by sha256 (set if CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y) */
|
||||
} esp_image_metadata_t;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#define CMD_RDSFDP 0x5A /* Read the SFDP of the flash */
|
||||
#define CMD_WRAP 0x77 /* Set burst with wrap command */
|
||||
#define CMD_RESUME 0x7A /* Resume command to clear flash suspend bit */
|
||||
#define CMD_FASTRD_4B 0x0C
|
||||
#define CMD_SLOWRD_4B 0x13
|
||||
|
||||
|
||||
/* Provide a Flash API for bootloader_support code,
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#include "esp32h2/rom/ets_sys.h"
|
||||
#include "esp32h2/rom/uart.h"
|
||||
#endif
|
||||
#if SOC_USB_SERIAL_JTAG_SUPPORTED
|
||||
#include "hal/usb_phy_ll.h"
|
||||
#endif
|
||||
#include "esp_rom_gpio.h"
|
||||
#include "esp_rom_uart.h"
|
||||
#include "esp_rom_sys.h"
|
||||
@@ -104,6 +107,10 @@ void bootloader_console_init(void)
|
||||
esp_rom_uart_usb_acm_init(s_usb_cdc_buf, sizeof(s_usb_cdc_buf));
|
||||
esp_rom_uart_set_as_console(ESP_ROM_UART_USB);
|
||||
esp_rom_install_channel_putc(1, bootloader_console_write_char_usb);
|
||||
#if SOC_USB_SERIAL_JTAG_SUPPORTED
|
||||
usb_phy_ll_usb_wrap_pad_enable(&USB_WRAP, true);
|
||||
usb_phy_ll_int_otg_enable(&USB_WRAP);
|
||||
#endif
|
||||
}
|
||||
#endif //CONFIG_ESP_CONSOLE_USB_CDC
|
||||
|
||||
|
||||
@@ -145,6 +145,11 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
|
||||
#include "esp32h2/rom/cache.h"
|
||||
#include "soc/cache_memory.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/rom/opi_flash.h"
|
||||
#endif
|
||||
|
||||
static const char *TAG = "bootloader_flash";
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
@@ -482,6 +487,34 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
|
||||
return spi_to_esp_err(rc);
|
||||
}
|
||||
|
||||
#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_OCTAL_FLASH
|
||||
void bootloader_flash_32bits_address_map_enable(esp_rom_spiflash_read_mode_t flash_mode)
|
||||
{
|
||||
esp_rom_opiflash_spi0rd_t cache_rd = {};
|
||||
switch (flash_mode) {
|
||||
case ESP_ROM_SPIFLASH_FASTRD_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = 8;
|
||||
cache_rd.cmd = CMD_FASTRD_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
case ESP_ROM_SPIFLASH_SLOWRD_MODE:
|
||||
cache_rd.addr_bit_len = 32;
|
||||
cache_rd.dummy_bit_len = 0;
|
||||
cache_rd.cmd = CMD_SLOWRD_4B;
|
||||
cache_rd.cmd_bit_len = 8;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
uint32_t autoload = Cache_Suspend_DCache();
|
||||
esp_rom_opiflash_cache_mode_config(flash_mode, &cache_rd);
|
||||
Cache_Resume_DCache(autoload);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // BOOTLOADER_BUILD
|
||||
|
||||
|
||||
@@ -816,3 +849,40 @@ esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
|
||||
}
|
||||
|
||||
#endif //XMC_SUPPORT
|
||||
|
||||
esp_rom_spiflash_read_mode_t bootloader_flash_get_spi_mode(void)
|
||||
{
|
||||
esp_rom_spiflash_read_mode_t spi_mode = ESP_ROM_SPIFLASH_FASTRD_MODE;
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
uint32_t spi_ctrl = REG_READ(SPI_CTRL_REG(0));
|
||||
if (spi_ctrl & SPI_FREAD_QIO) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_QIO_MODE;
|
||||
} else if (spi_ctrl & SPI_FREAD_QUAD) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_QOUT_MODE;
|
||||
} else if (spi_ctrl & SPI_FREAD_DIO) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
} else if (spi_ctrl & SPI_FREAD_DUAL) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_DOUT_MODE;
|
||||
} else if (spi_ctrl & SPI_FASTRD_MODE) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_FASTRD_MODE;
|
||||
} else {
|
||||
spi_mode = ESP_ROM_SPIFLASH_SLOWRD_MODE;
|
||||
}
|
||||
#else
|
||||
uint32_t spi_ctrl = REG_READ(SPI_MEM_CTRL_REG(0));
|
||||
if (spi_ctrl & SPI_MEM_FREAD_QIO) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_QIO_MODE;
|
||||
} else if (spi_ctrl & SPI_MEM_FREAD_QUAD) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_QOUT_MODE;
|
||||
} else if (spi_ctrl & SPI_MEM_FREAD_DIO) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_DIO_MODE;
|
||||
} else if (spi_ctrl & SPI_MEM_FREAD_DUAL) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_DOUT_MODE;
|
||||
} else if (spi_ctrl & SPI_MEM_FASTRD_MODE) {
|
||||
spi_mode = ESP_ROM_SPIFLASH_FASTRD_MODE;
|
||||
} else {
|
||||
spi_mode = ESP_ROM_SPIFLASH_SLOWRD_MODE;
|
||||
}
|
||||
#endif
|
||||
return spi_mode;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ static esp_err_t bootloader_init_spi_flash(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_SPI_FLASH_HPM_ENABLE
|
||||
#if CONFIG_BOOTLOADER_FLASH_DC_AWARE
|
||||
// Reset flash, clear volatile bits DC[0:1]. Make it work under default mode to boot.
|
||||
bootloader_spi_flash_reset();
|
||||
#endif
|
||||
@@ -228,7 +228,9 @@ static esp_err_t bootloader_init_spi_flash(void)
|
||||
#if CONFIG_ESPTOOLPY_FLASHMODE_QIO || CONFIG_ESPTOOLPY_FLASHMODE_QOUT
|
||||
bootloader_enable_qio_mode();
|
||||
#endif
|
||||
|
||||
#if CONFIG_BOOTLOADER_CACHE_32BIT_ADDR_OCTAL_FLASH
|
||||
bootloader_flash_32bits_address_map_enable(bootloader_flash_get_spi_mode());
|
||||
#endif
|
||||
print_flash_info(&bootloader_image_hdr);
|
||||
update_flash_config(&bootloader_image_hdr);
|
||||
//ensure the flash is write-protected
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <bootloader_sha.h>
|
||||
#include "bootloader_util.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "esp_efuse.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "soc/soc_memory_types.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
@@ -76,10 +77,10 @@ static bool should_map(uint32_t load_addr);
|
||||
|
||||
static esp_err_t process_segments(esp_image_metadata_t *data, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum);
|
||||
/* Load or verify a segment */
|
||||
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum);
|
||||
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum, esp_image_metadata_t *metadata);
|
||||
|
||||
/* split segment and verify if data_len is too long */
|
||||
static esp_err_t process_segment_data(intptr_t load_addr, uint32_t data_addr, uint32_t data_len, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum);
|
||||
static esp_err_t process_segment_data(int segment, intptr_t load_addr, uint32_t data_addr, uint32_t data_len, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum, esp_image_metadata_t *metadata);
|
||||
|
||||
/* Verify the main image header */
|
||||
static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t *image, bool silent);
|
||||
@@ -222,6 +223,21 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
/* For anti-rollback case, reconfirm security version of the application to prevent FI attacks */
|
||||
bool sec_ver = false;
|
||||
if (do_load) {
|
||||
sec_ver = esp_efuse_check_secure_version(data->secure_version);
|
||||
if (!sec_ver) {
|
||||
err = ESP_FAIL;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
/* Ensure that the security version check passes for image loading scenario */
|
||||
ESP_FAULT_ASSERT(!do_load || sec_ver == true);
|
||||
#endif // CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
|
||||
#endif // BOOTLOADER_BUILD
|
||||
|
||||
// Success!
|
||||
@@ -488,8 +504,8 @@ static esp_err_t process_segments(esp_image_metadata_t *data, bool silent, bool
|
||||
uint32_t next_addr = start_segments;
|
||||
for (int i = 0; i < data->image.segment_count; i++) {
|
||||
esp_image_segment_header_t *header = &data->segments[i];
|
||||
ESP_LOGV(TAG, "loading segment header %d at offset 0x%x", i, next_addr);
|
||||
CHECK_ERR(process_segment(i, next_addr, header, silent, do_load, sha_handle, checksum));
|
||||
ESP_LOGV(TAG, "loading segment header %d at offset 0x%"PRIx32, i, next_addr);
|
||||
CHECK_ERR(process_segment(i, next_addr, header, silent, do_load, sha_handle, checksum, data));
|
||||
next_addr += sizeof(esp_image_segment_header_t);
|
||||
data->segment_data[i] = next_addr;
|
||||
next_addr += header->data_len;
|
||||
@@ -510,7 +526,7 @@ err:
|
||||
return err;
|
||||
}
|
||||
|
||||
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum)
|
||||
static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segment_header_t *header, bool silent, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum, esp_image_metadata_t *metadata)
|
||||
{
|
||||
esp_err_t err;
|
||||
|
||||
@@ -568,7 +584,7 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme
|
||||
uint32_t offset_page = ((data_addr & MMAP_ALIGNED_MASK) != 0) ? 1 : 0;
|
||||
/* Data we could map in case we are not aligned to PAGE boundary is one page size lesser. */
|
||||
data_len = MIN(data_len_remain, ((free_page_count - offset_page) * SPI_FLASH_MMU_PAGE_SIZE));
|
||||
CHECK_ERR(process_segment_data(load_addr, data_addr, data_len, do_load, sha_handle, checksum));
|
||||
CHECK_ERR(process_segment_data(index, load_addr, data_addr, data_len, do_load, sha_handle, checksum, metadata));
|
||||
data_addr += data_len;
|
||||
data_len_remain -= data_len;
|
||||
}
|
||||
@@ -583,7 +599,42 @@ err:
|
||||
return err;
|
||||
}
|
||||
|
||||
static esp_err_t process_segment_data(intptr_t load_addr, uint32_t data_addr, uint32_t data_len, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum)
|
||||
#if CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
/* The __attribute__((optimize("O0"))) is used to disable optimizations for this function,
|
||||
* preventing the compiler from potentially optimizing data_buffer and reading data directly from src.
|
||||
* This is crucial as we want to read from Flash only once, ensuring the integrity of the data.
|
||||
*/
|
||||
__attribute__((optimize("O0")))
|
||||
static size_t process_esp_app_desc_data(const uint32_t *src, bootloader_sha256_handle_t sha_handle, uint32_t *checksum, esp_image_metadata_t *metadata)
|
||||
{
|
||||
/* Using data_buffer here helps to securely read secure_version
|
||||
* (for anti-rollback) from esp_app_desc_t, preventing FI attack.
|
||||
* We read data from Flash into this buffer, which is covered by sha256.
|
||||
* Therefore, if the flash is under attackers control and contents are modified
|
||||
* the sha256 comparison will fail.
|
||||
*
|
||||
* The esp_app_desc_t structure is located in DROM and is always in segment #0.
|
||||
*
|
||||
* esp_app_desc_t is always at #0 segment (index==0).
|
||||
* secure_version field of esp_app_desc_t is located at #2 word (w_i==1).
|
||||
*/
|
||||
uint32_t data_buffer[2];
|
||||
memcpy(data_buffer, src, sizeof(data_buffer));
|
||||
assert(data_buffer[0] == ESP_APP_DESC_MAGIC_WORD);
|
||||
metadata->secure_version = data_buffer[1];
|
||||
if (checksum != NULL) {
|
||||
*checksum ^= data_buffer[0] ^ data_buffer[1];
|
||||
}
|
||||
if (sha_handle != NULL) {
|
||||
bootloader_sha256_data(sha_handle, data_buffer, sizeof(data_buffer));
|
||||
}
|
||||
ESP_FAULT_ASSERT(memcmp(data_buffer, src, sizeof(data_buffer)) == 0);
|
||||
ESP_FAULT_ASSERT(memcmp(&metadata->secure_version, &src[1], sizeof(uint32_t)) == 0);
|
||||
return sizeof(data_buffer);
|
||||
}
|
||||
#endif // CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
|
||||
static esp_err_t process_segment_data(int segment, intptr_t load_addr, uint32_t data_addr, uint32_t data_len, bool do_load, bootloader_sha256_handle_t sha_handle, uint32_t *checksum, esp_image_metadata_t *metadata)
|
||||
{
|
||||
// If we are not loading, and the checksum is empty, skip processing this
|
||||
// segment for data
|
||||
@@ -616,10 +667,24 @@ static esp_err_t process_segment_data(intptr_t load_addr, uint32_t data_addr, ui
|
||||
#endif
|
||||
}
|
||||
uint32_t *dest = (uint32_t *)load_addr;
|
||||
#endif
|
||||
#endif // BOOTLOADER_BUILD
|
||||
|
||||
const uint32_t *src = data;
|
||||
|
||||
#if CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
// Case I: Bootloader verifying application
|
||||
// Case II: Bootloader verifying bootloader
|
||||
// Anti-rollback check should handle only Case I from above.
|
||||
if (segment == 0 && metadata->start_addr != ESP_BOOTLOADER_OFFSET) {
|
||||
ESP_LOGD(TAG, "additional anti-rollback check 0x%"PRIx32, data_addr);
|
||||
// The esp_app_desc_t structure is located in DROM and is always in segment #0.
|
||||
size_t len = process_esp_app_desc_data(src, sha_handle, checksum, metadata);
|
||||
data_len -= len;
|
||||
src += len / 4;
|
||||
// In BOOTLOADER_BUILD, for DROM (segment #0) we do not load it into dest (only map it), do_load = false.
|
||||
}
|
||||
#endif // CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK
|
||||
|
||||
for (size_t i = 0; i < data_len; i += 4) {
|
||||
int w_i = i / 4; // Word index
|
||||
uint32_t w = src[w_i];
|
||||
|
||||
@@ -262,6 +262,32 @@ bool config_remove_section(config_t *config, const char *section)
|
||||
return list_remove(config->sections, sec);
|
||||
}
|
||||
|
||||
bool config_update_newest_section(config_t *config, const char *section)
|
||||
{
|
||||
assert(config != NULL);
|
||||
assert(section != NULL);
|
||||
|
||||
list_node_t *first_node = list_begin(config->sections);
|
||||
if (first_node == NULL) {
|
||||
return false;
|
||||
}
|
||||
section_t *first_sec = list_node(first_node);
|
||||
if (strcmp(first_sec->name, section) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const list_node_t *node = list_begin(config->sections); node != list_end(config->sections); node = list_next(node)) {
|
||||
section_t *sec = list_node(node);
|
||||
if (strcmp(sec->name, section) == 0) {
|
||||
list_delete(config->sections, sec);
|
||||
list_prepend(config->sections, sec);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool config_remove_key(config_t *config, const char *section, const char *key)
|
||||
{
|
||||
assert(config != NULL);
|
||||
|
||||
@@ -107,6 +107,11 @@ void config_set_string(config_t *config, const char *section, const char *key, c
|
||||
// Neither |config| nor |section| may be NULL.
|
||||
bool config_remove_section(config_t *config, const char *section);
|
||||
|
||||
// Updates |section| to be the first section in |config|. Return true if |section| is in
|
||||
// |config| and updated successfully, false otherwise.
|
||||
// Neither |config| nor |section| may be NULL.
|
||||
bool config_update_newest_section(config_t *config, const char *section);
|
||||
|
||||
// Removes one specific |key| residing in |section| of the |config|. Returns true
|
||||
// if the section and key were found and the key was removed, false otherwise.
|
||||
// None of |config|, |section|, or |key| may be NULL.
|
||||
|
||||
@@ -205,6 +205,11 @@ menu "HCI UART(H4) Options"
|
||||
help
|
||||
UART Baudrate for HCI. Please use standard baudrate.
|
||||
|
||||
config BTDM_CTRL_HCI_UART_FLOW_CTRL_EN
|
||||
bool "Enable UART flow control"
|
||||
depends on BTDM_CTRL_HCI_MODE_UART_H4
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
menu "MODEM SLEEP Options"
|
||||
@@ -351,7 +356,7 @@ config BTDM_SCAN_DUPL_CACHE_SIZE
|
||||
default 100
|
||||
help
|
||||
Maximum number of devices which can be recorded in scan duplicate filter.
|
||||
When the maximum amount of device in the filter is reached, the cache will be refreshed.
|
||||
When the maximum amount of device in the filter is reached, the oldest device will be refreshed.
|
||||
|
||||
config BTDM_SCAN_DUPL_CACHE_REFRESH_PERIOD
|
||||
int "Duplicate scan list refresh period (seconds)"
|
||||
|
||||
@@ -234,6 +234,8 @@ extern int coex_wifi_channel_get(uint8_t *primary, uint8_t *secondary);
|
||||
extern int coex_register_wifi_channel_change_callback(void *cb);
|
||||
/* Shutdown */
|
||||
extern void esp_bt_controller_shutdown(void);
|
||||
extern void sdk_config_set_bt_pll_track_enable(bool enable);
|
||||
extern void sdk_config_set_uart_flow_ctrl_enable(bool enable);
|
||||
|
||||
extern char _bss_start_btdm;
|
||||
extern char _bss_end_btdm;
|
||||
@@ -1570,6 +1572,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
btdm_controller_set_sleep_mode(BTDM_MODEM_SLEEP_MODE_NONE);
|
||||
#endif
|
||||
|
||||
#if CONFIG_BTDM_CTRL_HCI_UART_FLOW_CTRL_EN
|
||||
sdk_config_set_uart_flow_ctrl_enable(true);
|
||||
#else
|
||||
sdk_config_set_uart_flow_ctrl_enable(false);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
if (!s_btdm_allow_light_sleep) {
|
||||
if ((err = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "btLS", &s_light_sleep_pm_lock)) != ESP_OK) {
|
||||
@@ -1721,6 +1729,8 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
btdm_controller_enable_sleep(true);
|
||||
}
|
||||
|
||||
sdk_config_set_bt_pll_track_enable(true);
|
||||
|
||||
// inititalize bluetooth baseband
|
||||
btdm_check_and_init_bb();
|
||||
|
||||
|
||||
@@ -279,20 +279,19 @@ choice BT_CTRL_SCAN_DUPL_TYPE
|
||||
config BT_CTRL_SCAN_DUPL_TYPE_DEVICE
|
||||
bool "Scan Duplicate By Device Address"
|
||||
help
|
||||
This way is to use advertiser address filtering. The adv packet of the same address is only
|
||||
allowed to be reported once
|
||||
Advertising packets with the same address, address type, and advertising type are reported once.
|
||||
|
||||
config BT_CTRL_SCAN_DUPL_TYPE_DATA
|
||||
bool "Scan Duplicate By Advertising Data"
|
||||
help
|
||||
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.
|
||||
Advertising packets with identical advertising data, address type, and advertising type
|
||||
are reported only once, even if they originate from different devices.
|
||||
|
||||
config BT_CTRL_SCAN_DUPL_TYPE_DATA_DEVICE
|
||||
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 allowed to be reported.
|
||||
Advertising packets with the same address, advertising data, address type,
|
||||
and advertising type are reported only once.
|
||||
endchoice
|
||||
|
||||
config BT_CTRL_SCAN_DUPL_TYPE
|
||||
@@ -468,3 +467,11 @@ config BT_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
|
||||
Disable active scan backoff. The bluetooth spec requires that scanners should run a backoff procedure to
|
||||
minimize collision of scan request PDUs from nultiple scanners. If scan backoff is disabled, in active
|
||||
scanning, scan request PDU will be sent every time when HW receives scannable ADV PDU.
|
||||
|
||||
config BT_BLE_ADV_DATA_LENGTH_ZERO_AUX
|
||||
bool "Enable aux packet when ext adv data length is zero"
|
||||
default n
|
||||
help
|
||||
When this option is enabled, auxiliary packets will be present in the events of
|
||||
'Non-Connectable and Non-Scannable' regardless of whether the advertising length is 0.
|
||||
If this option is not enabled, auxiliary packets will only be present when the advertising length is not 0.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -694,7 +694,7 @@ static bool IRAM_ATTR is_in_isr_wrapper(void)
|
||||
|
||||
static void *malloc_internal_wrapper(size_t size)
|
||||
{
|
||||
void *p = heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA);
|
||||
void *p = heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA);
|
||||
if(p == NULL) {
|
||||
ESP_LOGE(BT_LOG_TAG, "Malloc failed");
|
||||
}
|
||||
@@ -763,19 +763,26 @@ static void btdm_sleep_enter_phase1_wrapper(uint32_t lpcycles)
|
||||
return;
|
||||
}
|
||||
|
||||
// start a timer to wake up and acquire the pm_lock before modem_sleep awakes
|
||||
uint32_t us_to_sleep = btdm_lpcycles_2_hus(lpcycles, NULL) >> 1;
|
||||
|
||||
#define BTDM_MIN_TIMER_UNCERTAINTY_US (1800)
|
||||
#define BTDM_RTC_SLOW_CLK_RC_DRIFT_PERCENT 7
|
||||
assert(us_to_sleep > BTDM_MIN_TIMER_UNCERTAINTY_US);
|
||||
// allow a maximum time uncertainty to be about 488ppm(1/2048) at least as clock drift
|
||||
// and set the timer in advance
|
||||
uint32_t uncertainty = (us_to_sleep >> 11);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
if (rtc_clk_slow_freq_get() == RTC_SLOW_FREQ_RTC) {
|
||||
uncertainty = us_to_sleep * BTDM_RTC_SLOW_CLK_RC_DRIFT_PERCENT / 100;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (uncertainty < BTDM_MIN_TIMER_UNCERTAINTY_US) {
|
||||
uncertainty = BTDM_MIN_TIMER_UNCERTAINTY_US;
|
||||
}
|
||||
|
||||
assert (s_lp_stat.wakeup_timer_started == 0);
|
||||
// start a timer to wake up and acquire the pm_lock before modem_sleep awakes
|
||||
if (esp_timer_start_once(s_btdm_slp_tmr, us_to_sleep - uncertainty) == ESP_OK) {
|
||||
s_lp_stat.wakeup_timer_started = 1;
|
||||
} else {
|
||||
@@ -794,12 +801,12 @@ static void btdm_sleep_enter_phase2_wrapper(void)
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if (s_lp_stat.pm_lock_released == 0) {
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
if (s_lp_stat.pm_lock_released == 0) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
#endif
|
||||
s_lp_stat.pm_lock_released = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1195,18 +1202,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
|
||||
btdm_controller_mem_init();
|
||||
|
||||
#if CONFIG_MAC_BB_PD
|
||||
if (esp_register_mac_bb_pd_callback(btdm_mac_bb_power_down_cb) != 0) {
|
||||
err = ESP_ERR_INVALID_ARG;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (esp_register_mac_bb_pu_callback(btdm_mac_bb_power_up_cb) != 0) {
|
||||
err = ESP_ERR_INVALID_ARG;
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
osi_funcs_p = (struct osi_funcs_t *)malloc_internal_wrapper(sizeof(struct osi_funcs_t));
|
||||
if (osi_funcs_p == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
@@ -1447,11 +1442,6 @@ static void bt_controller_deinit_internal(void)
|
||||
btdm_lpcycle_us = 0;
|
||||
} while (0);
|
||||
|
||||
#if CONFIG_MAC_BB_PD
|
||||
esp_unregister_mac_bb_pd_callback(btdm_mac_bb_power_down_cb);
|
||||
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
|
||||
#endif
|
||||
|
||||
esp_bt_power_domain_off();
|
||||
#if CONFIG_MAC_BB_PD
|
||||
esp_mac_bb_pd_mem_deinit();
|
||||
@@ -1500,6 +1490,18 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
s_lp_stat.pm_lock_released = 0;
|
||||
#endif
|
||||
|
||||
#if CONFIG_MAC_BB_PD
|
||||
if (esp_register_mac_bb_pd_callback(btdm_mac_bb_power_down_cb) != 0) {
|
||||
ret = ESP_ERR_INVALID_ARG;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (esp_register_mac_bb_pu_callback(btdm_mac_bb_power_up_cb) != 0) {
|
||||
ret = ESP_ERR_INVALID_ARG;
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (s_lp_cntl.enable) {
|
||||
btdm_controller_enable_sleep(true);
|
||||
}
|
||||
@@ -1519,6 +1521,11 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
error:
|
||||
// disable low power mode
|
||||
do {
|
||||
#if CONFIG_MAC_BB_PD
|
||||
esp_unregister_mac_bb_pd_callback(btdm_mac_bb_power_down_cb);
|
||||
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
|
||||
#endif
|
||||
|
||||
btdm_controller_enable_sleep(false);
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
if (s_lp_cntl.no_light_sleep) {
|
||||
@@ -1565,6 +1572,11 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
|
||||
// disable low power mode
|
||||
do {
|
||||
#if CONFIG_MAC_BB_PD
|
||||
esp_unregister_mac_bb_pd_callback(btdm_mac_bb_power_down_cb);
|
||||
esp_unregister_mac_bb_pu_callback(btdm_mac_bb_power_up_cb);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
if (s_lp_cntl.no_light_sleep) {
|
||||
esp_pm_lock_release(s_light_sleep_pm_lock);
|
||||
|
||||
Submodule components/bt/controller/lib_esp32 updated: 7bb0d445db...e43c9b121f
Submodule components/bt/controller/lib_esp32c3_family updated: 0cfac1b21e...e5c0f7256e
@@ -6,6 +6,15 @@ if BLE_MESH
|
||||
help
|
||||
It is a temporary solution and needs further modifications.
|
||||
|
||||
config BLE_MESH_RANDOM_ADV_INTERVAL
|
||||
bool "Support using random adv interval for mesh packets"
|
||||
select BT_BLE_HIGH_DUTY_ADV_INTERVAL if BT_BLUEDROID_ENABLED
|
||||
default n
|
||||
help
|
||||
Enable this option to allow using random advertising interval
|
||||
for mesh packets. And this could help avoid collision of
|
||||
advertising packets.
|
||||
|
||||
config BLE_MESH_USE_DUPLICATE_SCAN
|
||||
bool "Support Duplicate Scan in BLE Mesh"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
@@ -536,6 +545,20 @@ if BLE_MESH
|
||||
Provisioner can provision up to 20 nodes and each node contains two elements,
|
||||
then the replay protection list size of Provisioner should be at least 40.
|
||||
|
||||
config BLE_MESH_NOT_RELAY_REPLAY_MSG
|
||||
bool "Not relay replayed messages in a mesh network"
|
||||
depends on BLE_MESH_EXPERIMENTAL
|
||||
default n
|
||||
help
|
||||
There may be many expired messages in a complex mesh network that would be
|
||||
considered replayed messages.
|
||||
Enable this option will refuse to relay such messages, which could help to
|
||||
reduce invalid packets in the mesh network.
|
||||
However, it should be noted that enabling this option may result in packet
|
||||
loss in certain environments.
|
||||
Therefore, users need to decide whether to enable this option according to
|
||||
the actual usage situation.
|
||||
|
||||
config BLE_MESH_MSG_CACHE_SIZE
|
||||
int "Network message cache size"
|
||||
default 10
|
||||
@@ -1239,4 +1262,12 @@ if BLE_MESH
|
||||
|
||||
endmenu
|
||||
|
||||
config BLE_MESH_EXPERIMENTAL
|
||||
bool "Make BLE Mesh experimental features visible"
|
||||
default n
|
||||
help
|
||||
Make BLE Mesh Experimental features visible.
|
||||
Experimental features list:
|
||||
- CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG
|
||||
|
||||
endif # BLE_MESH
|
||||
|
||||
@@ -65,7 +65,9 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp
|
||||
esp_err_t esp_ble_mesh_deinit(esp_ble_mesh_deinit_param_t *param)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
SemaphoreHandle_t semaphore = NULL;
|
||||
btc_msg_t msg = {0};
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
if (param == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
@@ -73,13 +75,36 @@ esp_err_t esp_ble_mesh_deinit(esp_ble_mesh_deinit_param_t *param)
|
||||
|
||||
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
|
||||
|
||||
// Create a semaphore
|
||||
if ((semaphore = xSemaphoreCreateCounting(1, 0)) == NULL) {
|
||||
BT_ERR("Failed to create semaphore");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
arg.mesh_deinit.param.erase_flash = param->erase_flash;
|
||||
/* Transport semaphore pointer to BTC layer, and will give the semaphore in the BTC task */
|
||||
arg.mesh_deinit.semaphore = semaphore;
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_PROV;
|
||||
msg.act = BTC_BLE_MESH_ACT_DEINIT_MESH;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
if (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) != BT_STATUS_SUCCESS) {
|
||||
vSemaphoreDelete(semaphore);
|
||||
BT_ERR("Failed to start mesh deinit");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
/* Take the Semaphore, wait BLE Mesh de-initialization to finish. */
|
||||
xSemaphoreTake(semaphore, portMAX_DELAY);
|
||||
/* Don't forget to delete the semaphore at the end. */
|
||||
vSemaphoreDelete(semaphore);
|
||||
|
||||
ret = bt_mesh_host_deinit();
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_DEINIT */
|
||||
|
||||
@@ -2268,6 +2268,8 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
|
||||
case BTC_BLE_MESH_ACT_DEINIT_MESH:
|
||||
act = ESP_BLE_MESH_DEINIT_MESH_COMP_EVT;
|
||||
param.deinit_mesh_comp.err_code = bt_mesh_deinit((struct bt_mesh_deinit_param *)&arg->mesh_deinit.param);
|
||||
/* Give the semaphore when BLE Mesh de-initialization is finished. */
|
||||
xSemaphoreGive(arg->mesh_deinit.semaphore);
|
||||
break;
|
||||
#endif /* CONFIG_BLE_MESH_DEINIT */
|
||||
default:
|
||||
|
||||
@@ -309,6 +309,7 @@ typedef union {
|
||||
} model_unsub_group_addr;
|
||||
struct ble_mesh_deinit_args {
|
||||
esp_ble_mesh_deinit_param_t param;
|
||||
SemaphoreHandle_t semaphore;
|
||||
} mesh_deinit;
|
||||
} btc_ble_mesh_prov_args_t;
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ void btc_ble_mesh_time_scene_client_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_ble_mesh_time_scene_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
void btc_ble_mesh_time_scene_client_arg_deep_free(btc_msg_t *msg);
|
||||
|
||||
void btc_ble_mesh_time_scene_client_publish_callback(uint32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
@@ -67,6 +67,8 @@ uint8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send);
|
||||
|
||||
int bt_mesh_rand(void *buf, size_t len);
|
||||
|
||||
uint32_t bt_mesh_get_rand(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -104,3 +104,8 @@ int bt_mesh_rand(void *buf, size_t len)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t bt_mesh_get_rand(void)
|
||||
{
|
||||
return esp_random();
|
||||
}
|
||||
|
||||
@@ -99,6 +99,11 @@ int bt_mesh_host_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_mesh_host_deinit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bt_mesh_hci_init(void)
|
||||
{
|
||||
const uint8_t *features = controller_get_interface()->get_features_ble()->as_array;
|
||||
@@ -316,6 +321,7 @@ int bt_le_adv_start(const struct bt_mesh_adv_param *param,
|
||||
tBLE_ADDR_TYPE addr_type_own = 0U;
|
||||
tBLE_BD_ADDR p_dir_bda = {0};
|
||||
tBTM_BLE_AFP adv_fil_pol = 0U;
|
||||
uint16_t interval = 0U;
|
||||
uint8_t adv_type = 0U;
|
||||
int err = 0;
|
||||
|
||||
@@ -365,9 +371,24 @@ int bt_le_adv_start(const struct bt_mesh_adv_param *param,
|
||||
adv_fil_pol = BLE_MESH_AP_SCAN_CONN_ALL;
|
||||
p_start_adv_cb = start_adv_completed_cb;
|
||||
|
||||
interval = param->interval_min;
|
||||
|
||||
#if CONFIG_BLE_MESH_RANDOM_ADV_INTERVAL
|
||||
/* If non-connectable mesh packets are transmitted with an adv interval
|
||||
* not smaller than 10ms, then we will use a random adv interval between
|
||||
* [interval / 2, interval] for them.
|
||||
*/
|
||||
if (adv_type == BLE_MESH_ADV_NONCONN_IND && interval >= 16) {
|
||||
interval >>= 1;
|
||||
interval += (bt_mesh_get_rand() % (interval + 1));
|
||||
|
||||
BT_INFO("%u->%u", param->interval_min, interval);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Check if we can start adv using BTM_BleSetAdvParamsStartAdvCheck */
|
||||
BLE_MESH_BTM_CHECK_STATUS(
|
||||
BTM_BleSetAdvParamsAll(param->interval_min, param->interval_max, adv_type,
|
||||
BTM_BleSetAdvParamsAll(interval, interval, adv_type,
|
||||
addr_type_own, &p_dir_bda,
|
||||
channel_map, adv_fil_pol, p_start_adv_cb));
|
||||
BLE_MESH_BTM_CHECK_STATUS(BTM_BleStartAdv());
|
||||
|
||||
@@ -659,6 +659,7 @@ struct bt_mesh_gatt_attr {
|
||||
}
|
||||
|
||||
int bt_mesh_host_init(void);
|
||||
int bt_mesh_host_deinit(void);
|
||||
|
||||
int bt_le_adv_start(const struct bt_mesh_adv_param *param,
|
||||
const struct bt_mesh_adv_data *ad, size_t ad_len,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -1265,7 +1265,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
||||
#endif
|
||||
|
||||
if (!buf) {
|
||||
BT_ERR("Out of relay buffers");
|
||||
BT_INFO("Out of relay buffers");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1509,7 +1509,11 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
|
||||
* was neither a local element nor an LPN we're Friends for.
|
||||
*/
|
||||
if (!BLE_MESH_ADDR_IS_UNICAST(rx.ctx.recv_dst) ||
|
||||
(!rx.local_match && !rx.friend_match)) {
|
||||
(!rx.local_match && !rx.friend_match
|
||||
#if CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG
|
||||
&& !rx.replay_msg
|
||||
#endif
|
||||
)) {
|
||||
net_buf_simple_restore(&buf, &state);
|
||||
bt_mesh_net_relay(&buf, &rx);
|
||||
}
|
||||
|
||||
@@ -294,6 +294,9 @@ struct bt_mesh_net_rx {
|
||||
ctl:1, /* Network Control */
|
||||
net_if:2, /* Network interface */
|
||||
local_match:1, /* Matched a local element */
|
||||
#if CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG
|
||||
replay_msg:1, /* Replayed messages */
|
||||
#endif
|
||||
friend_match:1; /* Matched an LPN we're friends for */
|
||||
uint16_t msg_cache_idx; /* Index of entry in message cache */
|
||||
};
|
||||
|
||||
@@ -82,12 +82,14 @@ static uint8_t bt_mesh_gatts_addr[6];
|
||||
|
||||
#endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */
|
||||
|
||||
static bool g_host_init = false;
|
||||
|
||||
int bt_mesh_host_init(void)
|
||||
{
|
||||
static bool init = false;
|
||||
int rc;
|
||||
|
||||
if (init == true) {
|
||||
if (g_host_init == true) {
|
||||
BT_WARN("Already initialized host for mesh!");
|
||||
return -EALREADY;
|
||||
}
|
||||
|
||||
@@ -102,7 +104,30 @@ int bt_mesh_host_init(void)
|
||||
}
|
||||
|
||||
osi_alarm_init();
|
||||
init = true;
|
||||
g_host_init = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_mesh_host_deinit(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (g_host_init == false) {
|
||||
return -EALREADY;
|
||||
}
|
||||
|
||||
osi_alarm_deinit();
|
||||
|
||||
rc = osi_alarm_delete_mux();
|
||||
if (rc != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
btc_deinit();
|
||||
|
||||
g_host_init = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -759,15 +784,17 @@ int bt_le_adv_start(const struct bt_mesh_adv_param *param,
|
||||
const struct bt_mesh_adv_data *ad, size_t ad_len,
|
||||
const struct bt_mesh_adv_data *sd, size_t sd_len)
|
||||
{
|
||||
struct ble_gap_adv_params adv_params;
|
||||
uint8_t buf[BLE_HS_ADV_MAX_SZ];
|
||||
uint16_t interval = 0;
|
||||
uint8_t buf_len = 0;
|
||||
int err;
|
||||
|
||||
#if BLE_MESH_DEV
|
||||
if (bt_mesh_atomic_test_bit(bt_mesh_dev.flags, BLE_MESH_DEV_ADVERTISING)) {
|
||||
return -EALREADY;
|
||||
}
|
||||
#endif
|
||||
uint8_t buf[BLE_HS_ADV_MAX_SZ];
|
||||
uint8_t buf_len = 0;
|
||||
int err;
|
||||
struct ble_gap_adv_params adv_params;
|
||||
|
||||
err = set_ad(ad, ad_len, buf, &buf_len);
|
||||
if (err) {
|
||||
@@ -798,8 +825,6 @@ int bt_le_adv_start(const struct bt_mesh_adv_param *param,
|
||||
}
|
||||
|
||||
memset(&adv_params, 0, sizeof adv_params);
|
||||
adv_params.itvl_min = param->interval_min;
|
||||
adv_params.itvl_max = param->interval_max;
|
||||
|
||||
if (param->options & BLE_MESH_ADV_OPT_CONNECTABLE) {
|
||||
adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
|
||||
@@ -812,6 +837,25 @@ int bt_le_adv_start(const struct bt_mesh_adv_param *param,
|
||||
adv_params.disc_mode = BLE_GAP_DISC_MODE_NON;
|
||||
}
|
||||
|
||||
interval = param->interval_min;
|
||||
|
||||
#if CONFIG_BLE_MESH_RANDOM_ADV_INTERVAL
|
||||
/* If non-connectable mesh packets are transmitted with an adv interval
|
||||
* not smaller than 10ms, then we will use a random adv interval between
|
||||
* [interval / 2, interval] for them.
|
||||
*/
|
||||
if (adv_params.conn_mode == BLE_GAP_CONN_MODE_NON &&
|
||||
adv_params.disc_mode == BLE_GAP_DISC_MODE_NON && interval >= 16) {
|
||||
interval >>= 1;
|
||||
interval += (bt_mesh_get_rand() % (interval + 1));
|
||||
|
||||
BT_INFO("%u->%u", param->interval_min, interval);
|
||||
}
|
||||
#endif
|
||||
|
||||
adv_params.itvl_min = interval;
|
||||
adv_params.itvl_max = interval;
|
||||
|
||||
again:
|
||||
err = ble_gap_adv_start(BLE_OWN_ADDR_PUBLIC, NULL, BLE_HS_FOREVER, &adv_params,
|
||||
gap_event_cb, NULL);
|
||||
@@ -877,7 +921,7 @@ int bt_mesh_ble_adv_start(const struct bt_mesh_ble_adv_param *param,
|
||||
break;
|
||||
case BLE_MESH_ADV_NONCONN_IND:
|
||||
adv_params.conn_mode = BLE_GAP_CONN_MODE_NON;
|
||||
adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
|
||||
adv_params.disc_mode = BLE_GAP_DISC_MODE_NON;
|
||||
break;
|
||||
case BLE_MESH_ADV_DIRECT_IND_LOW_DUTY:
|
||||
adv_params.conn_mode = BLE_GAP_CONN_MODE_DIR;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "provisioner_prov.h"
|
||||
#include "provisioner_main.h"
|
||||
|
||||
#define PROV_SVC_ADV_RX_CHECK(pre, cur) ((cur) < (pre) ? ((cur) + (UINT32_MAX - (pre)) >= 200) : ((cur) - (pre) >= 200))
|
||||
|
||||
#if CONFIG_BLE_MESH_PROVISIONER
|
||||
|
||||
_Static_assert(BLE_MESH_MAX_CONN >= CONFIG_BLE_MESH_PBG_SAME_TIME,
|
||||
@@ -3426,6 +3428,21 @@ int bt_mesh_provisioner_prov_deinit(bool erase)
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_DEINIT */
|
||||
|
||||
static bool bt_mesh_prov_svc_adv_filter(void)
|
||||
{
|
||||
static uint32_t timestamp = 0;
|
||||
static uint32_t pre_timestamp = 0;
|
||||
|
||||
timestamp = k_uptime_get_32();
|
||||
|
||||
if (PROV_SVC_ADV_RX_CHECK(pre_timestamp, timestamp)) {
|
||||
pre_timestamp = timestamp;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool is_unprov_dev_info_callback_to_app(bt_mesh_prov_bearer_t bearer, const uint8_t uuid[16],
|
||||
const bt_mesh_addr_t *addr, uint16_t oob_info, int8_t rssi)
|
||||
{
|
||||
@@ -3443,6 +3460,11 @@ static bool is_unprov_dev_info_callback_to_app(bt_mesh_prov_bearer_t bearer, con
|
||||
|
||||
if (i == ARRAY_SIZE(unprov_dev)) {
|
||||
BT_DBG("Device not in queue, notify to app layer");
|
||||
|
||||
if (adv_type == BLE_MESH_ADV_IND && bt_mesh_prov_svc_adv_filter()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (notify_unprov_adv_pkt_cb) {
|
||||
notify_unprov_adv_pkt_cb(addr->val, addr->type, adv_type, uuid, oob_info, bearer, rssi);
|
||||
}
|
||||
|
||||
@@ -711,6 +711,9 @@ bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match)
|
||||
|
||||
return false;
|
||||
} else {
|
||||
#if CONFIG_BLE_MESH_NOT_RELAY_REPLAY_MSG
|
||||
rx->replay_msg = 1;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ config BT_BLUEDROID_PINNED_TO_CORE
|
||||
config BT_BTU_TASK_STACK_SIZE
|
||||
int "Bluetooth Bluedroid Host Stack task stack size"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
default 4096
|
||||
default 4352
|
||||
help
|
||||
This select btu task stack size
|
||||
|
||||
@@ -61,21 +61,23 @@ config BT_SPP_ENABLED
|
||||
help
|
||||
This enables the Serial Port Profile
|
||||
|
||||
config BT_HFP_ENABLE
|
||||
menuconfig BT_HFP_ENABLE
|
||||
bool "Hands Free/Handset Profile"
|
||||
depends on BT_CLASSIC_ENABLED
|
||||
default n
|
||||
help
|
||||
Hands Free Unit and Audio Gateway can be included simultaneously
|
||||
but they cannot run simultaneously due to internal limitations.
|
||||
|
||||
choice BT_HFP_ROLE
|
||||
prompt "Hands-free Profile Role configuration"
|
||||
config BT_HFP_CLIENT_ENABLE
|
||||
bool "Hands Free Unit"
|
||||
depends on BT_HFP_ENABLE
|
||||
default y
|
||||
|
||||
config BT_HFP_CLIENT_ENABLE
|
||||
bool "Hands Free Unit"
|
||||
|
||||
config BT_HFP_AG_ENABLE
|
||||
bool "Audio Gateway"
|
||||
endchoice
|
||||
config BT_HFP_AG_ENABLE
|
||||
bool "Audio Gateway"
|
||||
depends on BT_HFP_ENABLE
|
||||
default y
|
||||
|
||||
choice BT_HFP_AUDIO_DATA_PATH
|
||||
prompt "audio(SCO) data path"
|
||||
@@ -99,26 +101,26 @@ config BT_HFP_WBS_ENABLE
|
||||
This enables Wide Band Speech. Should disable it when SCO data path is PCM.
|
||||
Otherwise there will be no data transmited via GPIOs.
|
||||
|
||||
config BT_HID_ENABLED
|
||||
|
||||
menuconfig BT_HID_ENABLED
|
||||
bool "Classic BT HID"
|
||||
depends on BT_CLASSIC_ENABLED
|
||||
default n
|
||||
help
|
||||
This enables the BT HID Host
|
||||
|
||||
choice BT_HID_ROLE
|
||||
prompt "Profile Role configuration"
|
||||
config BT_HID_HOST_ENABLED
|
||||
bool "Classic BT HID Host"
|
||||
depends on BT_HID_ENABLED
|
||||
config BT_HID_HOST_ENABLED
|
||||
bool "Classic BT HID Host"
|
||||
help
|
||||
This enables the BT HID Host
|
||||
default n
|
||||
help
|
||||
This enables the BT HID Host
|
||||
|
||||
config BT_HID_DEVICE_ENABLED
|
||||
bool "Classic BT HID Device"
|
||||
help
|
||||
This enables the BT HID Device
|
||||
endchoice
|
||||
config BT_HID_DEVICE_ENABLED
|
||||
bool "Classic BT HID Device"
|
||||
depends on BT_HID_ENABLED
|
||||
help
|
||||
This enables the BT HID Device
|
||||
|
||||
config BT_SSP_ENABLED
|
||||
bool "Secure Simple Pairing"
|
||||
@@ -205,7 +207,10 @@ config BT_GATTS_ROBUST_CACHING_ENABLED
|
||||
depends on BT_GATTS_ENABLE
|
||||
default n
|
||||
help
|
||||
This option enable gatt robust caching feature on server
|
||||
This option enables the GATT robust caching feature on the server.
|
||||
if turned on, the Client Supported Features characteristic, Database Hash characteristic,
|
||||
and Server Supported Features characteristic will be included in the GAP SERVICE.
|
||||
|
||||
|
||||
config BT_GATTS_DEVICE_NAME_WRITABLE
|
||||
bool "Allow to write device name by GATT clients"
|
||||
@@ -236,6 +241,14 @@ config BT_GATTC_MAX_CACHE_CHAR
|
||||
help
|
||||
Maximum GATTC cache characteristic count
|
||||
|
||||
config BT_GATTC_NOTIF_REG_MAX
|
||||
int "Max gattc notify(indication) register number"
|
||||
depends on BT_GATTC_ENABLE
|
||||
range 1 64
|
||||
default 5
|
||||
help
|
||||
Maximum GATTC notify(indication) register number
|
||||
|
||||
config BT_GATTC_CACHE_NVS_FLASH
|
||||
bool "Save gattc cache data to nvs flash"
|
||||
depends on BT_GATTC_ENABLE
|
||||
@@ -1027,7 +1040,7 @@ config BT_ACL_CONNECTIONS
|
||||
|
||||
config BT_MULTI_CONNECTION_ENBALE
|
||||
bool "Enable BLE multi-conections"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
depends on BT_BLE_ENABLED
|
||||
default y
|
||||
help
|
||||
Enable this option if there are multiple connections
|
||||
@@ -1048,7 +1061,7 @@ config BT_BLE_DYNAMIC_ENV_MEMORY
|
||||
|
||||
config BT_BLE_HOST_QUEUE_CONG_CHECK
|
||||
bool "BLE queue congestion check"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
depends on BT_BLE_ENABLED
|
||||
default n
|
||||
help
|
||||
When scanning and scan duplicate is not enabled, if there are a lot of adv packets around
|
||||
@@ -1060,6 +1073,14 @@ config BT_SMP_ENABLE
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
default BT_CLASSIC_ENABLED || BT_BLE_SMP_ENABLE
|
||||
|
||||
config BT_SMP_MAX_BONDS
|
||||
int "BT/BLE maximum bond device count"
|
||||
depends on BT_SMP_ENABLE
|
||||
range 1 32
|
||||
default 15
|
||||
help
|
||||
The number of security records for peer devices.
|
||||
|
||||
config BT_BLE_ACT_SCAN_REP_ADV_SCAN
|
||||
bool "Report adv data and scan response individually when BLE active scan"
|
||||
depends on BT_BLUEDROID_ENABLED && BT_BLE_ENABLED
|
||||
@@ -1073,7 +1094,7 @@ config BT_BLE_ACT_SCAN_REP_ADV_SCAN
|
||||
|
||||
config BT_BLE_ESTAB_LINK_CONN_TOUT
|
||||
int "Timeout of BLE connection establishment"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
depends on BT_BLE_ENABLED
|
||||
range 1 60
|
||||
default 30
|
||||
help
|
||||
@@ -1108,7 +1129,7 @@ config BT_BLE_RPA_SUPPORTED
|
||||
|
||||
config BT_BLE_RPA_TIMEOUT
|
||||
int "Timeout of resolvable private address"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
depends on BT_BLE_ENABLED
|
||||
range 1 3600
|
||||
default 900
|
||||
help
|
||||
@@ -1117,35 +1138,35 @@ config BT_BLE_RPA_TIMEOUT
|
||||
|
||||
config BT_BLE_50_FEATURES_SUPPORTED
|
||||
bool "Enable BLE 5.0 features"
|
||||
depends on (BT_BLUEDROID_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
|
||||
depends on (BT_BLE_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
|
||||
default y
|
||||
help
|
||||
This enables BLE 5.0 features, this option only support esp32c3/esp32s3 chip
|
||||
|
||||
config BT_BLE_42_FEATURES_SUPPORTED
|
||||
bool "Enable BLE 4.2 features"
|
||||
depends on (BT_BLUEDROID_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
|
||||
depends on (BT_BLE_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
|
||||
default n
|
||||
help
|
||||
This enables BLE 4.2 features.
|
||||
|
||||
config BT_BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER
|
||||
bool "Enable BLE periodic advertising sync transfer feature"
|
||||
depends on (BT_BLUEDROID_ENABLED && BT_BLE_50_FEATURES_SUPPORTED && SOC_ESP_NIMBLE_CONTROLLER)
|
||||
depends on (BT_BLE_50_FEATURES_SUPPORTED && SOC_ESP_NIMBLE_CONTROLLER)
|
||||
default n
|
||||
help
|
||||
This enables BLE periodic advertising sync transfer feature
|
||||
|
||||
config BT_BLE_FEAT_PERIODIC_ADV_ENH
|
||||
bool "Enable periodic adv enhancements(adi support)"
|
||||
depends on (BT_BLUEDROID_ENABLED && BT_BLE_50_FEATURES_SUPPORTED && SOC_ESP_NIMBLE_CONTROLLER)
|
||||
depends on (BT_BLE_50_FEATURES_SUPPORTED && SOC_ESP_NIMBLE_CONTROLLER)
|
||||
default n
|
||||
help
|
||||
Enable the periodic advertising enhancements
|
||||
|
||||
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
||||
bool "Enable BLE high duty advertising interval feature"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
depends on BT_BLE_ENABLED
|
||||
default n
|
||||
help
|
||||
This enable BLE high duty advertising interval feature
|
||||
|
||||
@@ -22,6 +22,11 @@ esp_err_t esp_ble_gap_register_callback(esp_gap_ble_cb_t callback)
|
||||
return (btc_profile_cb_set(BTC_PID_GAP_BLE, callback) == 0 ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_gap_ble_cb_t esp_ble_gap_get_callback(void)
|
||||
{
|
||||
return (esp_gap_ble_cb_t) btc_profile_cb_get(BTC_PID_GAP_BLE);
|
||||
}
|
||||
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data)
|
||||
{
|
||||
@@ -122,6 +127,19 @@ esp_err_t esp_ble_gap_stop_advertising(void)
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_clear_advertising(void)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_CLEAR_ADV;
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params)
|
||||
@@ -470,8 +488,7 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (raw_data == NULL
|
||||
|| (raw_data_len <= 0 || raw_data_len > ESP_BLE_SCAN_RSP_DATA_LEN_MAX)) {
|
||||
if ((raw_data_len != 0 && raw_data == NULL) || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
@@ -577,7 +594,11 @@ esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
|
||||
LOG_ERROR("ESP_BLE_APP_ENC_KEY_SIZE is deprecated, use ESP_GATT_PERM_ENCRYPT_KEY_SIZE in characteristic definition");
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (param_type == ESP_BLE_SM_MAX_KEY_SIZE || param_type == ESP_BLE_SM_MIN_KEY_SIZE) {
|
||||
if (((uint8_t *)value)[0] > 16 || ((uint8_t *)value)[0] < 7) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
|
||||
@@ -420,6 +420,10 @@ esp_err_t esp_bt_gap_set_qos(esp_bd_addr_t remote_bda, uint32_t t_poll)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (t_poll < ESP_BT_GAP_TPOLL_MIN || t_poll > ESP_BT_GAP_TPOLL_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BT;
|
||||
msg.act = BTC_GAP_BT_ACT_SET_QOS;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -29,6 +29,11 @@ esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_gattc_cb_t esp_ble_gattc_get_callback(void)
|
||||
{
|
||||
return (esp_gattc_cb_t) btc_profile_cb_get(BTC_PID_GATTC);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gattc_app_register(uint16_t app_id)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
@@ -29,6 +29,11 @@ esp_err_t esp_ble_gatts_register_callback(esp_gatts_cb_t callback)
|
||||
return (btc_profile_cb_set(BTC_PID_GATTS, callback) == 0 ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_gatts_cb_t esp_ble_gatts_get_callback(void)
|
||||
{
|
||||
return (esp_gatts_cb_t) btc_profile_cb_get(BTC_PID_GATTS);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gatts_app_register(uint16_t app_id)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
// Copyright 2019 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@@ -187,6 +179,9 @@ esp_err_t esp_bt_hf_volume_control(esp_bd_addr_t remote_addr, esp_hf_volume_cont
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (volume < 0 || volume > 15) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_HF;
|
||||
@@ -253,6 +248,9 @@ esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr,
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (signal < 0 || signal > 5) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_HF;
|
||||
@@ -280,6 +278,10 @@ esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr,
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (signal < 0 || signal > 5 || batt_lev < 0 || batt_lev > 5) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_HF;
|
||||
@@ -353,11 +355,14 @@ esp_err_t esp_bt_hf_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_c
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type)
|
||||
esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, int number_type, esp_hf_subscriber_service_type_t service_type)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (number == NULL || number_type < 128 || number_type > 175) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_HF;
|
||||
@@ -367,7 +372,8 @@ esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_h
|
||||
memset(&arg, 0, sizeof(btc_hf_args_t));
|
||||
memcpy(&(arg.cnum_rep), remote_addr, sizeof(esp_bd_addr_t));
|
||||
arg.cnum_rep.number = number; //deep_copy
|
||||
arg.cnum_rep.type = type;
|
||||
arg.cnum_rep.number_type = number_type;
|
||||
arg.cnum_rep.service_type = service_type;
|
||||
|
||||
/* Switch to BTC context */
|
||||
bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t),
|
||||
@@ -528,10 +534,30 @@ esp_err_t esp_bt_hf_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_h
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
esp_err_t esp_hf_ag_pkt_stat_nums_get(uint16_t sync_conn_handle)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_HF;
|
||||
msg.act = BTC_HF_REQUEST_PKT_STAT_EVT;
|
||||
|
||||
btc_hf_args_t arg;
|
||||
memset(&arg, 0, sizeof(btc_hf_args_t));
|
||||
arg.pkt_sync_hd.sync_conn_handle = sync_conn_handle;
|
||||
|
||||
/* Switch to BTC context */
|
||||
bt_status_t status = btc_transfer_context(&msg, &arg, sizeof(btc_hf_args_t), NULL, NULL);
|
||||
return (status == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
void esp_hf_outgoing_data_ready(void)
|
||||
{
|
||||
btc_hf_ci_sco_data();
|
||||
}
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */
|
||||
|
||||
#endif // BTC_HF_INCLUDED
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
// 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include <string.h>
|
||||
@@ -470,8 +462,27 @@ esp_err_t esp_hf_client_register_data_callback(esp_hf_client_incoming_data_cb_t
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
esp_err_t esp_hf_client_pkt_stat_nums_get(uint16_t sync_conn_handle)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_HF_CLIENT;
|
||||
msg.act = BTC_HF_CLIENT_REQUEST_PKT_STAT_EVT;
|
||||
|
||||
btc_hf_client_args_t arg;
|
||||
memset(&arg, 0, sizeof(btc_hf_client_args_t));
|
||||
arg.pkt_sync_hd.sync_conn_handle = sync_conn_handle;
|
||||
|
||||
/* Switch to BTC context */
|
||||
bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hf_client_args_t), NULL, NULL);
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
void esp_hf_client_outgoing_data_ready(void)
|
||||
{
|
||||
BTA_HfClientCiData();
|
||||
@@ -492,6 +503,6 @@ int32_t esp_hf_client_pcm_resample(void *src, uint32_t in_bytes, void *dst)
|
||||
return BTA_DmPcmResample(src, in_bytes, dst);
|
||||
}
|
||||
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */
|
||||
|
||||
#endif /* BTC_HF_CLIENT_INCLUDED */
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2016 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_A2DP_API_H__
|
||||
#define __ESP_A2DP_API_H__
|
||||
@@ -182,7 +174,7 @@ typedef int32_t (* esp_a2d_source_data_cb_t)(uint8_t *buf, int32_t len);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
@@ -199,7 +191,7 @@ esp_err_t esp_a2d_register_callback(esp_a2d_cb_t callback);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
@@ -216,7 +208,7 @@ esp_err_t esp_a2d_sink_register_data_callback(esp_a2d_sink_data_cb_t callback);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -231,7 +223,7 @@ esp_err_t esp_a2d_sink_init(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the deinitialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -247,7 +239,7 @@ esp_err_t esp_a2d_sink_deinit(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: connect request is sent to lower layer successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -263,7 +255,7 @@ esp_err_t esp_a2d_sink_connect(esp_bd_addr_t remote_bda);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -279,7 +271,7 @@ esp_err_t esp_a2d_sink_disconnect(esp_bd_addr_t remote_bda);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: control command is sent to lower layer successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -296,7 +288,7 @@ esp_err_t esp_a2d_media_ctrl(esp_a2d_media_ctrl_t ctrl);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent to lower layer successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -311,7 +303,7 @@ esp_err_t esp_a2d_source_init(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -328,7 +320,7 @@ esp_err_t esp_a2d_source_deinit(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
@@ -344,7 +336,7 @@ esp_err_t esp_a2d_source_register_data_callback(esp_a2d_source_data_cb_t callbac
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: connect request is sent to lower layer successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -359,7 +351,7 @@ esp_err_t esp_a2d_source_connect(esp_bd_addr_t remote_bda);
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -208,6 +208,8 @@ typedef enum {
|
||||
ESP_GAP_BLE_PERIODIC_ADV_SET_INFO_TRANS_COMPLETE_EVT, /*!< when periodic advertising set info transfer complete, the event comes */
|
||||
ESP_GAP_BLE_SET_PAST_PARAMS_COMPLETE_EVT, /*!< when set periodic advertising sync transfer params complete, the event comes */
|
||||
ESP_GAP_BLE_PERIODIC_ADV_SYNC_TRANS_RECV_EVT, /*!< when periodic advertising sync transfer received, the event comes */
|
||||
// BLE_INCLUDED
|
||||
ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT, /*!< When clear advertising complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
@@ -417,7 +419,10 @@ typedef enum {
|
||||
typedef enum {
|
||||
BLE_SCAN_DUPLICATE_DISABLE = 0x0, /*!< the Link Layer should generate advertising reports to the host for each packet received */
|
||||
BLE_SCAN_DUPLICATE_ENABLE = 0x1, /*!< the Link Layer should filter out duplicate advertising reports to the Host */
|
||||
BLE_SCAN_DUPLICATE_MAX = 0x2, /*!< 0x02 – 0xFF, Reserved for future use */
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BLE_SCAN_DUPLICATE_ENABLE_RESET, /*!< Duplicate filtering enabled, reset for each scan period, only supported in BLE 5.0. */
|
||||
#endif
|
||||
BLE_SCAN_DUPLICATE_MAX /*!< Reserved for future use. */
|
||||
} esp_ble_scan_duplicate_t;
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
/// Ble scan parameters
|
||||
@@ -675,6 +680,8 @@ typedef enum {
|
||||
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_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SOLIC_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1859 | .... |` */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_URI_ADV, /*!< BLE mesh URI adv, the format is ...| Len | 0x24 | data |... */
|
||||
} esp_ble_duplicate_exceptional_info_type_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -682,7 +689,9 @@ typedef enum {
|
||||
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_MESH_PROXY_SRV_ADV_LIST = BLE_BIT(4), /*!< duplicate scan exceptional mesh adv with proxy service uuid */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROXY_SOLIC_ADV_LIST = BLE_BIT(5), /*!< duplicate scan exceptional mesh adv with proxy solicitation PDU uuid */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_URI_ADV_LIST = BLE_BIT(6), /*!< duplicate scan exceptional URI list */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = 0xFFFF, /*!< duplicate scan exceptional all list */
|
||||
} esp_duplicate_scan_exceptional_list_type_t;
|
||||
|
||||
@@ -1022,6 +1031,12 @@ typedef union {
|
||||
struct ble_adv_stop_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate adv stop operation success status */
|
||||
} adv_stop_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_adv_clear_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate adv clear operation success status */
|
||||
} adv_clear_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT */
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT
|
||||
@@ -1399,6 +1414,15 @@ typedef void (* esp_gap_ble_cb_t)(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_p
|
||||
*/
|
||||
esp_err_t esp_ble_gap_register_callback(esp_gap_ble_cb_t callback);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get the current gap callback
|
||||
*
|
||||
* @return
|
||||
* - esp_gap_ble_cb_t : callback function
|
||||
*
|
||||
*/
|
||||
esp_gap_ble_cb_t esp_ble_gap_get_callback(void);
|
||||
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
/**
|
||||
* @brief This function is called to override the BTA default ADV parameters.
|
||||
@@ -2198,8 +2222,9 @@ esp_err_t esp_ble_gap_set_ext_scan_params(const esp_ble_ext_scan_params_t *param
|
||||
/**
|
||||
* @brief This function is used to enable scanning.
|
||||
*
|
||||
* @param[in] duration : Scan duration
|
||||
* @param[in] period : Time interval from when the Controller started its last Scan Duration until it begins the subsequent Scan Duration.
|
||||
* @param[in] duration Scan duration time, where Time = N * 10 ms. Range: 0x0001 to 0xFFFF.
|
||||
* @param[in] period Time interval from when the Controller started its last Scan Duration until it begins the subsequent Scan Duration.
|
||||
* Time = N * 1.28 sec. Range: 0x0001 to 0xFFFF.
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
@@ -2363,6 +2388,16 @@ esp_err_t esp_ble_gap_set_periodic_adv_sync_trans_params(esp_bd_addr_t addr,
|
||||
const esp_ble_gap_past_params_t *params);
|
||||
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
/**
|
||||
* @brief This function is used to clear legacy advertising
|
||||
*
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_clear_advertising(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -238,6 +238,11 @@ typedef enum {
|
||||
#define ESP_BT_GAP_MIN_INQ_LEN (0x01) /*!< Minimum inquiry duration, unit is 1.28s */
|
||||
#define ESP_BT_GAP_MAX_INQ_LEN (0x30) /*!< Maximum inquiry duration, unit is 1.28s */
|
||||
|
||||
/** Minimum, Default and Maximum poll interval **/
|
||||
#define ESP_BT_GAP_TPOLL_MIN (0x0006) /*!< Minimum poll interval, unit is 625 microseconds */
|
||||
#define ESP_BT_GAP_TPOLL_DFT (0x0028) /*!< Default poll interval, unit is 625 microseconds */
|
||||
#define ESP_BT_GAP_TPOLL_MAX (0x1000) /*!< Maximum poll interval, unit is 625 microseconds */
|
||||
|
||||
/// GAP state callback parameters
|
||||
typedef union {
|
||||
/**
|
||||
|
||||
@@ -282,6 +282,15 @@ typedef void (* esp_gattc_cb_t)(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get the current application callbacks
|
||||
* with BTA GATTC module.
|
||||
*
|
||||
* @return
|
||||
* - esp_gattC_cb_t : current callback
|
||||
*
|
||||
*/
|
||||
esp_gattc_cb_t esp_ble_gattc_get_callback(void);
|
||||
|
||||
/**
|
||||
* @brief This function is called to register application callbacks
|
||||
|
||||
@@ -304,6 +304,16 @@ typedef void (* esp_gatts_cb_t)(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_
|
||||
*/
|
||||
esp_err_t esp_ble_gatts_register_callback(esp_gatts_cb_t callback);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get the current application callbacks
|
||||
* with BTA GATTS module.
|
||||
*
|
||||
* @return
|
||||
* - esp_gatts_cb_t : current callback
|
||||
*
|
||||
*/
|
||||
esp_gatts_cb_t esp_ble_gatts_get_callback(void);
|
||||
|
||||
/**
|
||||
* @brief This function is called to register application identifier
|
||||
*
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
// Copyright 2019 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_HF_AG_API_H__
|
||||
#define __ESP_HF_AG_API_H__
|
||||
@@ -70,13 +62,22 @@ typedef enum
|
||||
ESP_HF_DIAL_EVT, /*!< Origin an outgoing call with specific number or the dial the last number */
|
||||
ESP_HF_WBS_RESPONSE_EVT, /*!< Codec Status */
|
||||
ESP_HF_BCS_RESPONSE_EVT, /*!< Final Codec Choice */
|
||||
ESP_HF_PKT_STAT_NUMS_GET_EVT, /*!< Request number of packet different status */
|
||||
} esp_hf_cb_event_t;
|
||||
|
||||
/// Dial type of ESP_HF_DIAL_EVT
|
||||
typedef enum
|
||||
{
|
||||
ESP_HF_DIAL_NUM = 0, /*!< Dial with a phone number */
|
||||
ESP_HF_DIAL_VOIP, /*!< Dial with VoIP */
|
||||
ESP_HF_DIAL_MEM, /*!< Dial with a memory position */
|
||||
} esp_hf_dial_type_t;
|
||||
|
||||
/// HFP AG callback parameters
|
||||
typedef union
|
||||
{
|
||||
/**
|
||||
* @brief ESP_HS_CONNECTION_STATE_EVT
|
||||
* @brief ESP_HF_CONNECTION_STATE_EVT
|
||||
*/
|
||||
struct hf_conn_stat_param {
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
@@ -91,6 +92,7 @@ typedef union
|
||||
struct hf_audio_stat_param {
|
||||
esp_bd_addr_t remote_addr; /*!< Remote bluetooth device address */
|
||||
esp_hf_audio_state_t state; /*!< Audio connection state */
|
||||
uint16_t sync_conn_handle; /*!< (e)SCO connection handle */
|
||||
} audio_stat; /*!< AG callback param of ESP_HF_AUDIO_STATE_EVT */
|
||||
|
||||
/**
|
||||
@@ -105,6 +107,7 @@ typedef union
|
||||
* @brief ESP_HF_VOLUME_CONTROL_EVT
|
||||
*/
|
||||
struct hf_volume_control_param {
|
||||
esp_bd_addr_t remote_addr; /*!< Remote bluetooth device address */
|
||||
esp_hf_volume_type_t type; /*!< Volume control target, speaker or microphone */
|
||||
int volume; /*!< Gain, ranges from 0 to 15 */
|
||||
} volume_control; /*!< AG callback param of ESP_HF_VOLUME_CONTROL_EVT */
|
||||
@@ -113,48 +116,89 @@ typedef union
|
||||
* @brief ESP_HF_UNAT_RESPOSNE_EVT
|
||||
*/
|
||||
struct hf_unat_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< Remote bluetooth device address */
|
||||
char *unat; /*!< Unknown AT command string */
|
||||
}unat_rep; /*!< AG callback param of ESP_HF_UNAT_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CIND_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_cind_param {
|
||||
esp_hf_call_status_t call_status; /*!< call status indicator */
|
||||
esp_hf_call_setup_status_t call_setup_status; /*!< call setup status indicator */
|
||||
esp_hf_network_state_t svc; /*!< bluetooth proprietary call hold status indicator */
|
||||
int signal_strength; /*!< bluetooth proprietary call hold status indicator */
|
||||
esp_hf_roaming_status_t roam; /*!< bluetooth proprietary call hold status indicator */
|
||||
int battery_level; /*!< battery charge value, ranges from 0 to 5 */
|
||||
esp_hf_call_held_status_t call_held_status; /*!< bluetooth proprietary call hold status indicator */
|
||||
} cind; /*!< AG callback param of ESP_HF_CIND_RESPONSE_EVT */
|
||||
} unat_rep; /*!< AG callback param of ESP_HF_UNAT_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_DIAL_EVT
|
||||
*/
|
||||
struct hf_out_call_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
esp_hf_dial_type_t type; /*!< dial type */
|
||||
char *num_or_loc; /*!< location in phone memory */
|
||||
} out_call; /*!< AG callback param of ESP_HF_DIAL_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_VTS_RESPOSNE_EVT
|
||||
* @brief ESP_HF_IND_UPDATE_EVT
|
||||
*/
|
||||
struct hf_ind_upd_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
} ind_upd; /*!< AG callback param of ESP_HF_IND_UPDATE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CIND_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_cind_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
} cind_rep; /*!< AG callback param of ESP_HF_CIND_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_COPS_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_cops_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
} cops_rep; /*!< AG callback param of ESP_HF_COPS_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLCC_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_clcc_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
} clcc_rep; /*!< AG callback param of ESP_HF_CLCC_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CNUM_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_cnum_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
} cnum_rep; /*!< AG callback param of ESP_HF_CNUM_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_VTS_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_vts_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< Remote bluetooth device address */
|
||||
char *code; /*!< MTF code from HF Client */
|
||||
}vts_rep; /*!< AG callback param of ESP_HF_VTS_RESPONSE_EVT */
|
||||
} vts_rep; /*!< AG callback param of ESP_HF_VTS_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_NREC_RESPOSNE_EVT
|
||||
*/
|
||||
struct hf_nrec_param {
|
||||
esp_hf_nrec_t state; /*!< NREC enabled or disabled */
|
||||
esp_bd_addr_t remote_addr; /*!< Remote bluetooth device address */
|
||||
esp_hf_nrec_t state; /*!< NREC enabled or disabled */
|
||||
} nrec; /*!< AG callback param of ESP_HF_NREC_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_ATA_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_ata_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
} ata_rep; /*!< AG callback param of ESP_HF_ATA_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CHUP_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_chup_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
} chup_rep; /*!< AG callback param of ESP_HF_CHUP_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_WBS_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_wbs_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< Remote bluetooth device address */
|
||||
esp_hf_wbs_config_t codec; /*!< codec mode CVSD or mSBC */
|
||||
} wbs_rep; /*!< AG callback param of ESP_HF_WBS_RESPONSE_EVT */
|
||||
|
||||
@@ -162,9 +206,23 @@ typedef union
|
||||
* @brief ESP_HF_BCS_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_bcs_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< Remote bluetooth device address */
|
||||
esp_hf_wbs_config_t mode; /*!< codec mode CVSD or mSBC */
|
||||
} bcs_rep; /*!< AG callback param of ESP_HF_BCS_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_PKT_STAT_NUMS_GET_EVT
|
||||
*/
|
||||
struct ag_pkt_status_nums {
|
||||
uint32_t rx_total; /*!< the total number of packets received */
|
||||
uint32_t rx_correct; /*!< the total number of packets data correctly received */
|
||||
uint32_t rx_err; /*!< the total number of packets data with possible invalid */
|
||||
uint32_t rx_none; /*!< the total number of packets data no received */
|
||||
uint32_t rx_lost; /*!< the total number of packets data partially lost */
|
||||
uint32_t tx_total; /*!< the total number of packets send */
|
||||
uint32_t tx_discarded; /*!< the total number of packets send lost */
|
||||
} pkt_nums; /*!< AG callback param of ESP_HF_PKT_STAT_NUMS_GET_EVT */
|
||||
|
||||
} esp_hf_cb_param_t; /*!< HFP AG callback param compound*/
|
||||
|
||||
/**
|
||||
@@ -216,7 +274,7 @@ typedef void (* esp_hf_cb_t) (esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
@@ -231,7 +289,7 @@ esp_err_t esp_bt_hf_register_callback(esp_hf_cb_t callback);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -246,7 +304,7 @@ esp_err_t esp_bt_hf_init(esp_bd_addr_t remote_addr);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -261,7 +319,7 @@ esp_err_t esp_bt_hf_deinit(esp_bd_addr_t remote_addr);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: connect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -276,7 +334,7 @@ esp_err_t esp_bt_hf_connect(esp_bd_addr_t remote_bda);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -290,8 +348,8 @@ esp_err_t esp_bt_hf_disconnect(esp_bd_addr_t remote_bda);
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: audio connect request is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -305,8 +363,8 @@ esp_err_t esp_bt_hf_connect_audio(esp_bd_addr_t remote_bda);
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: audio disconnect request is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -322,8 +380,8 @@ esp_err_t esp_bt_hf_disconnect_audio(esp_bd_addr_t remote_bda);
|
||||
* @param[in] value: 0 - voice recognition disabled, 1- voice recognition enabled
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: response of volume recognition is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -341,8 +399,9 @@ esp_err_t esp_bt_hf_vra(esp_bd_addr_t remote_bda, esp_hf_vr_state_t value);
|
||||
* @param[in] volume: gain of the speaker of microphone, ranges 0 to 15
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: volume synchronization control is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_ARG: if arguments are invalid
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -358,8 +417,8 @@ esp_err_t esp_bt_hf_volume_control(esp_bd_addr_t remote_bda, esp_hf_volume_contr
|
||||
* @param[in] unat: User AT command response to HF Client.
|
||||
* It will response "ERROR" by default if unat is NULL.
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: response of unknown AT command is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -374,8 +433,8 @@ esp_err_t esp_hf_unat_response(esp_bd_addr_t remote_addr, char *unat);
|
||||
* @param[in] response_code: AT command response code
|
||||
* @param[in] error_code: CME error code
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: extend error code is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -392,8 +451,9 @@ esp_err_t esp_bt_hf_cmee_response(esp_bd_addr_t remote_bda, esp_hf_at_response_c
|
||||
* @param[in] ntk_state: network service state
|
||||
* @param[in] signal: signal strength from 0 to 5
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: device status notification is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_ARG: if arguments are invalid
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -415,8 +475,9 @@ esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr, esp_hf_cal
|
||||
* @param[in] batt_lev: batery level from 0 to 5
|
||||
* @param[in] call_held_status: call held status
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: response to device individual indicators is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_ARG: if the arguments are invalid
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -434,8 +495,8 @@ esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr,
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] name: current operator name
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: reponse for AT+COPS command is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -447,7 +508,7 @@ esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] index: the index of current call
|
||||
* @param[in] index: the index of current call, starting with 1, finishing response with 0 (send OK)
|
||||
* @param[in] dir: call direction (incoming/outgoing)
|
||||
* @param[in] current_call_state: current call state
|
||||
* @param[in] mode: current call mode (voice/data/fax)
|
||||
@@ -455,8 +516,8 @@ esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name);
|
||||
* @param[in] number: current call number
|
||||
* @param[in] type: international type or unknow
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: response to AT+CLCC command is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -471,14 +532,18 @@ esp_err_t esp_bt_hf_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_c
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] number: registration number
|
||||
* @param[in] type: service type (unknown/voice/fax)
|
||||
* @param[in] number_type: value of number type from
|
||||
* 128-143: national or international, may contain prefix and/or escape digits
|
||||
* 144-159: international, includes country code prefix, add "+" if needed
|
||||
* 160-175: national, but no prefix nor escape digits
|
||||
* @param[in] service_type: service type (unknown/voice/fax)
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: response for AT+CNUM command is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_hf_subscriber_service_type_t type);
|
||||
esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, int number_type, esp_hf_subscriber_service_type_t service_type);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -488,8 +553,9 @@ esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_h
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] state: in-band ring tone state
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: information of in-band ring tone is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_ARG: if arguments are invalid
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -508,8 +574,8 @@ esp_err_t esp_bt_hf_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t
|
||||
* @param[in] number: number of the incoming call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: answer incoming call is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -530,8 +596,8 @@ esp_err_t esp_bt_hf_answer_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
* @param[in] number: number of the incoming call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: reject incoming call is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -543,6 +609,9 @@ esp_err_t esp_bt_hf_reject_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
*
|
||||
* @brief Initiate a call from AG.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with HFP client.
|
||||
* If the AG is driven by the HF to call esp_hf_ag_out_call, it needs to response an OK or ERROR
|
||||
* to HF. But if the AG is actively calling esp_hf_ag_out_call, it does not need to take a response
|
||||
* to HF.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] num_active: the number of active call
|
||||
@@ -552,8 +621,8 @@ esp_err_t esp_bt_hf_reject_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
* @param[in] number: number of the outgoing call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: a call initiation is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -574,8 +643,8 @@ esp_err_t esp_bt_hf_out_call(esp_bd_addr_t remote_addr, int num_active, int num_
|
||||
* @param[in] number: number of the call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: end an ongoing call is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -592,12 +661,28 @@ esp_err_t esp_bt_hf_end_call(esp_bd_addr_t remote_addr, int num_active, int num_
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_hf_register_data_callback(esp_hf_incoming_data_cb_t recv, esp_hf_outgoing_data_cb_t send);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get the number of packets received and sent
|
||||
*
|
||||
* This function is only used in the case that Voice Over HCI is enabled and the audio state is connected.
|
||||
* When the operation is completed, the callback function will be called with ESP_HF_PKT_STAT_NUMS_GET_EVT.
|
||||
*
|
||||
* @param[in] sync_conn_handle: the (e)SCO connection handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the request is sent successfully
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_ag_pkt_stat_nums_get(uint16_t sync_conn_handle);
|
||||
|
||||
/**
|
||||
* @brief Trigger the lower-layer to fetch and send audio data.
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
// 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.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_HF_CLIENT_API_H__
|
||||
#define __ESP_HF_CLIENT_API_H__
|
||||
@@ -96,6 +88,7 @@ typedef enum {
|
||||
ESP_HF_CLIENT_BSIR_EVT, /*!< setting of in-band ring tone */
|
||||
ESP_HF_CLIENT_BINP_EVT, /*!< requested number of last voice tag from AG */
|
||||
ESP_HF_CLIENT_RING_IND_EVT, /*!< ring indication event */
|
||||
ESP_HF_CLIENT_PKT_STAT_NUMS_GET_EVT, /*!< requested number of packet different status */
|
||||
} esp_hf_client_cb_event_t;
|
||||
|
||||
/// HFP client callback parameters
|
||||
@@ -116,6 +109,7 @@ typedef union {
|
||||
struct hf_client_audio_stat_param {
|
||||
esp_hf_client_audio_state_t state; /*!< audio connection state */
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
uint16_t sync_conn_handle; /*!< (e)SCO connection handle */
|
||||
} audio_stat; /*!< HF callback param of ESP_HF_CLIENT_AUDIO_STATE_EVT */
|
||||
|
||||
/**
|
||||
@@ -251,6 +245,19 @@ typedef union {
|
||||
const char *number; /*!< phone number corresponding to the last voice tag in the HF */
|
||||
} binp; /*!< HF callback param of ESP_HF_CLIENT_BINP_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_PKT_STAT_NUMS_GET_EVT
|
||||
*/
|
||||
struct hf_client_pkt_status_nums {
|
||||
uint32_t rx_total; /*!< the total number of packets received */
|
||||
uint32_t rx_correct; /*!< the total number of packets data correctly received */
|
||||
uint32_t rx_err; /*!< the total number of packets data with possible invalid */
|
||||
uint32_t rx_none; /*!< the total number of packets data no received */
|
||||
uint32_t rx_lost; /*!< the total number of packets data partially lost */
|
||||
uint32_t tx_total; /*!< the total number of packets send */
|
||||
uint32_t tx_discarded; /*!< the total number of packets send lost */
|
||||
} pkt_nums; /*!< HF callback param of ESP_HF_CLIENT_PKT_STAT_NUMS_GET_EVT */
|
||||
|
||||
} esp_hf_client_cb_param_t; /*!< HFP client callback parameters */
|
||||
|
||||
/**
|
||||
@@ -298,7 +305,7 @@ typedef void (* esp_hf_client_cb_t)(esp_hf_client_cb_event_t event, esp_hf_clien
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
@@ -311,7 +318,7 @@ esp_err_t esp_hf_client_register_callback(esp_hf_client_cb_t callback);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -324,7 +331,7 @@ esp_err_t esp_hf_client_init(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -339,7 +346,7 @@ esp_err_t esp_hf_client_deinit(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: connect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -354,7 +361,7 @@ esp_err_t esp_hf_client_connect(esp_bd_addr_t remote_bda);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -367,8 +374,8 @@ esp_err_t esp_hf_client_disconnect(esp_bd_addr_t remote_bda);
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: connect audio request is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -381,8 +388,8 @@ esp_err_t esp_hf_client_connect_audio(esp_bd_addr_t remote_bda);
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: disconnect audio request is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -394,8 +401,8 @@ esp_err_t esp_hf_client_disconnect_audio(esp_bd_addr_t remote_bda);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: starting voice recognition is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -407,8 +414,8 @@ esp_err_t esp_hf_client_start_voice_recognition(void);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: stoping voice recognition is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -423,8 +430,8 @@ esp_err_t esp_hf_client_stop_voice_recognition(void);
|
||||
* @param[in] volume: gain of the speaker of microphone, ranges 0 to 15
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: volume update is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -438,8 +445,8 @@ esp_err_t esp_hf_client_volume_update(esp_hf_volume_control_target_t type, int v
|
||||
* @param[in] number: number string of the call. If NULL, the last number is called(aka re-dial)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: a call placing is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -453,8 +460,8 @@ esp_err_t esp_hf_client_dial(const char *number);
|
||||
* @param[in] location: location of the number in the memory
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: a memory call placing is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -471,8 +478,8 @@ esp_err_t esp_hf_client_dial_memory(int location);
|
||||
* ESP_HF_CHLD_TYPE_REL_X or ESP_HF_CHLD_TYPE_PRIV_X
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: command AT+CHLD is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -486,8 +493,8 @@ esp_err_t esp_hf_client_send_chld_cmd(esp_hf_chld_type_t chld, int idx);
|
||||
* @param[in] btrh: response and hold action to send
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: command AT+BTRH is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -499,8 +506,8 @@ esp_err_t esp_hf_client_send_btrh_cmd(esp_hf_btrh_cmd_t btrh);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: a call answering is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -508,12 +515,12 @@ esp_err_t esp_hf_client_answer_call(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Reject an incoming call(send AT+CHUP command).
|
||||
* @brief Reject an incoming call or terminate an ongoing call(send AT+CHUP command).
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: the call rejecting is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -525,8 +532,8 @@ esp_err_t esp_hf_client_reject_call(void);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: query of current calls is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -538,8 +545,8 @@ esp_err_t esp_hf_client_query_current_calls(void);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: query of current operator name is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -551,8 +558,8 @@ esp_err_t esp_hf_client_query_current_operator_name(void);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: the retrieving of subscriber information is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -566,8 +573,8 @@ esp_err_t esp_hf_client_retrieve_subscriber_info(void);
|
||||
* @param[in] code: dtmf code, single ascii character in the set 0-9, #, *, A-D
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: the DTMF codes are sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -579,8 +586,8 @@ esp_err_t esp_hf_client_send_dtmf(char code);
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_OK: the phone number request corresponding to last voice tag recorded is sent to lower layer
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -593,7 +600,7 @@ esp_err_t esp_hf_client_request_last_voice_tag_number(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: NREC=0 request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
@@ -610,13 +617,29 @@ esp_err_t esp_hf_client_send_nrec(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_register_data_callback(esp_hf_client_incoming_data_cb_t recv,
|
||||
esp_hf_client_outgoing_data_cb_t send);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get the number of packets received and sent
|
||||
* This function is only used in the case that Voice Over HCI is enabled and the audio state is connected.
|
||||
* When the operation is completed, the callback function will be called with ESP_HF_CLIENT_PKT_STAT_NUMS_GET_EVT.
|
||||
*
|
||||
* @param[in] sync_conn_handle: the (e)SCO connection handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the request is sent successfully
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_pkt_stat_nums_get(uint16_t sync_conn_handle);
|
||||
|
||||
/**
|
||||
* @brief Trigger the lower-layer to fetch and send audio data.
|
||||
* This function is only only used in the case that Voice Over HCI is enabled. After this
|
||||
|
||||
@@ -159,7 +159,7 @@ typedef enum {
|
||||
/// +CNUM service type of the phone number
|
||||
typedef enum {
|
||||
ESP_HF_SUBSCRIBER_SERVICE_TYPE_UNKNOWN = 0, /*!< unknown */
|
||||
ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE, /*!< voice service */
|
||||
ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE = 4, /*!< voice service */
|
||||
ESP_HF_SUBSCRIBER_SERVICE_TYPE_FAX, /*!< fax service */
|
||||
} esp_hf_subscriber_service_type_t;
|
||||
|
||||
|
||||
@@ -577,6 +577,14 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
|
||||
bta_dm_disable_search_and_disc();
|
||||
bta_dm_cb.disabling = TRUE;
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
/* reset scan activity status*/
|
||||
btm_cb.ble_ctr_cb.scan_activity = 0;
|
||||
|
||||
/* reset advertising activity status*/
|
||||
btm_cb.ble_ctr_cb.inq_var.state = 0;
|
||||
#endif
|
||||
|
||||
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
|
||||
BTM_BleClearBgConnDev();
|
||||
#endif
|
||||
@@ -5633,6 +5641,16 @@ void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data)
|
||||
p_data->ble_multi_adv_disable.inst_id, p_ref, BTA_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
if (BTM_BleClearAdv(p_data->ble_clear_adv.p_clear_adv_cback) == FALSE) {
|
||||
if (p_data->ble_clear_adv.p_clear_adv_cback) {
|
||||
(*p_data->ble_clear_adv.p_clear_adv_cback)(BTA_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
|
||||
@@ -1744,6 +1744,29 @@ extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleClearAdv
|
||||
**
|
||||
** Description This function is called to clear Advertising
|
||||
**
|
||||
** Parameters p_adv_data_cback : clear adv complete callback.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleClearAdv (tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
|
||||
{
|
||||
tBTA_DM_API_CLEAR_ADV *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_CLEAR_ADV *)
|
||||
osi_malloc(sizeof(tBTA_DM_API_CLEAR_ADV))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_BLE_CLEAR_ADV_EVT;
|
||||
p_msg->p_clear_adv_cback = p_clear_adv_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
||||
@@ -361,7 +361,7 @@ void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap,
|
||||
*p_resp_key = bte_appl_cfg.ble_resp_key;
|
||||
}
|
||||
|
||||
if (bte_appl_cfg.ble_max_key_size > 7 && bte_appl_cfg.ble_max_key_size <= 16) {
|
||||
if (bte_appl_cfg.ble_max_key_size >= 7 && bte_appl_cfg.ble_max_key_size <= 16) {
|
||||
*p_max_key_size = bte_appl_cfg.ble_max_key_size;
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
@@ -389,7 +389,7 @@ void bta_dm_co_ble_set_init_key_req(UINT8 init_key)
|
||||
{
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
init_key &= 0x0f; // 4~7bit reservd, only used the 0~3bit
|
||||
bte_appl_cfg.ble_init_key &= init_key;
|
||||
bte_appl_cfg.ble_init_key = init_key;
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key)
|
||||
{
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
rsp_key &= 0x0f; // 4~7bit reservd, only used the 0~3bit
|
||||
bte_appl_cfg.ble_resp_key &= rsp_key;
|
||||
bte_appl_cfg.ble_resp_key = rsp_key;
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
|
||||
@@ -209,6 +209,9 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_ble_gap_periodic_adv_set_info_trans, /* BTA_DM_API_PERIODIC_ADV_SET_INFO_TRANS_EVT */
|
||||
bta_dm_ble_gap_set_periodic_adv_sync_trans_params, /* BTA_DM_API_SET_PERIODIC_ADV_SYNC_TRANS_PARAMS_EVT */
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
#if BLE_INCLUDED == TRUE
|
||||
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
void bta_dm_set_qos(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
FLOW_SPEC p_flow = {
|
||||
.qos_flags = 0, /* TBD */
|
||||
.service_type = GUARANTEED, /* see below */
|
||||
.token_rate = 0, /* bytes/second */
|
||||
.token_bucket_size = 0, /* bytes */
|
||||
.peak_bandwidth = 0, /* bytes/second */
|
||||
.latency = 625 * p_data->qos_set.t_poll, /* microseconds */
|
||||
.delay_variation = 0xFFFFFFFF /* microseconds */
|
||||
.qos_flags = 0, /* TBD */
|
||||
.service_type = NO_TRAFFIC, /* service_type */
|
||||
.token_rate = 0, /* bytes/second */
|
||||
.token_bucket_size = 0, /* bytes */
|
||||
.peak_bandwidth = 0, /* bytes/second */
|
||||
.latency = 625 * p_data->qos_set.t_poll, /* microseconds */
|
||||
.delay_variation = 0xFFFFFFFF /* microseconds */
|
||||
};
|
||||
|
||||
tBTM_STATUS status = BTM_SetQoS (p_data->qos_set.bd_addr, &p_flow, p_data->qos_set.p_cb);
|
||||
|
||||
@@ -206,6 +206,9 @@ enum {
|
||||
BTA_DM_API_PERIODIC_ADV_SET_INFO_TRANS_EVT,
|
||||
BTA_DM_API_SET_PERIODIC_ADV_SYNC_TRANS_PARAMS_EVT,
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
#if BLE_INCLUDED == TRUE
|
||||
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
||||
#endif
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
|
||||
@@ -842,6 +845,11 @@ typedef struct {
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_DM_API_BLE_DISCONNECT;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback;
|
||||
} tBTA_DM_API_CLEAR_ADV;
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
/* data type for BTA_DM_API_REMOVE_ACL_EVT */
|
||||
@@ -1212,6 +1220,7 @@ typedef union {
|
||||
tBTA_DM_API_PERIODIC_ADV_SET_INFO_TRANS ble_periodic_adv_set_info_trans;
|
||||
tBTA_DM_API_SET_PAST_PARAMS ble_set_past_params;
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
tBTA_DM_API_CLEAR_ADV ble_clear_adv;
|
||||
#endif
|
||||
|
||||
tBTA_DM_API_REMOVE_ACL remove_acl;
|
||||
@@ -1643,6 +1652,8 @@ extern void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data);
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_set_prefer_default_phy(tBTA_DM_MSG *p_data);
|
||||
|
||||
@@ -122,8 +122,11 @@ void bta_gattc_reset_discover_st(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_STATUS statu
|
||||
static void bta_gattc_enable(tBTA_GATTC_CB *p_cb)
|
||||
{
|
||||
APPL_TRACE_DEBUG("bta_gattc_enable");
|
||||
|
||||
if (p_cb->state == BTA_GATTC_STATE_DISABLED) {
|
||||
/* This is a workaround because the task priority of btc (BTA_GATTC_CLOSE_EVT
|
||||
in that task) is lower than the priority of the btu task.
|
||||
Consequently, the p_cb->state fails to be restored to BTA_GATTC_STATE_DISABLED
|
||||
and remains in the BTA_GATTC_STATE_DISABLING state. */
|
||||
if (p_cb->state == BTA_GATTC_STATE_DISABLED || p_cb->state == BTA_GATTC_STATE_DISABLING) {
|
||||
/* initialize control block */
|
||||
memset(&bta_gattc_cb, 0, sizeof(tBTA_GATTC_CB));
|
||||
bta_gattc_cb.auto_disc = true;
|
||||
@@ -200,7 +203,11 @@ void bta_gattc_register(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data)
|
||||
cb_data.reg_oper.status = BTA_GATT_NO_RESOURCES;
|
||||
|
||||
/* check if GATTC module is already enabled . Else enable */
|
||||
if (p_cb->state == BTA_GATTC_STATE_DISABLED) {
|
||||
/* This is a workaround because the task priority of btc (BTA_GATTC_CLOSE_EVT
|
||||
in that task) is lower than the priority of the btu task.
|
||||
Consequently, the p_cb->state fails to be restored to BTA_GATTC_STATE_DISABLED
|
||||
and remains in the BTA_GATTC_STATE_DISABLING state. */
|
||||
if (p_cb->state == BTA_GATTC_STATE_DISABLED || p_cb->state == BTA_GATTC_STATE_DISABLING) {
|
||||
bta_gattc_enable (p_cb);
|
||||
}
|
||||
/* todo need to check duplicate uuid */
|
||||
|
||||
@@ -932,7 +932,7 @@ tBTA_GATT_STATUS BTA_GATTC_RegisterForNotifications (tBTA_GATTC_IF client_if,
|
||||
}
|
||||
if (i == BTA_GATTC_NOTIF_REG_MAX) {
|
||||
status = BTA_GATT_NO_RESOURCES;
|
||||
APPL_TRACE_ERROR("Max Notification Reached, registration failed.");
|
||||
APPL_TRACE_ERROR("Max Notification Reached, registration failed,see CONFIG_BT_GATTC_NOTIF_REG_MAX in menuconfig");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -510,6 +510,10 @@ UINT8 bta_gattc_co_find_hash_in_cache(hash_key_t hash_key)
|
||||
|
||||
UINT8 bta_gattc_co_get_addr_num(void)
|
||||
{
|
||||
if (cache_env == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cache_env->num_addr;
|
||||
}
|
||||
|
||||
|
||||
@@ -534,4 +534,17 @@ void bta_gattc_deinit(void)
|
||||
FREE_AND_RESET(bta_gattc_cb_ptr);
|
||||
#endif /* #if BTA_DYNAMIC_MEMORY */
|
||||
}
|
||||
|
||||
uint8_t bta_gattc_cl_rcb_active_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
|
||||
for (uint8_t i = 0; i < BTA_GATTC_CL_MAX; i ++) {
|
||||
if (bta_gattc_cb.cl_rcb[i].in_use) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif /* GATTC_INCLUDED == TRUE && BLE_INCLUDED == TRUE */
|
||||
|
||||
@@ -679,7 +679,7 @@ BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda
|
||||
#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__,
|
||||
APPL_TRACE_WARNING("%s unable to find the bg connection mask for: %s", __func__,
|
||||
bdaddr_to_string((bt_bdaddr_t *)remote_bda_ptr, bdstr, sizeof(bdstr)));
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
@@ -495,11 +495,11 @@ void bta_gatts_add_char_descr(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_gatts_add_char_descr
|
||||
** Function bta_gatts_set_attr_value
|
||||
**
|
||||
** Description action function to add characteristic descriptor.
|
||||
** Description This function is used to set the attribute value.
|
||||
**
|
||||
** Returns none.
|
||||
** Returns None.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_gatts_set_attr_value(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg)
|
||||
@@ -526,8 +526,23 @@ void bta_gatts_set_attr_value(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_gatts_get_attr_value
|
||||
**
|
||||
** Description This function retrieves the attribute value associated with
|
||||
** the given attribute handle.
|
||||
**
|
||||
** Returns tGATT_STATUS - GATT status indicating success or failure in
|
||||
** retrieving the attribute value.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
tGATT_STATUS bta_gatts_get_attr_value(UINT16 attr_handle, UINT16 *length, UINT8 **value)
|
||||
{
|
||||
if (GATTS_GetAttributeValueInternal(attr_handle, length, value) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return GATTS_GetAttributeValue(attr_handle, length, value);
|
||||
}
|
||||
|
||||
@@ -152,4 +152,17 @@ void bta_gatts_deinit(void)
|
||||
#endif /* #if BTA_DYNAMIC_MEMORY */
|
||||
}
|
||||
|
||||
uint8_t bta_gatts_srvc_active_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
|
||||
for (uint8_t i = 0; i < BTA_GATTS_MAX_SRVC_NUM; i ++) {
|
||||
if (bta_gatts_cb.srvc_cb[i].in_use) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#endif /* GATTS_INCLUDED */
|
||||
|
||||
@@ -319,10 +319,6 @@ typedef struct {
|
||||
bool update_incl_srvc;
|
||||
} tBTA_GATTC_SERV;
|
||||
|
||||
#ifndef BTA_GATTC_NOTIF_REG_MAX
|
||||
#define BTA_GATTC_NOTIF_REG_MAX BTA_GATTC_CONN_MAX
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BD_ADDR remote_bda;
|
||||
|
||||
@@ -397,10 +397,6 @@ void bta_ag_rfc_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
|
||||
bta_sys_conn_close(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
|
||||
|
||||
/* call close call-out */
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
bta_ag_sco_co_close();
|
||||
#endif
|
||||
/* call close cback */
|
||||
(*bta_ag_cb.p_cback)(BTA_AG_CLOSE_EVT, (tBTA_AG *) &close);
|
||||
|
||||
@@ -785,14 +781,17 @@ void bta_ag_rcvd_slc_ready(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
{
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
UINT16 handle = p_data->api_setcodec.hdr.layer_specific;
|
||||
tBTA_AG_PEER_CODEC codec_type = p_data->api_setcodec.codec;
|
||||
tBTA_AG_VAL val;
|
||||
|
||||
val.hdr.handle = handle;
|
||||
val.num = codec_type;
|
||||
|
||||
/* Check if the requested codec type is valid */
|
||||
if((codec_type != BTA_AG_CODEC_NONE) &&
|
||||
(codec_type != BTA_AG_CODEC_CVSD) &&
|
||||
(codec_type != BTA_AG_CODEC_MSBC)) {
|
||||
val.num = codec_type;
|
||||
val.hdr.status = BTA_AG_FAIL_RESOURCES;
|
||||
APPL_TRACE_ERROR("%s error: unsupported codec type %d", __func__, codec_type);
|
||||
(*bta_ag_cb.p_cback)(BTA_AG_WBS_EVT, (tBTA_AG *) &val);
|
||||
@@ -804,11 +803,9 @@ void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
(codec_type == BTA_AG_CODEC_CVSD)) {
|
||||
p_scb->sco_codec = codec_type;
|
||||
p_scb->codec_updated = TRUE;
|
||||
val.num = codec_type;
|
||||
val.hdr.status = BTA_AG_SUCCESS;
|
||||
APPL_TRACE_DEBUG("%s: Updated codec type %d", __func__, codec_type);
|
||||
} else {
|
||||
val.num = codec_type;
|
||||
val.hdr.status = BTA_AG_FAIL_RESOURCES;
|
||||
APPL_TRACE_ERROR("%s error: unsupported codec type %d",__func__, codec_type);
|
||||
}
|
||||
|
||||
@@ -245,7 +245,6 @@ void BTA_AgAudioClose(UINT16 handle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_AgResult
|
||||
@@ -297,7 +296,30 @@ void BTA_AgSetCodec(UINT16 handle, tBTA_AG_PEER_CODEC codec)
|
||||
}
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_AgPktStatsNumsGet
|
||||
**
|
||||
** Description Specify the sync_conn_handle to be used for the packet numbers
|
||||
** received or send.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_AgPktStatsNumsGet(UINT16 handle, UINT16 sync_conn_handle)
|
||||
{
|
||||
tBTA_AG_PKT_STAT_GET *p_buf;
|
||||
|
||||
if ((p_buf = (tBTA_AG_PKT_STAT_GET *) osi_malloc(sizeof(tBTA_AG_PKT_STAT_GET))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AG_PKT_STAT_NUMS_GET_EVT;
|
||||
p_buf->hdr.layer_specific = handle;
|
||||
p_buf->sync_conn_handle = sync_conn_handle;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************************
|
||||
* Function BTA_AgCiData
|
||||
*
|
||||
@@ -317,6 +339,6 @@ void BTA_AgCiData(UINT16 handle)
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
}
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */
|
||||
|
||||
#endif /* #if (BTA_AG_INCLUDED == TRUE)*/
|
||||
|
||||
@@ -146,6 +146,14 @@ enum
|
||||
BTA_AG_HF_CMD_BAC
|
||||
};
|
||||
|
||||
/* dialing type of BTA_AG_HF_CMD_D */
|
||||
enum
|
||||
{
|
||||
BTA_AG_HF_DIAL_NUM = 0,
|
||||
BTA_AG_HF_DIAL_VOIP,
|
||||
BTA_AG_HF_DIAL_MEM,
|
||||
};
|
||||
|
||||
/* HFP AT command interpreter table */
|
||||
const tBTA_AG_AT_CMD bta_ag_hfp_cmd[] =
|
||||
{
|
||||
@@ -856,6 +864,8 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
|
||||
|
||||
case BTA_AG_HF_CMD_D:
|
||||
{
|
||||
UINT16 src = 0;
|
||||
UINT16 dst = 0;
|
||||
/* Do not send OK for Dial cmds Let application decide whether to send OK or ERROR*/
|
||||
/* if mem dial cmd, make sure string contains only digits */
|
||||
if(p_arg[0] == '>') {
|
||||
@@ -863,6 +873,8 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
|
||||
event = 0;
|
||||
bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR);
|
||||
}
|
||||
val.value = BTA_AG_HF_DIAL_MEM;
|
||||
src = 1;
|
||||
} else if (p_arg[0] == 'V') {
|
||||
/* ATDV : Dial VoIP Call */
|
||||
/* We do not check string. Code will be added later if needed. */
|
||||
@@ -870,6 +882,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
|
||||
event = 0;
|
||||
bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
|
||||
}
|
||||
val.value = BTA_AG_HF_DIAL_VOIP;
|
||||
} else {
|
||||
/* If dial cmd, make sure string contains only dial digits
|
||||
** Dial digits are 0-9, A-C, *, #, + */
|
||||
@@ -877,6 +890,17 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
|
||||
event = 0;
|
||||
bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR);
|
||||
}
|
||||
val.value = BTA_AG_HF_DIAL_NUM;
|
||||
}
|
||||
if (event != 0) {
|
||||
while ((val.str[dst] = p_arg[src]) != '\0') {
|
||||
if (val.str[dst] == ';') {
|
||||
val.str[dst] = '\0';
|
||||
break;
|
||||
}
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1498,7 +1522,6 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
|
||||
if (p_result->data.ok_flag != BTA_AG_OK_ERROR) {
|
||||
if (p_result->data.str[0] != 0) {
|
||||
bta_ag_send_result(p_scb, code, p_result->data.str, 0);
|
||||
bta_ag_send_ok(p_scb);
|
||||
}
|
||||
if (p_result->data.ok_flag == BTA_AG_OK_DONE) {
|
||||
bta_ag_send_ok(p_scb);
|
||||
|
||||
@@ -91,6 +91,7 @@ enum
|
||||
BTA_AG_CI_SCO_DATA,
|
||||
BTA_AG_CI_RX_DATA,
|
||||
BTA_AG_RCVD_SLC_READY,
|
||||
BTA_AG_PKT_STAT_NUMS,
|
||||
BTA_AG_NUM_ACTIONS
|
||||
};
|
||||
|
||||
@@ -133,7 +134,8 @@ const tBTA_AG_ACTION bta_ag_action[] =
|
||||
bta_ag_send_ring,
|
||||
bta_ag_ci_sco_data,
|
||||
bta_ag_ci_rx_data,
|
||||
bta_ag_rcvd_slc_ready
|
||||
bta_ag_rcvd_slc_ready,
|
||||
bta_ag_pkt_stat_nums
|
||||
};
|
||||
|
||||
/* state table information */
|
||||
@@ -167,7 +169,8 @@ const UINT8 bta_ag_st_init[][BTA_AG_NUM_COLS] =
|
||||
/* RING_TOUT_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_INIT_ST},
|
||||
/* SVC_TOUT_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_INIT_ST},
|
||||
/* CI_SCO_DATA_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_INIT_ST},
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_INIT_ST}
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_INIT_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_AG_PKT_STAT_NUMS, BTA_AG_IGNORE, BTA_AG_INIT_ST}
|
||||
};
|
||||
|
||||
/* state table for opening state */
|
||||
@@ -196,7 +199,8 @@ const UINT8 bta_ag_st_opening[][BTA_AG_NUM_COLS] =
|
||||
/* RING_TOUT_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_OPENING_ST},
|
||||
/* SVC_TOUT_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_OPENING_ST},
|
||||
/* CI_SCO_DATA_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_OPENING_ST},
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_OPENING_ST}
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_OPENING_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_AG_PKT_STAT_NUMS, BTA_AG_IGNORE, BTA_AG_OPENING_ST}
|
||||
};
|
||||
|
||||
/* state table for open state */
|
||||
@@ -225,7 +229,8 @@ const UINT8 bta_ag_st_open[][BTA_AG_NUM_COLS] =
|
||||
/* RING_TOUT_EVT */ {BTA_AG_SEND_RING, BTA_AG_IGNORE, BTA_AG_OPEN_ST},
|
||||
/* SVC_TOUT_EVT */ {BTA_AG_START_CLOSE, BTA_AG_IGNORE, BTA_AG_CLOSING_ST},
|
||||
/* CI_SCO_DATA_EVT */ {BTA_AG_CI_SCO_DATA, BTA_AG_IGNORE, BTA_AG_OPEN_ST},
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_RCVD_SLC_READY, BTA_AG_IGNORE, BTA_AG_OPEN_ST}
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_RCVD_SLC_READY, BTA_AG_IGNORE, BTA_AG_OPEN_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_AG_PKT_STAT_NUMS, BTA_AG_IGNORE, BTA_AG_OPEN_ST}
|
||||
};
|
||||
|
||||
/* state table for closing state */
|
||||
@@ -254,7 +259,8 @@ const UINT8 bta_ag_st_closing[][BTA_AG_NUM_COLS] =
|
||||
/* RING_TOUT_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_CLOSING_ST},
|
||||
/* SVC_TOUT_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_CLOSING_ST},
|
||||
/* CI_SCO_DATA_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_CLOSING_ST},
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_CLOSING_ST}
|
||||
/* CI_SLC_READY_EVT */ {BTA_AG_IGNORE, BTA_AG_IGNORE, BTA_AG_CLOSING_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_AG_PKT_STAT_NUMS, BTA_AG_IGNORE, BTA_AG_CLOSING_ST}
|
||||
};
|
||||
|
||||
/* type for state table */
|
||||
@@ -357,6 +363,8 @@ static char *bta_ag_evt_str(UINT16 event, tBTA_AG_RES result)
|
||||
return "SCO data Callin";
|
||||
case BTA_AG_CI_SLC_READY_EVT:
|
||||
return "SLC Ready Callin";
|
||||
case BTA_AG_PKT_STAT_NUMS_GET_EVT:
|
||||
return "Get Packet Nums";
|
||||
default:
|
||||
return "Unknown AG Event";
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ static void bta_ag_sco_read_cback(UINT16 sco_inx, BT_HDR *p_data, tBTM_SCO_DATA_
|
||||
{
|
||||
if (status != BTM_SCO_DATA_CORRECT)
|
||||
{
|
||||
APPL_TRACE_WARNING("bta_ag_sco_read_cback: status(%d)", status);
|
||||
APPL_TRACE_DEBUG("bta_ag_sco_read_cback: status(%d)", status);
|
||||
}
|
||||
|
||||
/* Callout function must free the data. */
|
||||
@@ -475,6 +475,7 @@ static void bta_ag_cback_sco(tBTA_AG_SCB *p_scb, UINT8 event)
|
||||
|
||||
sco.handle = bta_ag_scb_to_idx(p_scb);
|
||||
sco.app_id = p_scb->app_id;
|
||||
sco.sync_conn_handle = BTM_ReadScoHandle(p_scb->sco_idx);
|
||||
|
||||
/* call close cback */
|
||||
(*bta_ag_cb.p_cback)(event, (tBTA_AG *) &sco);
|
||||
@@ -1477,6 +1478,32 @@ void bta_ag_sco_codec_nego(tBTA_AG_SCB *p_scb, BOOLEAN result)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_ag_pkt_stat_nums
|
||||
**
|
||||
** Description Get the number of packet states
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_ag_pkt_stat_nums(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
{
|
||||
UNUSED(p_scb);
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
tBTA_AG_PKT_STAT_NUMS pkt_stat_nums;
|
||||
uint16_t sync_conn_handle = p_data->pkt_stat.sync_conn_handle;
|
||||
BTM_PktStatNumsGet(sync_conn_handle, (tBTM_SCO_PKT_STAT_NUMS *) &pkt_stat_nums);
|
||||
|
||||
/* call app cback */
|
||||
if (bta_ag_cb.p_cback) {
|
||||
(*bta_ag_cb.p_cback)(BTA_AG_PKT_NUMS_GET_EVT, (tBTA_AG*) &pkt_stat_nums);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_ag_sco_shutdown
|
||||
|
||||
@@ -243,13 +243,16 @@ void bta_ag_del_records(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
UNUSED(p_data);
|
||||
|
||||
/* get services of all other registered servers */
|
||||
for (i = 0; i < BTA_AG_NUM_IDX; i++, p++) {
|
||||
for (i = 0; i < BTA_AG_NUM_IDX; i++) {
|
||||
if (p_scb == p) {
|
||||
continue;
|
||||
}
|
||||
if (p->in_use && p->dealloc == FALSE) {
|
||||
others |= p->reg_services;
|
||||
}
|
||||
if (i < BTA_AG_NUM_SCB) {
|
||||
p++;
|
||||
}
|
||||
}
|
||||
others >>= BTA_HSP_SERVICE_ID;
|
||||
services = p_scb->reg_services >> BTA_HSP_SERVICE_ID;
|
||||
|
||||
@@ -113,6 +113,7 @@ enum
|
||||
BTA_AG_SVC_TOUT_EVT,
|
||||
BTA_AG_CI_SCO_DATA_EVT,
|
||||
BTA_AG_CI_SLC_READY_EVT,
|
||||
BTA_AG_PKT_STAT_NUMS_GET_EVT,
|
||||
BTA_AG_MAX_EVT,
|
||||
|
||||
/* these events are handled outside of the state machine */
|
||||
@@ -218,6 +219,13 @@ typedef struct
|
||||
char p_data[BTA_AG_MTU+1];
|
||||
} tBTA_AG_CI_RX_WRITE;
|
||||
|
||||
/* data type for BTA_AG_PKT_STAT_NUMS_GET_EVT */
|
||||
typedef struct
|
||||
{
|
||||
BT_HDR hdr;
|
||||
UINT16 sync_conn_handle;
|
||||
} tBTA_AG_PKT_STAT_GET;
|
||||
|
||||
/* union of all event datatypes */
|
||||
typedef union
|
||||
{
|
||||
@@ -232,6 +240,7 @@ typedef union
|
||||
tBTA_AG_DISC_RESULT disc_result;
|
||||
tBTA_AG_RFC rfc;
|
||||
tBTA_AG_CI_RX_WRITE ci_rx_write;
|
||||
tBTA_AG_PKT_STAT_GET pkt_stat;
|
||||
} tBTA_AG_DATA;
|
||||
|
||||
/* type for each profile */
|
||||
@@ -276,7 +285,7 @@ typedef struct
|
||||
tBTA_AG_SCO_MSBC_SETTINGS codec_msbc_settings; /* settings to be used for the impending eSCO */
|
||||
TIMER_LIST_ENT cn_timer; /* codec negotiation timer */
|
||||
#endif
|
||||
UINT16 sco_idx; /* SCO handle */
|
||||
UINT16 sco_idx; /* SCO connection index */
|
||||
BOOLEAN in_use; /* scb in use */
|
||||
BOOLEAN dealloc; /* TRUE if service shutting down */
|
||||
BOOLEAN clip_enabled; /* set to TRUE if HF enables CLIP reporting */
|
||||
@@ -437,6 +446,7 @@ extern void bta_ag_ci_sco_data(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data);
|
||||
extern void bta_ag_set_esco_param(BOOLEAN set_reset, tBTM_ESCO_PARAMS *param);
|
||||
extern void bta_ag_ci_rx_data(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data);
|
||||
extern void bta_ag_rcvd_slc_ready(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data);
|
||||
extern void bta_ag_pkt_stat_nums(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data);
|
||||
|
||||
#endif /* #if (BTA_AG_INCLUDED == TRUE) */
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ static const uint8_t bta_hf_client_cb_data_size[] = {
|
||||
sizeof(tBTA_HF_CLIENT_VAL), // #define BTA_HF_CLIENT_BSIR_EVT 19
|
||||
sizeof(tBTA_HF_CLIENT_NUMBER), // #define BTA_HF_CLIENT_BINP_EVT 20
|
||||
sizeof(tBTA_HF_CLIENT_VAL), // #define BTA_HF_CLIENT_RING_INDICATION 21
|
||||
0, // #define BTA_HF_CLIENT_DISABLE_EVT 30
|
||||
0, // #define BTA_HF_CLIENT_DISABLE_EVT 22
|
||||
sizeof(tBTA_SCO_PKT_STAT_NUMS), // #define BTA_HF_CLIENT_PKT_STAT_NUMS_GET_EVT 23
|
||||
};
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
@@ -294,7 +295,28 @@ void BTA_HfClientSendAT(UINT16 handle, tBTA_HF_CLIENT_AT_CMD_TYPE at, UINT32 val
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
}
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientPktStatsNumsGet
|
||||
**
|
||||
** Description Get the packet ststus numbers received and send for a specific (e)SCO connection handle.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientPktStatsNumsGet(UINT16 sync_conn_handle)
|
||||
{
|
||||
tBTA_HF_CLIENT_PKT_STAT_GET *p_buf;
|
||||
if ((p_buf = (tBTA_HF_CLIENT_PKT_STAT_GET *) osi_malloc(sizeof(tBTA_HF_CLIENT_PKT_STAT_GET))) != NULL) {
|
||||
p_buf->hdr.event = BTA_HF_CLIENT_PKT_NUMS_GET_EVT;
|
||||
p_buf->sync_conn_handle = sync_conn_handle;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_HfClientCiData(void)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
|
||||
@@ -75,6 +75,7 @@ enum {
|
||||
BTA_HF_CLIENT_SEND_AT_CMD,
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
BTA_HF_CLIENT_CI_SCO_DATA,
|
||||
BTA_HF_CLIENT_PKT_STAT_NUMS,
|
||||
#endif
|
||||
BTA_HF_CLIENT_NUM_ACTIONS,
|
||||
};
|
||||
@@ -111,8 +112,9 @@ const tBTA_HF_CLIENT_ACTION bta_hf_client_action[] = {
|
||||
/* BTA_HF_CLIENT_DISC_ACP_RES */ bta_hf_client_disc_acp_res,
|
||||
/* BTA_HF_CLIENT_SVC_CONN_OPEN */ bta_hf_client_svc_conn_open,
|
||||
/* BTA_HF_CLIENT_SEND_AT_CMD */ bta_hf_client_send_at_cmd,
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
/* BTA_HF_CLIENT_CI_SCO_DATA */ bta_hf_client_ci_sco_data,
|
||||
/* BTA_HF_CLIENT_PKT_STAT_NUMS */ bta_hf_client_pkt_stat_nums,
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
};
|
||||
|
||||
@@ -143,6 +145,7 @@ const UINT8 bta_hf_client_st_init[][BTA_HF_CLIENT_NUM_COLS] = {
|
||||
/* SEND_AT_CMD_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_INIT_ST},
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
/* CI_SCO_DATA_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_INIT_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_HF_CLIENT_PKT_STAT_NUMS, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_INIT_ST},
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
};
|
||||
|
||||
@@ -166,8 +169,9 @@ const UINT8 bta_hf_client_st_opening[][BTA_HF_CLIENT_NUM_COLS] = {
|
||||
/* SCO_OPEN_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPENING_ST},
|
||||
/* SCO_CLOSE_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPENING_ST},
|
||||
/* SEND_AT_CMD_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPENING_ST},
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
/* CI_SCO_DATA_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPENING_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_HF_CLIENT_PKT_STAT_NUMS, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPENING_ST},
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
};
|
||||
|
||||
@@ -193,6 +197,7 @@ const UINT8 bta_hf_client_st_open[][BTA_HF_CLIENT_NUM_COLS] = {
|
||||
/* SEND_AT_CMD_EVT */ {BTA_HF_CLIENT_SEND_AT_CMD, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPEN_ST},
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
/* CI_SCO_DATA_EVT */ {BTA_HF_CLIENT_CI_SCO_DATA, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPEN_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_HF_CLIENT_PKT_STAT_NUMS, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_OPEN_ST},
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
};
|
||||
|
||||
@@ -218,6 +223,7 @@ const UINT8 bta_hf_client_st_closing[][BTA_HF_CLIENT_NUM_COLS] = {
|
||||
/* SEND_AT_CMD_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
/* CI_SCO_DATA_EVT */ {BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
|
||||
/* PKT_STAT_NUMS_GET_EVT */ {BTA_HF_CLIENT_PKT_STAT_NUMS, BTA_HF_CLIENT_IGNORE, BTA_HF_CLIENT_CLOSING_ST},
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
};
|
||||
|
||||
@@ -640,6 +646,7 @@ static char *bta_hf_client_evt_str(UINT16 event)
|
||||
CASE_RETURN_STR(BTA_HF_CLIENT_SCO_OPEN_EVT)
|
||||
CASE_RETURN_STR(BTA_HF_CLIENT_SCO_CLOSE_EVT)
|
||||
CASE_RETURN_STR(BTA_HF_CLIENT_SEND_AT_CMD_EVT)
|
||||
CASE_RETURN_STR(BTA_HF_CLIENT_PKT_NUMS_GET_EVT)
|
||||
default:
|
||||
return "Unknown HF Client Event";
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ void bta_hf_client_cback_sco(UINT8 event)
|
||||
tBTA_HF_CLIENT_HDR evt;
|
||||
|
||||
memset(&evt, 0, sizeof(evt));
|
||||
evt.sync_conn_handle = BTM_ReadScoHandle(bta_hf_client_cb.scb.sco_idx);
|
||||
|
||||
/* call app cback */
|
||||
(*bta_hf_client_cb.p_cback)(event, (tBTA_HF_CLIENT_HDR *) &evt);
|
||||
@@ -237,7 +238,29 @@ static void bta_hf_client_sco_conn_rsp(tBTM_ESCO_CONN_REQ_EVT_DATA *p_data)
|
||||
BTM_EScoConnRsp(p_data->sco_inx, hci_status, &resp);
|
||||
}
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_pkt_stat_nums
|
||||
**
|
||||
** Description Get the packet status number
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_hf_client_pkt_stat_nums(tBTA_HF_CLIENT_DATA *p_data)
|
||||
{
|
||||
tBTA_SCO_PKT_STAT_NUMS pkt_stat_nums;
|
||||
uint16_t sync_conn_handle = p_data->pkt_stat.sync_conn_handle;
|
||||
BTM_PktStatNumsGet(sync_conn_handle, (tBTM_SCO_PKT_STAT_NUMS *) &pkt_stat_nums);
|
||||
|
||||
/* call app cback */
|
||||
if (bta_hf_client_cb.p_cback) {
|
||||
(*bta_hf_client_cb.p_cback)(BTA_HF_CLIENT_PKT_STAT_NUMS_GET_EVT, (void*) &pkt_stat_nums);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_ci_sco_data
|
||||
@@ -254,6 +277,7 @@ void bta_hf_client_ci_sco_data(tBTA_HF_CLIENT_DATA *p_data)
|
||||
bta_hf_client_sco_event(BTA_HF_CLIENT_SCO_CI_DATA_E);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_sco_connreq_cback
|
||||
|
||||
@@ -26,15 +26,6 @@
|
||||
/* ASCII character string of arguments to the AT command */
|
||||
#define BTA_HF_CLIENT_AT_MAX_LEN 512
|
||||
|
||||
/* AT command table element */
|
||||
typedef struct {
|
||||
const char *p_cmd; /* AT command string */
|
||||
UINT8 arg_type; /* allowable argument type syntax */
|
||||
UINT8 fmt; /* whether arg is int or string */
|
||||
UINT8 min; /* minimum value for int arg */
|
||||
INT16 max; /* maximum value for int arg */
|
||||
} tBTA_AG_AT_CMD;
|
||||
|
||||
/* callback function executed when command is parsed */
|
||||
typedef void (tBTA_AG_AT_CMD_CBACK)(void *p_user, UINT16 cmd, UINT8 arg_type,
|
||||
char *p_arg, INT16 int_arg);
|
||||
|
||||
@@ -64,6 +64,7 @@ enum {
|
||||
BTA_HF_CLIENT_SEND_AT_CMD_EVT,
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
BTA_HF_CLIENT_CI_SCO_DATA_EVT,
|
||||
BTA_HF_CLIENT_PKT_NUMS_GET_EVT,
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
BTA_HF_CLIENT_MAX_EVT,
|
||||
|
||||
@@ -120,6 +121,12 @@ typedef struct {
|
||||
char str[BTA_HF_CLIENT_NUMBER_LEN + 1];
|
||||
} tBTA_HF_CLIENT_DATA_VAL;
|
||||
|
||||
/* data type for BTA_HF_CLIENT_PKT_NUMS_GET_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 sync_conn_handle;
|
||||
} tBTA_HF_CLIENT_PKT_STAT_GET;
|
||||
|
||||
/* union of all event datatypes */
|
||||
typedef union {
|
||||
BT_HDR hdr;
|
||||
@@ -129,6 +136,7 @@ typedef union {
|
||||
tBTA_HF_CLIENT_DISC_RESULT disc_result;
|
||||
tBTA_HF_CLIENT_RFC rfc;
|
||||
tBTA_HF_CLIENT_DATA_VAL val;
|
||||
tBTA_HF_CLIENT_PKT_STAT_GET pkt_stat;
|
||||
|
||||
} tBTA_HF_CLIENT_DATA;
|
||||
|
||||
@@ -299,6 +307,7 @@ extern void bta_hf_client_binp(char *number);
|
||||
extern void bta_hf_client_dial(tBTA_HF_CLIENT_DATA *p_data);
|
||||
extern void bta_hf_client_send_at_cmd(tBTA_HF_CLIENT_DATA *p_data);
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
extern void bta_hf_client_pkt_stat_nums(tBTA_HF_CLIENT_DATA *p_data);
|
||||
extern void bta_hf_client_ci_sco_data(tBTA_HF_CLIENT_DATA *p_data);
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
#endif /* #if (BTA_HF_INCLUDED == TRUE) */
|
||||
|
||||
@@ -158,6 +158,8 @@ typedef UINT8 tBTA_AG_RES;
|
||||
#endif
|
||||
#define BTA_AG_AUDIO_MSBC_OPEN_EVT 32 /* Audio connection with mSBC codec open */
|
||||
|
||||
#define BTA_AG_PKT_NUMS_GET_EVT 33 /* AG packet status nums */
|
||||
|
||||
/* Values below are for HFP only */
|
||||
#define BTA_AG_AT_A_EVT 10 /* Answer a incoming call */
|
||||
#define BTA_AG_AT_D_EVT 11 /* Place a call using number or memory dial */
|
||||
@@ -261,15 +263,15 @@ typedef UINT8 tBTA_AG_BTRH_TYPE;
|
||||
#endif
|
||||
|
||||
/* indicator constants HFP 1.1 and later */
|
||||
#define BTA_AG_IND_CALL 0 /* position of call indicator */
|
||||
#define BTA_AG_IND_CALLSETUP 1 /* position of callsetup indicator */
|
||||
#define BTA_AG_IND_SERVICE 2 /* position of service indicator */
|
||||
#define BTA_AG_IND_CALL 1 /* position of call indicator */
|
||||
#define BTA_AG_IND_CALLSETUP 2 /* position of callsetup indicator */
|
||||
#define BTA_AG_IND_SERVICE 3 /* position of service indicator */
|
||||
/* indicator constants HFP 1.5 and later */
|
||||
#define BTA_AG_IND_SIGNAL 3 /* position of signal strength indicator */
|
||||
#define BTA_AG_IND_ROAM 4 /* position of roaming indicator */
|
||||
#define BTA_AG_IND_BATTCHG 5 /* position of battery charge indicator */
|
||||
#define BTA_AG_IND_CALLHELD 6 /* position of callheld indicator */
|
||||
#define BTA_AG_IND_BEARER 7 /* position of bearer indicator */
|
||||
#define BTA_AG_IND_SIGNAL 4 /* position of signal strength indicator */
|
||||
#define BTA_AG_IND_ROAM 5 /* position of roaming indicator */
|
||||
#define BTA_AG_IND_BATTCHG 6 /* position of battery charge indicator */
|
||||
#define BTA_AG_IND_CALLHELD 7 /* position of callheld indicator */
|
||||
#define BTA_AG_IND_BEARER 8 /* position of bearer indicator */
|
||||
typedef UINT16 tBTA_AG_IND_TYPE;
|
||||
|
||||
/* call indicator values */
|
||||
@@ -327,6 +329,7 @@ typedef struct
|
||||
UINT16 handle;
|
||||
UINT8 app_id;
|
||||
tBTA_AG_STATUS status;
|
||||
UINT16 sync_conn_handle;
|
||||
} tBTA_AG_HDR;
|
||||
|
||||
/* data associated with BTA_AG_REGISTER_EVT */
|
||||
@@ -405,6 +408,17 @@ typedef struct {
|
||||
char number[BTA_AG_NUMBER_LEN + 1];
|
||||
} tBTA_AG_CNUM;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_PKT_STAT_NUMS_GET_EVT */
|
||||
typedef struct {
|
||||
UINT32 rx_total;
|
||||
UINT32 rx_correct;
|
||||
UINT32 rx_err;
|
||||
UINT32 rx_none;
|
||||
UINT32 rx_lost;
|
||||
UINT32 tx_total;
|
||||
UINT32 tx_discarded;
|
||||
} tBTA_AG_PKT_STAT_NUMS;
|
||||
|
||||
/* union of data associated with AG callback */
|
||||
typedef union
|
||||
{
|
||||
@@ -421,6 +435,7 @@ typedef union
|
||||
tBTA_AG_AT_RESULT result;
|
||||
tBTA_AG_CLCC clcc;
|
||||
tBTA_AG_CNUM cnum;
|
||||
tBTA_AG_PKT_STAT_NUMS pkt_num;
|
||||
} tBTA_AG;
|
||||
|
||||
/* AG callback */
|
||||
@@ -581,6 +596,18 @@ void BTA_AgSetCodec(UINT16 handle, tBTA_AG_PEER_CODEC codec);
|
||||
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_AgPktStatsNumsGet
|
||||
**
|
||||
** Description Get the Number of packets status received
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_AgPktStatsNumsGet(UINT16 handle, UINT16 sync_conn_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_AgCiData
|
||||
|
||||
@@ -1237,6 +1237,8 @@ typedef void (tBTA_START_STOP_SCAN_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_START_STOP_ADV_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_CLEAR_ADV_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_BLE_TRACK_ADV_CMPL_CBACK)(int action, tBTA_STATUS status,
|
||||
tBTA_DM_BLE_PF_AVBL_SPACE avbl_space,
|
||||
tBTA_DM_BLE_REF_VALUE ref_value);
|
||||
@@ -2611,6 +2613,19 @@ extern void BTA_DmBleSetAdvConfigRaw (UINT8 *p_raw_adv, UINT32 raw_adv_len,
|
||||
void BTA_DmBleSetLongAdv (UINT8 *adv_data, UINT32 adv_data_len,
|
||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleClearAdv
|
||||
**
|
||||
** Description This function is called to clear Advertising
|
||||
**
|
||||
** Parameters p_adv_data_cback : clear adv complete callback.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleClearAdv (tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetScanRsp
|
||||
|
||||
@@ -112,7 +112,8 @@ typedef UINT8 tBTA_HF_CLIENT_AT_RESULT_TYPE;
|
||||
#define BTA_HF_CLIENT_BSIR_EVT 19 /* in-band ring tone setting changed event */
|
||||
#define BTA_HF_CLIENT_BINP_EVT 20 /* binp number event */
|
||||
#define BTA_HF_CLIENT_RING_INDICATION 21 /* HF Client ring indication */
|
||||
#define BTA_HF_CLIENT_DISABLE_EVT 30 /* HF Client disabled */
|
||||
#define BTA_HF_CLIENT_DISABLE_EVT 22 /* HF Client disabled */
|
||||
#define BTA_HF_CLIENT_PKT_STAT_NUMS_GET_EVT 23 /* HF Client packet status nums */
|
||||
|
||||
typedef UINT8 tBTA_HF_CLIENT_EVT;
|
||||
|
||||
@@ -159,6 +160,7 @@ typedef UINT8 tBTA_HF_CLIENT_AT_CMD_TYPE;
|
||||
/* data associated with most non-AT events */
|
||||
/* placeholder, if not needed should be removed*/
|
||||
typedef struct {
|
||||
UINT16 sync_conn_handle;
|
||||
} tBTA_HF_CLIENT_HDR;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_REGISTER_EVT */
|
||||
@@ -228,6 +230,17 @@ typedef struct {
|
||||
UINT16 value;
|
||||
} tBTA_HF_CLIENT_VAL;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_PKT_STAT_NUMS_GET_EVT */
|
||||
typedef struct {
|
||||
UINT32 rx_total;
|
||||
UINT32 rx_correct;
|
||||
UINT32 rx_err;
|
||||
UINT32 rx_none;
|
||||
UINT32 rx_lost;
|
||||
UINT32 tx_total;
|
||||
UINT32 tx_discarded;
|
||||
} tBTA_SCO_PKT_STAT_NUMS;
|
||||
|
||||
/* union of data associated with AG callback */
|
||||
typedef union {
|
||||
tBTA_HF_CLIENT_HDR hdr;
|
||||
@@ -241,6 +254,7 @@ typedef union {
|
||||
tBTA_HF_CLIENT_AT_RESULT result;
|
||||
tBTA_HF_CLIENT_CLCC clcc;
|
||||
tBTA_HF_CLIENT_CNUM cnum;
|
||||
tBTA_SCO_PKT_STAT_NUMS pkt_num;
|
||||
} tBTA_HF_CLIENT;
|
||||
|
||||
typedef UINT32 tBTA_HF_CLIENT_FEAT;
|
||||
@@ -376,6 +390,18 @@ void BTA_HfClientAudioClose(UINT16 handle);
|
||||
void BTA_HfClientSendAT(UINT16 handle, tBTA_HF_CLIENT_AT_CMD_TYPE at, UINT32 val1, UINT32 val2, const char *str);
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientPktStatsNumsGet
|
||||
**
|
||||
** Description Get the Number of packets status received and send
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientPktStatsNumsGet(UINT16 sync_conn_handle);
|
||||
|
||||
void BTA_HfClientCiData(void);
|
||||
#endif /*#if (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
|
||||
|
||||
@@ -824,7 +824,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
||||
@@ -285,11 +285,10 @@ tBTA_JV_RFC_CB *bta_jv_rfc_port_to_cb(UINT16 port_handle)
|
||||
return p_cb;
|
||||
}
|
||||
|
||||
static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pcb, BOOLEAN close_server)
|
||||
static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pcb, BOOLEAN close_server, BOOLEAN close_pending)
|
||||
{
|
||||
tBTA_JV_STATUS status = BTA_JV_SUCCESS;
|
||||
BOOLEAN remove_server = FALSE;
|
||||
int close_pending = 0;
|
||||
|
||||
UINT8 used = 0, i, listen = 0;
|
||||
tPORT_STATE port_state;
|
||||
@@ -312,11 +311,11 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pc
|
||||
switch (p_pcb->state) {
|
||||
case BTA_JV_ST_CL_CLOSING:
|
||||
case BTA_JV_ST_SR_CLOSING:
|
||||
APPL_TRACE_WARNING("bta_jv_free_sr_rfc_cb: return on closing, port state:%d, "
|
||||
APPL_TRACE_DEBUG("bta_jv_free_sr_rfc_cb: return on closing, port state:%d, "
|
||||
"scn:%d, p_pcb:%p, user_data:%p", p_pcb->state, p_cb->scn, p_pcb,
|
||||
p_pcb->user_data);
|
||||
status = BTA_JV_FAILURE;
|
||||
return status;
|
||||
break;
|
||||
case BTA_JV_ST_CL_OPEN:
|
||||
case BTA_JV_ST_CL_OPENING:
|
||||
APPL_TRACE_DEBUG("bta_jv_free_sr_rfc_cb: state: %d, scn:%d,"
|
||||
@@ -1199,10 +1198,15 @@ void bta_jv_delete_record(tBTA_JV_MSG *p_data)
|
||||
*******************************************************************************/
|
||||
static void bta_jv_l2cap_client_cback(UINT16 gap_handle, UINT16 event)
|
||||
{
|
||||
if (gap_handle >= BTA_JV_MAX_L2C_CONN) {
|
||||
APPL_TRACE_WARNING("Invalid gap_handle: %u", gap_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
tBTA_JV_L2C_CB *p_cb = &bta_jv_cb.l2c_cb[gap_handle];
|
||||
tBTA_JV evt_data = {0};
|
||||
|
||||
if (gap_handle >= BTA_JV_MAX_L2C_CONN && !p_cb->p_cback) {
|
||||
if (!p_cb->p_cback) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1354,12 +1358,17 @@ void bta_jv_l2cap_close(tBTA_JV_MSG *p_data)
|
||||
*******************************************************************************/
|
||||
static void bta_jv_l2cap_server_cback(UINT16 gap_handle, UINT16 event)
|
||||
{
|
||||
if (gap_handle >= BTA_JV_MAX_L2C_CONN) {
|
||||
APPL_TRACE_WARNING("Invalid gap_handle: %u", gap_handle);
|
||||
return;
|
||||
}
|
||||
|
||||
tBTA_JV_L2C_CB *p_cb = &bta_jv_cb.l2c_cb[gap_handle];
|
||||
tBTA_JV evt_data = {0};
|
||||
tBTA_JV_L2CAP_CBACK *p_cback;
|
||||
void *user_data;
|
||||
|
||||
if (gap_handle >= BTA_JV_MAX_L2C_CONN && !p_cb->p_cback) {
|
||||
if (!p_cb->p_cback) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1669,6 +1678,7 @@ static void bta_jv_port_mgmt_cl_cback(UINT32 code, UINT16 port_handle, void* dat
|
||||
BD_ADDR rem_bda = {0};
|
||||
UINT16 lcid;
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback; /* the callback function */
|
||||
void *user_data = NULL;
|
||||
|
||||
APPL_TRACE_DEBUG( "bta_jv_port_mgmt_cl_cback:code:%d, port_handle%d", code, port_handle);
|
||||
if (NULL == p_cb || NULL == p_cb->p_cback) {
|
||||
@@ -1695,13 +1705,14 @@ static void bta_jv_port_mgmt_cl_cback(UINT32 code, UINT16 port_handle, void* dat
|
||||
evt_data.rfc_close.async = FALSE;
|
||||
evt_data.rfc_close.status = BTA_JV_SUCCESS;
|
||||
}
|
||||
//p_pcb->state = BTA_JV_ST_NONE;
|
||||
//p_pcb->cong = FALSE;
|
||||
p_cback = p_cb->p_cback;
|
||||
p_cback(BTA_JV_RFCOMM_CLOSE_EVT, &evt_data, p_pcb->user_data);
|
||||
//bta_jv_free_rfc_cb(p_cb, p_pcb);
|
||||
}
|
||||
user_data = p_pcb->user_data;
|
||||
|
||||
// To free up resources.
|
||||
p_pcb->state = BTA_JV_ST_CL_CLOSING;
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb, FALSE, FALSE);
|
||||
p_cback(BTA_JV_RFCOMM_CLOSE_EVT, &evt_data, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -1858,7 +1869,6 @@ void bta_jv_rfcomm_close(tBTA_JV_MSG *p_data)
|
||||
tBTA_JV_API_RFCOMM_CLOSE *cc = &(p_data->rfcomm_close);
|
||||
tBTA_JV_RFC_CB *p_cb = NULL;
|
||||
tBTA_JV_PCB *p_pcb = NULL;
|
||||
tBTA_JV evt_data = {0};
|
||||
APPL_TRACE_DEBUG("%s, rfc handle:%d",__func__, cc->handle);
|
||||
if (!cc->handle) {
|
||||
APPL_TRACE_ERROR("%s, rfc handle is null", __func__);
|
||||
@@ -1869,20 +1879,9 @@ void bta_jv_rfcomm_close(tBTA_JV_MSG *p_data)
|
||||
if (!find_rfc_pcb(user_data, &p_cb, &p_pcb)) {
|
||||
return;
|
||||
}
|
||||
if(cc->p_cback) {
|
||||
evt_data.rfc_close.status = BTA_JV_SUCCESS;
|
||||
evt_data.rfc_close.port_status = PORT_LOCAL_CLOSED;
|
||||
evt_data.rfc_close.handle = cc->handle;
|
||||
evt_data.rfc_close.async = TRUE;
|
||||
if (p_pcb && (p_pcb->state == BTA_JV_ST_SR_LISTEN ||
|
||||
p_pcb->state == BTA_JV_ST_SR_OPEN ||
|
||||
p_pcb->state == BTA_JV_ST_CL_OPEN ||
|
||||
p_pcb->state == BTA_JV_ST_CL_OPENING)) {
|
||||
evt_data.rfc_close.async = FALSE;
|
||||
}
|
||||
cc->p_cback(BTA_JV_RFCOMM_CLOSE_EVT, (tBTA_JV *)&evt_data, user_data);
|
||||
}
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb, FALSE);
|
||||
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb, FALSE, TRUE);
|
||||
|
||||
APPL_TRACE_DEBUG("%s: sec id in use:%d, rfc_cb in use:%d",__func__,
|
||||
get_sec_id_used(), get_rfc_cb_used());
|
||||
}
|
||||
@@ -1982,7 +1981,7 @@ static void bta_jv_port_mgmt_sr_cback(UINT32 code, UINT16 port_handle, void *dat
|
||||
APPL_TRACE_ERROR("create new listen port, but upper layer reject connection");
|
||||
p_pcb_new_listen->user_data = NULL;
|
||||
p_pcb->state = BTA_JV_ST_SR_LISTEN;
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb_new_listen, FALSE);
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb_new_listen, FALSE, FALSE);
|
||||
if (p_mgmt_cb_arg) {
|
||||
p_mgmt_cb_arg->accept = FALSE;
|
||||
}
|
||||
@@ -2022,10 +2021,11 @@ static void bta_jv_port_mgmt_sr_cback(UINT32 code, UINT16 port_handle, void *dat
|
||||
evt_data.rfc_close.async = FALSE;
|
||||
evt_data.rfc_close.status = BTA_JV_SUCCESS;
|
||||
}
|
||||
//p_pcb->state = BTA_JV_ST_NONE;
|
||||
p_cback(BTA_JV_RFCOMM_CLOSE_EVT, &evt_data, user_data);
|
||||
//bta_jv_free_rfc_cb(p_cb, p_pcb);
|
||||
|
||||
// To free up resources.
|
||||
p_pcb->state = BTA_JV_ST_SR_CLOSING;
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb, FALSE, FALSE);
|
||||
p_cback(BTA_JV_RFCOMM_CLOSE_EVT, &evt_data, user_data);
|
||||
APPL_TRACE_DEBUG("PORT_CLOSED after BTA_JV_RFCOMM_CLOSE_EVT: curr_sess:%d, max_sess:%d",
|
||||
p_cb->curr_sess, p_cb->max_sess);
|
||||
}
|
||||
@@ -2259,7 +2259,7 @@ void bta_jv_rfcomm_stop_server(tBTA_JV_MSG *p_data)
|
||||
}
|
||||
APPL_TRACE_DEBUG("bta_jv_rfcomm_stop_server: p_pcb:%p, p_pcb->port_handle:%d",
|
||||
p_pcb, p_pcb->port_handle);
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb, TRUE);
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb, TRUE, FALSE);
|
||||
APPL_TRACE_DEBUG("bta_jv_rfcomm_stop_server: sec id in use:%d, rfc_cb in use:%d",
|
||||
get_sec_id_used(), get_rfc_cb_used());
|
||||
}
|
||||
|
||||
@@ -913,7 +913,7 @@ tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data)
|
||||
tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data)
|
||||
{
|
||||
tBTA_JV_STATUS status = BTA_JV_FAILURE;
|
||||
tBTA_JV_API_RFCOMM_CLOSE *p_msg;
|
||||
@@ -928,7 +928,6 @@ tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, v
|
||||
p_msg->handle = handle;
|
||||
p_msg->p_cb = &bta_jv_cb.rfc_cb[hi];
|
||||
p_msg->p_pcb = &bta_jv_cb.port_cb[p_msg->p_cb->rfc_hdl[si] - 1];
|
||||
p_msg->p_cback = p_cback;
|
||||
p_msg->user_data = user_data;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
status = BTA_JV_SUCCESS;
|
||||
|
||||
@@ -324,7 +324,6 @@ typedef struct {
|
||||
UINT32 handle;
|
||||
tBTA_JV_RFC_CB *p_cb;
|
||||
tBTA_JV_PCB *p_pcb;
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_RFCOMM_CLOSE;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2015-2023 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.
|
||||
@@ -30,7 +30,6 @@ static void _btc_storage_save(void)
|
||||
{
|
||||
uint16_t addr_section_count = 0;
|
||||
bt_bdaddr_t bd_addr;
|
||||
uint32_t device_type = 0;
|
||||
const btc_config_section_iter_t *need_remove_iter = NULL;
|
||||
const btc_config_section_iter_t *iter = btc_config_section_begin();
|
||||
|
||||
@@ -55,9 +54,7 @@ static void _btc_storage_save(void)
|
||||
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)) {
|
||||
if (!string_is_bdaddr(section)) {
|
||||
iter = btc_config_section_next(iter);
|
||||
continue;
|
||||
}
|
||||
@@ -72,19 +69,20 @@ static void _btc_storage_save(void)
|
||||
if (need_remove_iter) {
|
||||
while(need_remove_iter != btc_config_section_end()) {
|
||||
const char *need_remove_section = btc_config_section_name(need_remove_iter);
|
||||
if (!string_is_bdaddr(need_remove_section) ||
|
||||
!btc_config_get_int(need_remove_section, BTC_BLE_STORAGE_DEV_TYPE_STR, (int *)&device_type) ||
|
||||
((device_type & BT_DEVICE_TYPE_BLE) != BT_DEVICE_TYPE_BLE)) {
|
||||
if (!string_is_bdaddr(need_remove_section)) {
|
||||
need_remove_iter = btc_config_section_next(need_remove_iter);
|
||||
continue;
|
||||
}
|
||||
need_remove_iter = btc_config_section_next(need_remove_iter);
|
||||
//delete device info
|
||||
string_to_bdaddr(need_remove_section, &bd_addr);
|
||||
BTM_SecDeleteDevice(bd_addr.address, BT_TRANSPORT_LE);
|
||||
BTA_DmRemoveDevice(bd_addr.address, BT_TRANSPORT_LE);
|
||||
BTA_DmRemoveDevice(bd_addr.address, BT_TRANSPORT_BR_EDR);
|
||||
//delete config info
|
||||
if(btc_config_remove_section(need_remove_section)) {
|
||||
BTIF_TRACE_WARNING("exceeded the maximum nubmer of bonded devices, delete the last device info : %s", need_remove_section);
|
||||
if (btc_config_remove_section(need_remove_section)) {
|
||||
// The need_remove_section has been freed
|
||||
BTIF_TRACE_WARNING("Exceeded the maximum number of bonded devices. Deleting the last device info: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
bd_addr.address[0], bd_addr.address[1], bd_addr.address[2], bd_addr.address[3], bd_addr.address[4], bd_addr.address[5]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,6 +207,170 @@ bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bt_status_t _btc_storage_remove_all_ble_keys(const char *name)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (name == NULL) {
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
if (btc_config_exist(name, BTC_BLE_STORAGE_ADDR_TYPE_STR)) {
|
||||
ret |= btc_config_remove(name, BTC_BLE_STORAGE_ADDR_TYPE_STR);
|
||||
}
|
||||
if (btc_config_exist(name, BTC_BLE_STORAGE_LE_KEY_PENC_STR)) {
|
||||
ret |= btc_config_remove(name, BTC_BLE_STORAGE_LE_KEY_PENC_STR);
|
||||
}
|
||||
if (btc_config_exist(name, BTC_BLE_STORAGE_LE_KEY_PID_STR)) {
|
||||
ret |= btc_config_remove(name, BTC_BLE_STORAGE_LE_KEY_PID_STR);
|
||||
}
|
||||
if (btc_config_exist(name, BTC_BLE_STORAGE_LE_KEY_PCSRK_STR)) {
|
||||
ret |= btc_config_remove(name, BTC_BLE_STORAGE_LE_KEY_PCSRK_STR);
|
||||
}
|
||||
if (btc_config_exist(name, BTC_BLE_STORAGE_LE_KEY_LENC_STR)) {
|
||||
ret |= btc_config_remove(name, BTC_BLE_STORAGE_LE_KEY_LENC_STR);
|
||||
}
|
||||
if (btc_config_exist(name, BTC_BLE_STORAGE_LE_KEY_LCSRK_STR)) {
|
||||
ret |= btc_config_remove(name, BTC_BLE_STORAGE_LE_KEY_LCSRK_STR);
|
||||
}
|
||||
if (btc_config_exist(name, BTC_BLE_STORAGE_LE_KEY_LID_STR)) {
|
||||
ret |= btc_config_remove(name, BTC_BLE_STORAGE_LE_KEY_LID_STR);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void btc_storage_remove_unused_sections(uint8_t *cur_addr, tBTM_LE_PID_KEYS *del_pid_key)
|
||||
{
|
||||
bt_bdaddr_t bd_addr;
|
||||
uint32_t device_type = 0;
|
||||
|
||||
if (del_pid_key == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
btc_config_lock();
|
||||
|
||||
const btc_config_section_iter_t *iter = btc_config_section_begin();
|
||||
|
||||
while (iter != btc_config_section_end()) {
|
||||
//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_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) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_PID_STR) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_PCSRK_STR) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_LENC_STR) &&
|
||||
!btc_config_exist(section, BTC_BLE_STORAGE_LE_KEY_LCSRK_STR)) {
|
||||
iter = btc_config_section_next(iter);
|
||||
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;
|
||||
}
|
||||
|
||||
string_to_bdaddr(section, &bd_addr);
|
||||
|
||||
char buffer[sizeof(tBTM_LE_KEY_VALUE)] = {0};
|
||||
|
||||
if (_btc_storage_get_ble_bonding_key(&bd_addr, BTM_LE_KEY_PID, buffer, sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS) {
|
||||
|
||||
tBTM_LE_PID_KEYS *pid_key = (tBTM_LE_PID_KEYS *) buffer;
|
||||
|
||||
iter = btc_config_section_next(iter);
|
||||
|
||||
if (memcmp(del_pid_key->static_addr, pid_key->static_addr, 6) == 0 && memcmp(cur_addr, bd_addr.address, 6) != 0 && del_pid_key->addr_type == pid_key->addr_type) {
|
||||
if (device_type == BT_DEVICE_TYPE_DUMO) {
|
||||
btc_config_set_int(section, BTC_BLE_STORAGE_DEV_TYPE_STR, BT_DEVICE_TYPE_BREDR);
|
||||
_btc_storage_remove_all_ble_keys(section);
|
||||
} else {
|
||||
//delete unused sections
|
||||
BTIF_TRACE_DEBUG("delete section %s\n", section);
|
||||
btc_config_remove_section(section);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iter = btc_config_section_next(iter);
|
||||
}
|
||||
}
|
||||
|
||||
btc_config_unlock();
|
||||
|
||||
}
|
||||
|
||||
void btc_storage_delete_duplicate_ble_devices(void)
|
||||
{
|
||||
bt_bdaddr_t bd_addr;
|
||||
char buffer[sizeof(tBTM_LE_KEY_VALUE)] = {0};
|
||||
char temp_buffer[sizeof(tBTM_LE_KEY_VALUE)] = {0};
|
||||
tBTM_LE_PID_KEYS *pid_key;
|
||||
tBTM_LE_PID_KEYS *temp_pid_key;
|
||||
uint32_t device_type = 0;
|
||||
|
||||
bt_bdaddr_t temp_bd_addr;
|
||||
|
||||
btc_config_lock();
|
||||
for (const btc_config_section_iter_t *iter = btc_config_section_begin(); iter != btc_config_section_end();
|
||||
iter = btc_config_section_next(iter)) {
|
||||
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) != BT_DEVICE_TYPE_BLE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
string_to_bdaddr(name, &bd_addr);
|
||||
if (_btc_storage_get_ble_bonding_key(&bd_addr, BTM_LE_KEY_PID, buffer, sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS)
|
||||
{
|
||||
pid_key = (tBTM_LE_PID_KEYS *) buffer;
|
||||
|
||||
const btc_config_section_iter_t *temp_iter = btc_config_section_next(iter);
|
||||
while (temp_iter != NULL)
|
||||
{
|
||||
const char *temp_name = btc_config_section_name(temp_iter);
|
||||
if (!string_is_bdaddr(temp_name) || !btc_config_get_int(temp_name, BTC_BLE_STORAGE_DEV_TYPE_STR, (int *)&device_type) ||
|
||||
((device_type & BT_DEVICE_TYPE_BLE) != BT_DEVICE_TYPE_BLE)) {
|
||||
temp_iter = btc_config_section_next(temp_iter);
|
||||
continue;
|
||||
}
|
||||
string_to_bdaddr(temp_name, &temp_bd_addr);
|
||||
if (_btc_storage_get_ble_bonding_key(&temp_bd_addr, BTM_LE_KEY_PID, temp_buffer, sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS)
|
||||
{
|
||||
temp_pid_key = (tBTM_LE_PID_KEYS *) temp_buffer;
|
||||
if (memcmp(pid_key->static_addr, temp_pid_key->static_addr, 6) == 0 && pid_key->addr_type == temp_pid_key->addr_type) {
|
||||
const char *temp_name = btc_config_section_name(temp_iter);
|
||||
temp_iter = btc_config_section_next(temp_iter);
|
||||
if (device_type == BT_DEVICE_TYPE_DUMO) {
|
||||
btc_config_set_int(temp_name, BTC_BLE_STORAGE_DEV_TYPE_STR, BT_DEVICE_TYPE_BREDR);
|
||||
_btc_storage_remove_all_ble_keys(temp_name);
|
||||
} else {
|
||||
BTC_TRACE_DEBUG("delete %s\n", temp_name);
|
||||
btc_config_remove_section(temp_name);
|
||||
}
|
||||
} else {
|
||||
temp_iter = btc_config_section_next(temp_iter);
|
||||
}
|
||||
} else {
|
||||
temp_iter = btc_config_section_next(temp_iter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
btc_config_unlock();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_storage_remove_ble_bonding_keys
|
||||
@@ -227,27 +389,8 @@ static bt_status_t _btc_storage_remove_ble_bonding_keys(bt_bdaddr_t *remote_bd_a
|
||||
|
||||
BTIF_TRACE_DEBUG(" %s in bd addr:%s",__FUNCTION__, bdstr);
|
||||
|
||||
if (btc_config_exist(bdstr, BTC_BLE_STORAGE_ADDR_TYPE_STR)) {
|
||||
ret |= btc_config_remove(bdstr, BTC_BLE_STORAGE_ADDR_TYPE_STR);
|
||||
}
|
||||
if (btc_config_exist(bdstr, BTC_BLE_STORAGE_LE_KEY_PENC_STR)) {
|
||||
ret |= btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_KEY_PENC_STR);
|
||||
}
|
||||
if (btc_config_exist(bdstr, BTC_BLE_STORAGE_LE_KEY_PID_STR)) {
|
||||
ret |= btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_KEY_PID_STR);
|
||||
}
|
||||
if (btc_config_exist(bdstr, BTC_BLE_STORAGE_LE_KEY_PCSRK_STR)) {
|
||||
ret |= btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_KEY_PCSRK_STR);
|
||||
}
|
||||
if (btc_config_exist(bdstr, BTC_BLE_STORAGE_LE_KEY_LENC_STR)) {
|
||||
ret |= btc_config_remove(bdstr, BTC_BLE_STORAGE_LE_KEY_LENC_STR);
|
||||
}
|
||||
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);
|
||||
}
|
||||
ret = _btc_storage_remove_all_ble_keys(bdstr);
|
||||
|
||||
//here don't remove section, because config_save will check it
|
||||
_btc_storage_save();
|
||||
return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL;
|
||||
@@ -766,7 +909,7 @@ static void _btc_read_le_key(const uint8_t key_type, const size_t key_len, bt_bd
|
||||
*key_found = true;
|
||||
}
|
||||
}
|
||||
static bt_status_t _btc_storage_in_fetch_bonded_ble_device(const char *remote_bd_addr, int add)
|
||||
bt_status_t _btc_storage_in_fetch_bonded_ble_device(const char *remote_bd_addr, int add)
|
||||
{
|
||||
uint32_t device_type;
|
||||
int addr_type;
|
||||
@@ -808,58 +951,13 @@ static bt_status_t _btc_storage_in_fetch_bonded_ble_device(const char *remote_bd
|
||||
|
||||
if (key_found) {
|
||||
return BT_STATUS_SUCCESS;
|
||||
} else {
|
||||
BTC_TRACE_DEBUG("Remote device:%s, no link key or ble key found", remote_bd_addr);
|
||||
}
|
||||
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
static bt_status_t btc_storage_in_fetch_bonded_ble_devices(int add)
|
||||
{
|
||||
bt_status_t status = BT_STATUS_FAIL;
|
||||
uint32_t device_type = 0;
|
||||
|
||||
btc_config_lock();
|
||||
for (const btc_config_section_iter_t *iter = btc_config_section_begin(); iter != btc_config_section_end();
|
||||
iter = btc_config_section_next(iter)) {
|
||||
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) != BT_DEVICE_TYPE_BLE)) {
|
||||
continue;
|
||||
}
|
||||
BTC_TRACE_DEBUG("%s, name = %s", __func__, name);
|
||||
if (_btc_storage_in_fetch_bonded_ble_device(name, add) != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_DEBUG("Remote device:%s, no link key or ble key found", name);
|
||||
} else {
|
||||
status = BT_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
btc_config_unlock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_storage_load_bonded_devices
|
||||
**
|
||||
** Description btc storage API - Loads all the bonded devices from NVRAM
|
||||
** and adds to the BTA.
|
||||
** Additionally, this API also invokes the adaper_properties_cb
|
||||
** and remote_device_properties_cb for each of the bonded devices.
|
||||
**
|
||||
** Returns BT_STATUS_SUCCESS if successful, BT_STATUS_FAIL otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
bt_status_t btc_storage_load_bonded_ble_devices(void)
|
||||
{
|
||||
bt_status_t status;
|
||||
status = btc_storage_in_fetch_bonded_ble_devices(1);
|
||||
BTC_TRACE_DEBUG("Storage load rslt %d\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user