forked from espressif/esp-idf
Compare commits
792 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e499576efd | ||
|
|
8498af6bd4 | ||
|
|
0ab74e5c5d | ||
|
|
d1c0cc5e3d | ||
|
|
c689d2ab9e | ||
|
|
1558b05d1c | ||
|
|
eaba2427aa | ||
|
|
d98ba8b570 | ||
|
|
2b39e1c625 | ||
|
|
d07bdc70b6 | ||
|
|
834ae1c002 | ||
|
|
147bc3b889 | ||
|
|
b145507fff | ||
|
|
df497dde7a | ||
|
|
a7a18f4632 | ||
|
|
9d1a374e01 | ||
|
|
fd916b39ef | ||
|
|
7c2922a7d5 | ||
|
|
dd8185bdf1 | ||
|
|
9f0e5aec6c | ||
|
|
5b4f8a6e50 | ||
|
|
d1c8a1d1c2 | ||
|
|
2146569780 | ||
|
|
ed01a2a32d | ||
|
|
1091defe43 | ||
|
|
de8df121e6 | ||
|
|
6912d661d9 | ||
|
|
a0eb182f45 | ||
|
|
64b1fe94e8 | ||
|
|
818644cf5a | ||
|
|
c0e0af03d1 | ||
|
|
1e877f6872 | ||
|
|
7521a51845 | ||
|
|
339ae99b04 | ||
|
|
b8477e0282 | ||
|
|
ea45a644f0 | ||
|
|
9b0602adbd | ||
|
|
822fbc2fc2 | ||
|
|
d84b40dc5a | ||
|
|
799e503c47 | ||
|
|
ef5a6437a8 | ||
|
|
c9972418fb | ||
|
|
1fda281bb7 | ||
|
|
a94dcb9cda | ||
|
|
1424b2b1e6 | ||
|
|
5c642bf0ee | ||
|
|
5d4a90e7a6 | ||
|
|
79e71e008c | ||
|
|
ccb2bc24cb | ||
|
|
b2bc7b17f8 | ||
|
|
77106b3238 | ||
|
|
6e0661ab3e | ||
|
|
509c4c2953 | ||
|
|
543276b4ab | ||
|
|
fc33940ce9 | ||
|
|
d0274c0efb | ||
|
|
22dd4ba5e8 | ||
|
|
68ad59ac93 | ||
|
|
99e551beb9 | ||
|
|
f13847832b | ||
|
|
58c78162b9 | ||
|
|
de337d5625 | ||
|
|
5b7985b89f | ||
|
|
7fbb4cfa51 | ||
|
|
a5e717662f | ||
|
|
9d34f39c37 | ||
|
|
4a69a889a5 | ||
|
|
d783018e82 | ||
|
|
a3233986a2 | ||
|
|
74767e9704 | ||
|
|
280a7f71c6 | ||
|
|
3168c79b05 | ||
|
|
b6028aa34e | ||
|
|
eee102f4ee | ||
|
|
7fe58c450c | ||
|
|
5bdc532007 | ||
|
|
9160abc5c5 | ||
|
|
1b42fee4f0 | ||
|
|
2faabba4a4 | ||
|
|
5510aabe91 | ||
|
|
79b78a4b9d | ||
|
|
6abd351b76 | ||
|
|
d4aa5c8cc0 | ||
|
|
1b16370e83 | ||
|
|
69a1d87f46 | ||
|
|
21df723fca | ||
|
|
bc6f4b7e31 | ||
|
|
be2fba6057 | ||
|
|
50b301fc14 | ||
|
|
c1f02f6f09 | ||
|
|
29221d1926 | ||
|
|
2ca8c10a49 | ||
|
|
8bf1391cac | ||
|
|
8f44525dd8 | ||
|
|
6c3f8c2092 | ||
|
|
88b9c7130e | ||
|
|
06442fd319 | ||
|
|
6a82e5d232 | ||
|
|
c13311dacb | ||
|
|
b4d51f2202 | ||
|
|
f9a646879b | ||
|
|
8eeaea0c58 | ||
|
|
370636b183 | ||
|
|
97eb2e7f8d | ||
|
|
78c572bbc3 | ||
|
|
c8a8f026ca | ||
|
|
597baf46fc | ||
|
|
1a7b33cf9d | ||
|
|
e992cafbca | ||
|
|
7cd82420c2 | ||
|
|
a4eb486982 | ||
|
|
0f651657c1 | ||
|
|
b30aa8f087 | ||
|
|
fd2122886a | ||
|
|
cae9f68eff | ||
|
|
02bfd5749f | ||
|
|
fe1299e5da | ||
|
|
b01187b472 | ||
|
|
4bbb3c9203 | ||
|
|
0e31aae24d | ||
|
|
d1f549f670 | ||
|
|
54205481df | ||
|
|
f7fe5728ce | ||
|
|
4d7478002d | ||
|
|
6b60008e50 | ||
|
|
c902eacbe9 | ||
|
|
0036aaac89 | ||
|
|
21ece5e0ed | ||
|
|
5c8b63c773 | ||
|
|
5c42c794d3 | ||
|
|
309ffa5565 | ||
|
|
7731658ec9 | ||
|
|
5017ec08bb | ||
|
|
8d7c759e11 | ||
|
|
9a7b3f80b2 | ||
|
|
db9ba9378f | ||
|
|
60d757c5a4 | ||
|
|
f837394d59 | ||
|
|
96db015f7b | ||
|
|
c70664772b | ||
|
|
fcc210d34e | ||
|
|
caa1e6339d | ||
|
|
db40be7a17 | ||
|
|
31fd152cc6 | ||
|
|
ca7b269dc8 | ||
|
|
94dff9b23f | ||
|
|
8855a3d6c4 | ||
|
|
ae5d8a6fae | ||
|
|
be6cf38b31 | ||
|
|
fadb4082b0 | ||
|
|
d47b2e4612 | ||
|
|
0dea8d7df8 | ||
|
|
01117ef986 | ||
|
|
98bd872f3c | ||
|
|
523cd6291b | ||
|
|
e83ed8b345 | ||
|
|
fc56e0e008 | ||
|
|
1e9c933b20 | ||
|
|
79f0dfeafa | ||
|
|
0c4fbbff02 | ||
|
|
204d181fad | ||
|
|
4c00c5c29c | ||
|
|
a5350112fb | ||
|
|
eeedc3e00e | ||
|
|
ff9db0dc80 | ||
|
|
85f0a4c1a7 | ||
|
|
e1affdc8f7 | ||
|
|
d9a1302095 | ||
|
|
9dce0a4ac7 | ||
|
|
15ba8fb5ab | ||
|
|
69321d1dda | ||
|
|
efcbfbefc2 | ||
|
|
b65ac342c0 | ||
|
|
d0d1676fcc | ||
|
|
f13d02da8c | ||
|
|
ac0e88403c | ||
|
|
976b847ca1 | ||
|
|
b0a6609e7a | ||
|
|
5ff6298956 | ||
|
|
718c649e06 | ||
|
|
1451ec389b | ||
|
|
e1f8314fd7 | ||
|
|
31932039fc | ||
|
|
c71bd1e681 | ||
|
|
9ce03290cc | ||
|
|
1e1030e5ef | ||
|
|
718cdd6c65 | ||
|
|
5dbe8d3539 | ||
|
|
eabb77e9bc | ||
|
|
6f4ff9b30f | ||
|
|
000bf3a365 | ||
|
|
ce36163317 | ||
|
|
2a4923faa6 | ||
|
|
dfe281bbf4 | ||
|
|
5452195e33 | ||
|
|
8df220e6a4 | ||
|
|
894a0d54e5 | ||
|
|
4db2ef0f33 | ||
|
|
8643854656 | ||
|
|
7489d8ff2d | ||
|
|
fbe83d8738 | ||
|
|
7bc11370e6 | ||
|
|
dc354527dc | ||
|
|
30edfaeb06 | ||
|
|
24b5515d4f | ||
|
|
0b75989e37 | ||
|
|
457c7ed867 | ||
|
|
d3a0f26c84 | ||
|
|
30f96ffe48 | ||
|
|
9830b8bb22 | ||
|
|
f2d72feab8 | ||
|
|
d2bc43f543 | ||
|
|
60b9b7ef82 | ||
|
|
cfb86ecfc6 | ||
|
|
651102302a | ||
|
|
156429b56a | ||
|
|
cebb1b3068 | ||
|
|
1243dab84d | ||
|
|
5bd00ecceb | ||
|
|
d65e3c8f4e | ||
|
|
c4ce15b33d | ||
|
|
7eebebff0c | ||
|
|
4b40817158 | ||
|
|
c93a15c19d | ||
|
|
009d84cc8f | ||
|
|
64b278f74e | ||
|
|
285bffbffd | ||
|
|
a2cc7980e4 | ||
|
|
c6f12bdf29 | ||
|
|
6ca03fc600 | ||
|
|
8ada7f868b | ||
|
|
17e3c69694 | ||
|
|
4734fb0044 | ||
|
|
e249971122 | ||
|
|
407795da51 | ||
|
|
4e73d06135 | ||
|
|
29efc9650d | ||
|
|
0eb7ad2032 | ||
|
|
e79e35219e | ||
|
|
e374f8fd6a | ||
|
|
7a00499cc9 | ||
|
|
29f92595bf | ||
|
|
0e9b28f7fb | ||
|
|
f47d9432a0 | ||
|
|
0241b95b71 | ||
|
|
6ec1935ccb | ||
|
|
093f04510f | ||
|
|
fdfe99cdb2 | ||
|
|
6cb955e8e6 | ||
|
|
8247e0b058 | ||
|
|
303ad716b6 | ||
|
|
5c5ab4b0c9 | ||
|
|
fac1a07248 | ||
|
|
611a3735b5 | ||
|
|
23ddb21992 | ||
|
|
6383fd550a | ||
|
|
dceec3fac0 | ||
|
|
8f208fd0c0 | ||
|
|
1b249261f3 | ||
|
|
d9b9b76785 | ||
|
|
e6f5608739 | ||
|
|
871534b64b | ||
|
|
62dc1fdf04 | ||
|
|
e818c42e1c | ||
|
|
5bd115a12e | ||
|
|
2e21cf9cc7 | ||
|
|
38eeba213a | ||
|
|
4bd9aae42b | ||
|
|
b5b0b4d150 | ||
|
|
c8ec6573bc | ||
|
|
9fac48f089 | ||
|
|
c73823095d | ||
|
|
1db39dfea9 | ||
|
|
989eb18f5d | ||
|
|
d78b2b6af9 | ||
|
|
9cb32917a5 | ||
|
|
2c62a152fb | ||
|
|
ead3022f5b | ||
|
|
5c8190f2ad | ||
|
|
f327ddf6ad | ||
|
|
40fe00a65c | ||
|
|
1cf1f4ef9a | ||
|
|
7f20e696b6 | ||
|
|
3bffba71c0 | ||
|
|
6d2153d703 | ||
|
|
6897e4e0fa | ||
|
|
e2e03ced38 | ||
|
|
bf73313e42 | ||
|
|
6fa8029146 | ||
|
|
b2146b8aa3 | ||
|
|
27bc69a6df | ||
|
|
6b3109d161 | ||
|
|
d3290e761b | ||
|
|
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 | ||
|
|
dbe4d156fe | ||
|
|
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
|
||||
@@ -327,6 +289,7 @@ build_component_ut_esp32c3:
|
||||
needs:
|
||||
- job: fast_template_app
|
||||
artifacts: false
|
||||
optional: true
|
||||
script:
|
||||
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
|
||||
- rm -rf test_build_system
|
||||
@@ -344,15 +307,27 @@ test_build_system_cmake:
|
||||
variables:
|
||||
SHELL_TEST_SCRIPT: test_build_system_cmake.sh
|
||||
|
||||
test_build_system_cmake_macos:
|
||||
extends:
|
||||
- .test_build_system_template
|
||||
- .before_script_macos
|
||||
- .rules:build:macos
|
||||
tags:
|
||||
- macos_shell
|
||||
variables:
|
||||
SHELL_TEST_SCRIPT: test_build_system_cmake.sh
|
||||
#test_build_system_cmake_macos:
|
||||
# extends:
|
||||
# - .test_build_system_template
|
||||
# - .before_script_macos
|
||||
# - .rules:build:macos
|
||||
# tags:
|
||||
# - macos_shell
|
||||
# variables:
|
||||
# SHELL_TEST_SCRIPT: test_build_system_cmake.sh
|
||||
# script:
|
||||
# - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
|
||||
# - rm -rf test_build_system
|
||||
# - mkdir test_build_system
|
||||
# - cd test_build_system
|
||||
# # copy-paste the script from .test_build_system_template
|
||||
# # since `ESP_IDF_TEMPLATE_GIT` is a group variable and has higher precedence than job variable
|
||||
# # export here to override the group variable
|
||||
# #
|
||||
# # Clone the template app from github for macos runners
|
||||
# - export ESP_IDF_TEMPLATE_GIT="https://github.com/espressif/esp-idf-template.git"
|
||||
# - ${IDF_PATH}/tools/ci/${SHELL_TEST_SCRIPT}
|
||||
|
||||
build_docker:
|
||||
extends:
|
||||
|
||||
@@ -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,9 +1,11 @@
|
||||
# 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
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
# note: whitespace exclusions use multiline regex, see https://pre-commit.com/#regular-expressions
|
||||
@@ -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"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "esp_freertos_hooks.h"
|
||||
#include "esp_private/dbg_stubs.h"
|
||||
#include "esp_ipc.h"
|
||||
#include "esp_attr.h"
|
||||
#include "hal/wdt_hal.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "esp32/rom/libc_stubs.h"
|
||||
@@ -80,6 +81,7 @@ void gcov_create_task(void *arg)
|
||||
xTaskCreatePinnedToCore(&gcov_dump_task, "gcov_dump_task", 2048, (void *)&s_gcov_task_running, configMAX_PRIORITIES - 1, NULL, 0);
|
||||
}
|
||||
|
||||
static IRAM_ATTR
|
||||
void gcov_create_task_tick_hook(void)
|
||||
{
|
||||
extern esp_err_t esp_ipc_start_gcov_from_isr(uint32_t cpu_id, esp_ipc_func_t func, void* arg);
|
||||
|
||||
@@ -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"
|
||||
@@ -383,6 +415,21 @@ menu "Bootloader config"
|
||||
(The application and bootoloader must be compiled with the same option).
|
||||
The RTC FAST memory has access only through PRO_CPU.
|
||||
|
||||
config BOOTLOADER_CUSTOM_RESERVE_RTC_IN_CRC
|
||||
bool "Include custom memory in the CRC calculation"
|
||||
depends on BOOTLOADER_CUSTOM_RESERVE_RTC
|
||||
default n
|
||||
help
|
||||
This option allows the customer to use the legacy bootloader behavior when the
|
||||
RTC FAST memory CRC calculation takes place. When this option is enabled, the
|
||||
allocated user custom data will be taken into account in the CRC calculcation.
|
||||
This means that any change to the custom data would need a CRC update to prevent
|
||||
the bootloader from marking this data as corrupted.
|
||||
If this option is disabled, the custom data will not be taken into account when
|
||||
calculating the RTC FAST memory CRC. The user custom data can be changed freely,
|
||||
without the need to update the CRC.
|
||||
THIS OPTION MUST BE THE SAME FOR BOTH THE BOOTLOADER AND THE APPLICATION BUILDS.
|
||||
|
||||
config BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE
|
||||
hex "Size in bytes for custom purposes"
|
||||
default 0
|
||||
@@ -393,14 +440,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,
|
||||
|
||||
@@ -168,7 +168,7 @@ SOC_RESERVE_MEMORY_REGION(RTC_RETAIN_MEM_ADDR, RTC_RETAIN_MEM_ADDR + sizeof(rtc_
|
||||
#endif
|
||||
|
||||
static uint32_t rtc_retain_mem_size(void) {
|
||||
#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
|
||||
#if CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC && !CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_IN_CRC
|
||||
/* A custom memory has been reserved by the user, do not consider this memory into CRC calculation as it may change without
|
||||
* the have the user updating the CRC. Return the offset of the custom field, which is equivalent to size of the structure
|
||||
* minus the size of everything after (including) `custom` */
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -25,10 +25,13 @@ if(CONFIG_BT_ENABLED)
|
||||
list(APPEND include_dirs
|
||||
common/api/include/api
|
||||
common/btc/profile/esp/blufi/include
|
||||
common/btc/profile/esp/include)
|
||||
common/btc/profile/esp/include
|
||||
common/hci_log/include)
|
||||
|
||||
|
||||
list(APPEND srcs "common/btc/core/btc_alarm.c"
|
||||
"common/api/esp_blufi_api.c"
|
||||
"common/hci_log/bt_hci_log.c"
|
||||
"common/btc/core/btc_manage.c"
|
||||
"common/btc/core/btc_task.c"
|
||||
"common/btc/profile/esp/blufi/blufi_prf.c"
|
||||
|
||||
@@ -57,6 +57,37 @@ menu "Bluetooth"
|
||||
source "$IDF_PATH/components/bt/host/nimble/Kconfig.in"
|
||||
endmenu
|
||||
|
||||
config BT_HCI_LOG_DEBUG_EN
|
||||
depends on BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED
|
||||
bool "Enable Bluetooth HCI debug mode"
|
||||
default n
|
||||
help
|
||||
This option is used to enable bluetooth debug mode, which saves the hci layer data stream.
|
||||
|
||||
config BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
depends on BT_HCI_LOG_DEBUG_EN
|
||||
int "Size of the cache used for HCI data in Bluetooth HCI debug mode (N*1024 bytes)"
|
||||
range 1 100
|
||||
default 5
|
||||
help
|
||||
This option is to configure the buffer size of the hci data steam cache in hci debug mode.
|
||||
This is a ring buffer, the new data will overwrite the oldest data if the buffer is full.
|
||||
|
||||
config BT_HCI_LOG_ADV_BUFFER_SIZE
|
||||
depends on BT_HCI_LOG_DEBUG_EN
|
||||
int "Size of the cache used for adv report in Bluetooth HCI debug mode (N*1024 bytes)"
|
||||
range 1 100
|
||||
default 8
|
||||
help
|
||||
This option is to configure the buffer size of the hci adv report cache in hci debug mode.
|
||||
This is a ring buffer, the new data will overwrite the oldest data if the buffer is full.
|
||||
|
||||
menu "Common Options"
|
||||
visible if (BT_BLUEDROID_ENABLED || BT_NIMBLE_ENABLED)
|
||||
|
||||
source "$IDF_PATH/components/bt/common/Kconfig.in"
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
||||
menuconfig BLE_MESH
|
||||
|
||||
6
components/bt/common/Kconfig.in
Normal file
6
components/bt/common/Kconfig.in
Normal file
@@ -0,0 +1,6 @@
|
||||
config BT_ALARM_MAX_NUM
|
||||
int "Maximum number of Bluetooth alarms"
|
||||
default 50
|
||||
help
|
||||
This option decides the maximum number of alarms which
|
||||
could be used by Bluetooth host.
|
||||
@@ -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-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -331,6 +323,13 @@ static void btc_deinit_mem(void) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BTC_HF_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||
if (hf_local_param_ptr) {
|
||||
osi_free(hf_local_param_ptr);
|
||||
hf_local_param_ptr = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BTC_HF_CLIENT_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||
if (hf_client_local_param_ptr) {
|
||||
osi_free(hf_client_local_param_ptr);
|
||||
@@ -386,6 +385,13 @@ static bt_status_t btc_init_mem(void) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BTC_HF_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||
if ((hf_local_param_ptr = (hf_local_param_t *)osi_malloc(BTC_HF_NUM_CB * sizeof(hf_local_param_t))) == NULL) {
|
||||
goto error_exit;
|
||||
}
|
||||
memset((void *)hf_local_param_ptr, 0, BTC_HF_NUM_CB * sizeof(hf_local_param_t));
|
||||
#endif
|
||||
|
||||
#if BTC_HF_CLIENT_INCLUDED == TRUE && HFP_DYNAMIC_MEMORY == TRUE
|
||||
if ((hf_client_local_param_ptr = (hf_client_local_param_t *)osi_malloc(sizeof(hf_client_local_param_t))) == NULL) {
|
||||
goto error_exit;
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
// 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-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __BLUFI_INT_H__
|
||||
#define __BLUFI_INT_H__
|
||||
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_blufi_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if (BLUFI_INCLUDED == TRUE)
|
||||
|
||||
#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
|
||||
@@ -201,5 +198,10 @@ void btc_blufi_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
void btc_blufi_cb_deep_free(btc_msg_t *msg);
|
||||
|
||||
#endif /* __BLUFI_INT_H__ */
|
||||
#endif ///BLUFI_INCLUDED == TRUE
|
||||
#endif ///BLUFI_INCLUDED == TRUE
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BLUFI_INT_H__ */
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_BLUFI_H__
|
||||
#define __ESP_BLUFI_H__
|
||||
|
||||
@@ -13,6 +19,10 @@
|
||||
#include "esp_gap_ble_api.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BLUFI_APP_UUID 0xFFFF
|
||||
#define BLUFI_DEVICE_NAME "BLUFI_DEVICE"
|
||||
|
||||
@@ -74,4 +84,7 @@ void esp_blufi_adv_start(void);
|
||||
|
||||
void esp_blufi_send_encap(void *arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif/* _ESP_BLUFI_ */
|
||||
|
||||
@@ -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-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __BTC_BLUFI_PRF_H__
|
||||
#define __BTC_BLUFI_PRF_H__
|
||||
@@ -29,6 +21,11 @@
|
||||
#define ESP_BLUFI_SUCCESS 0x00
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
|
||||
|
||||
@@ -108,4 +105,7 @@ void btc_blufi_call_deep_free(btc_msg_t *msg);
|
||||
|
||||
uint16_t btc_blufi_get_version(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __BTC_BLUFI_PRF_H__ */
|
||||
|
||||
334
components/bt/common/hci_log/bt_hci_log.c
Normal file
334
components/bt/common/hci_log/bt_hci_log.c
Normal file
@@ -0,0 +1,334 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "hci_log/bt_hci_log.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/mutex.h"
|
||||
#include "esp_attr.h"
|
||||
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
#define BT_HCI_LOG_PRINT_TAG (1)
|
||||
#define BT_HCI_LOG_DATA_BUF_SIZE (1024 * HCI_LOG_DATA_BUFFER_SIZE)
|
||||
#define BT_HCI_LOG_ADV_BUF_SIZE (1024 * HCI_LOG_ADV_BUFFER_SIZE)
|
||||
|
||||
typedef struct {
|
||||
osi_mutex_t mutex_lock;
|
||||
uint64_t log_record_in;
|
||||
uint64_t log_record_out;
|
||||
uint64_t buf_size;
|
||||
uint8_t *p_hci_log_buffer;
|
||||
uint8_t index;
|
||||
bool overflow;
|
||||
} bt_hci_log_t;
|
||||
|
||||
static const char s_hex_to_char_mapping[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||
};
|
||||
|
||||
bt_hci_log_t g_bt_hci_log_data_ctl = {0};
|
||||
bt_hci_log_t g_bt_hci_log_adv_ctl = {0};
|
||||
|
||||
esp_err_t bt_hci_log_init(void)
|
||||
{
|
||||
uint8_t *g_bt_hci_log_data_buffer = NULL;
|
||||
uint8_t *g_bt_hci_log_adv_buffer = NULL;
|
||||
|
||||
g_bt_hci_log_data_buffer = malloc(BT_HCI_LOG_DATA_BUF_SIZE);
|
||||
if (!g_bt_hci_log_data_buffer) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
g_bt_hci_log_adv_buffer = malloc(BT_HCI_LOG_ADV_BUF_SIZE);
|
||||
if (!g_bt_hci_log_adv_buffer) {
|
||||
if (g_bt_hci_log_data_buffer) {
|
||||
free(g_bt_hci_log_data_buffer);
|
||||
g_bt_hci_log_data_buffer = NULL;
|
||||
}
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
memset(g_bt_hci_log_data_buffer, 0, BT_HCI_LOG_DATA_BUF_SIZE);
|
||||
memset(g_bt_hci_log_adv_buffer, 0, BT_HCI_LOG_ADV_BUF_SIZE);
|
||||
|
||||
memset(&g_bt_hci_log_data_ctl, 0, sizeof(bt_hci_log_t));
|
||||
g_bt_hci_log_data_ctl.buf_size = BT_HCI_LOG_DATA_BUF_SIZE;
|
||||
g_bt_hci_log_data_ctl.p_hci_log_buffer = g_bt_hci_log_data_buffer;
|
||||
|
||||
memset(&g_bt_hci_log_adv_ctl, 0, sizeof(bt_hci_log_t));
|
||||
g_bt_hci_log_adv_ctl.buf_size = BT_HCI_LOG_ADV_BUF_SIZE;
|
||||
g_bt_hci_log_adv_ctl.p_hci_log_buffer = g_bt_hci_log_adv_buffer;
|
||||
|
||||
osi_mutex_new((osi_mutex_t *)&g_bt_hci_log_data_ctl.mutex_lock);
|
||||
osi_mutex_new((osi_mutex_t *)&g_bt_hci_log_adv_ctl.mutex_lock);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t bt_hci_log_deinit(void)
|
||||
{
|
||||
if (g_bt_hci_log_data_ctl.p_hci_log_buffer) {
|
||||
free(g_bt_hci_log_data_ctl.p_hci_log_buffer);
|
||||
g_bt_hci_log_data_ctl.p_hci_log_buffer = NULL;
|
||||
}
|
||||
|
||||
if (g_bt_hci_log_adv_ctl.p_hci_log_buffer) {
|
||||
free(g_bt_hci_log_adv_ctl.p_hci_log_buffer);
|
||||
g_bt_hci_log_adv_ctl.p_hci_log_buffer = NULL;
|
||||
}
|
||||
|
||||
osi_mutex_free((osi_mutex_t *)&g_bt_hci_log_data_ctl.mutex_lock);
|
||||
osi_mutex_free((osi_mutex_t *)&g_bt_hci_log_adv_ctl.mutex_lock);
|
||||
|
||||
memset(&g_bt_hci_log_data_ctl, 0, sizeof(bt_hci_log_t));
|
||||
memset(&g_bt_hci_log_adv_ctl, 0, sizeof(bt_hci_log_t));
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if (BT_HCI_LOG_PRINT_TAG)
|
||||
static char IRAM_ATTR *bt_data_type_to_str(uint8_t data_type)
|
||||
{
|
||||
char *tag = NULL;
|
||||
switch (data_type)
|
||||
{
|
||||
case HCI_LOG_DATA_TYPE_COMMAND:
|
||||
// hci cmd data
|
||||
tag = "CMD";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_H2C_ACL:
|
||||
// host to controller hci acl data
|
||||
tag = "HAL";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_SCO:
|
||||
// hci sco data
|
||||
tag = "SCO";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_EVENT:
|
||||
// hci event
|
||||
tag = "EVT";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_ADV:
|
||||
// controller adv report data
|
||||
tag = "ADV";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_C2H_ACL:
|
||||
// controller to host hci acl data
|
||||
tag = "CAL";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_SELF_DEFINE:
|
||||
// self-defining data
|
||||
tag = "ST";
|
||||
break;
|
||||
default:
|
||||
// unknown data type
|
||||
tag = "UK";
|
||||
break;
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
#endif
|
||||
|
||||
void bt_hci_log_record_hex(bt_hci_log_t *p_hci_log_ctl, uint8_t *hex, uint8_t hex_len)
|
||||
{
|
||||
uint8_t hci_log_char;
|
||||
uint8_t *g_hci_log_buffer;
|
||||
|
||||
g_hci_log_buffer = p_hci_log_ctl->p_hci_log_buffer;
|
||||
|
||||
while (hex_len--)
|
||||
{
|
||||
hci_log_char = ((*hex) >> 4);
|
||||
|
||||
g_hci_log_buffer[p_hci_log_ctl->log_record_in] = s_hex_to_char_mapping [hci_log_char];
|
||||
|
||||
if (++ p_hci_log_ctl->log_record_in >= p_hci_log_ctl->buf_size) {
|
||||
p_hci_log_ctl->log_record_in = 0;
|
||||
}
|
||||
if (p_hci_log_ctl->log_record_in == p_hci_log_ctl->log_record_out) {
|
||||
p_hci_log_ctl->overflow = true;
|
||||
}
|
||||
|
||||
hci_log_char = ((*hex) & 0x0f);
|
||||
|
||||
g_hci_log_buffer[p_hci_log_ctl->log_record_in] = s_hex_to_char_mapping [hci_log_char];
|
||||
|
||||
if (++p_hci_log_ctl->log_record_in >= p_hci_log_ctl->buf_size) {
|
||||
p_hci_log_ctl->log_record_in = 0;
|
||||
}
|
||||
|
||||
if (p_hci_log_ctl->log_record_in == p_hci_log_ctl->log_record_out) {
|
||||
p_hci_log_ctl->overflow = true;
|
||||
}
|
||||
|
||||
g_hci_log_buffer[p_hci_log_ctl->log_record_in] = ' ';
|
||||
|
||||
if (++ p_hci_log_ctl->log_record_in >= p_hci_log_ctl->buf_size) {
|
||||
p_hci_log_ctl->log_record_in = 0;
|
||||
}
|
||||
if (p_hci_log_ctl->log_record_in == p_hci_log_ctl->log_record_out) {
|
||||
p_hci_log_ctl->overflow = true;
|
||||
}
|
||||
|
||||
++ hex;
|
||||
}
|
||||
}
|
||||
|
||||
void bt_hci_log_record_string(bt_hci_log_t *p_hci_log_ctl, char *string)
|
||||
{
|
||||
uint8_t *g_hci_log_buffer;
|
||||
|
||||
g_hci_log_buffer = p_hci_log_ctl->p_hci_log_buffer;
|
||||
|
||||
while (*string != '\0') {
|
||||
g_hci_log_buffer[p_hci_log_ctl->log_record_in] = *string;
|
||||
++string;
|
||||
|
||||
if (++p_hci_log_ctl->log_record_in >= p_hci_log_ctl->buf_size) {
|
||||
p_hci_log_ctl->log_record_in = 0;
|
||||
}
|
||||
|
||||
if (p_hci_log_ctl->log_record_in == p_hci_log_ctl->log_record_out) {
|
||||
p_hci_log_ctl->overflow = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t IRAM_ATTR bt_hci_log_record_data(bt_hci_log_t *p_hci_log_ctl, char *str, uint8_t data_type, uint8_t *data, uint8_t data_len)
|
||||
{
|
||||
osi_mutex_t mutex_lock;
|
||||
uint8_t *g_hci_log_buffer;
|
||||
|
||||
if (!p_hci_log_ctl->p_hci_log_buffer) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
g_hci_log_buffer = p_hci_log_ctl->p_hci_log_buffer;
|
||||
|
||||
if (!g_hci_log_buffer) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
mutex_lock = p_hci_log_ctl->mutex_lock;
|
||||
osi_mutex_lock(&mutex_lock, OSI_MUTEX_MAX_TIMEOUT);
|
||||
|
||||
#if (1)
|
||||
// Add hci data index
|
||||
bt_hci_log_record_hex(p_hci_log_ctl, &p_hci_log_ctl->index, 1);
|
||||
#endif
|
||||
|
||||
#if (BT_HCI_LOG_PRINT_TAG)
|
||||
char *tag = NULL;
|
||||
tag = bt_data_type_to_str(data_type);
|
||||
|
||||
if (tag) {
|
||||
bt_hci_log_record_string(p_hci_log_ctl, tag);
|
||||
|
||||
g_hci_log_buffer[p_hci_log_ctl->log_record_in] = ':';
|
||||
|
||||
if (++p_hci_log_ctl->log_record_in >= p_hci_log_ctl->buf_size) {
|
||||
p_hci_log_ctl->log_record_in = 0;
|
||||
}
|
||||
|
||||
if (p_hci_log_ctl->log_record_in == p_hci_log_ctl->log_record_out) {
|
||||
p_hci_log_ctl->overflow = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (str) {
|
||||
bt_hci_log_record_string(p_hci_log_ctl, str);
|
||||
}
|
||||
|
||||
bt_hci_log_record_hex(p_hci_log_ctl, data, data_len);
|
||||
|
||||
g_hci_log_buffer[p_hci_log_ctl->log_record_in] = '\n';
|
||||
|
||||
if (++p_hci_log_ctl->log_record_in >= p_hci_log_ctl->buf_size) {
|
||||
p_hci_log_ctl->log_record_in = 0;
|
||||
}
|
||||
|
||||
if (p_hci_log_ctl->log_record_in == p_hci_log_ctl->log_record_out) {
|
||||
p_hci_log_ctl->overflow = true;
|
||||
}
|
||||
|
||||
p_hci_log_ctl->index ++;
|
||||
|
||||
osi_mutex_unlock(&mutex_lock);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void bt_hci_log_data_show(bt_hci_log_t *p_hci_log_ctl)
|
||||
{
|
||||
volatile uint64_t log_record_in,log_record_out;
|
||||
uint8_t *g_hci_log_buffer;
|
||||
|
||||
if (!p_hci_log_ctl->p_hci_log_buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
osi_mutex_t mutex_lock = p_hci_log_ctl->mutex_lock;
|
||||
|
||||
osi_mutex_lock(&mutex_lock, OSI_MUTEX_MAX_TIMEOUT);
|
||||
|
||||
log_record_in = p_hci_log_ctl->log_record_in;
|
||||
log_record_out = p_hci_log_ctl->log_record_out;
|
||||
|
||||
g_hci_log_buffer = p_hci_log_ctl->p_hci_log_buffer;
|
||||
|
||||
if (p_hci_log_ctl->overflow) {
|
||||
log_record_out = log_record_in;
|
||||
printf("%c",g_hci_log_buffer[log_record_out]);
|
||||
|
||||
if (++log_record_out >= p_hci_log_ctl->buf_size) {
|
||||
log_record_out = 0;
|
||||
}
|
||||
}
|
||||
|
||||
while (log_record_in != log_record_out)
|
||||
{
|
||||
printf("%c",g_hci_log_buffer[log_record_out]);
|
||||
|
||||
if (++log_record_out >= p_hci_log_ctl->buf_size) {
|
||||
log_record_out = 0;
|
||||
}
|
||||
}
|
||||
|
||||
p_hci_log_ctl->log_record_out = log_record_out;
|
||||
p_hci_log_ctl->overflow = false;
|
||||
|
||||
osi_mutex_unlock(&mutex_lock);
|
||||
}
|
||||
|
||||
esp_err_t IRAM_ATTR bt_hci_log_record_hci_data(uint8_t data_type, uint8_t *data, uint8_t data_len)
|
||||
{
|
||||
return bt_hci_log_record_data(&g_bt_hci_log_data_ctl, NULL, data_type, data, data_len);
|
||||
}
|
||||
|
||||
esp_err_t IRAM_ATTR bt_hci_log_record_custom_data(char *string, uint8_t *data, uint8_t data_len)
|
||||
{
|
||||
return bt_hci_log_record_data(&g_bt_hci_log_data_ctl, string, HCI_LOG_DATA_TYPE_SELF_DEFINE, data, data_len);
|
||||
}
|
||||
|
||||
esp_err_t IRAM_ATTR bt_hci_log_record_hci_adv(uint8_t data_type, uint8_t *data, uint8_t data_len)
|
||||
{
|
||||
return bt_hci_log_record_data(&g_bt_hci_log_adv_ctl, NULL, data_type, data, data_len);
|
||||
}
|
||||
|
||||
void bt_hci_log_hci_data_show(void)
|
||||
{
|
||||
bt_hci_log_data_show(&g_bt_hci_log_data_ctl);
|
||||
}
|
||||
|
||||
void bt_hci_log_hci_adv_show(void)
|
||||
{
|
||||
bt_hci_log_data_show(&g_bt_hci_log_adv_ctl);
|
||||
}
|
||||
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
108
components/bt/common/hci_log/include/hci_log/bt_hci_log.h
Normal file
108
components/bt/common/hci_log/include/hci_log/bt_hci_log.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_BT_HCI_LOG_H__
|
||||
#define __ESP_BT_HCI_LOG_H__
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define HCI_LOG_DATA_TYPE_COMMAND (1)
|
||||
#define HCI_LOG_DATA_TYPE_H2C_ACL (2)
|
||||
#define HCI_LOG_DATA_TYPE_SCO (3)
|
||||
#define HCI_LOG_DATA_TYPE_EVENT (4)
|
||||
#define HCI_LOG_DATA_TYPE_ADV (5)
|
||||
#define HCI_LOG_DATA_TYPE_SELF_DEFINE (6)
|
||||
#define HCI_LOG_DATA_TYPE_C2H_ACL (7)
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to record self-defining data
|
||||
* @param string : data identification
|
||||
* @param data : data
|
||||
* @param data_len : the length of data
|
||||
*
|
||||
* @return ESP_OK - success, other - failed
|
||||
*
|
||||
*/
|
||||
esp_err_t bt_hci_log_record_custom_data(char *string, uint8_t *data, uint8_t data_len);
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to print all hci data record
|
||||
*
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
*/
|
||||
void bt_hci_log_hci_data_show(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to print all adv report
|
||||
*
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
*/
|
||||
void bt_hci_log_hci_adv_show(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to init hci log env
|
||||
*
|
||||
*
|
||||
* @return ESP_OK - success, other - failed
|
||||
*
|
||||
*/
|
||||
esp_err_t bt_hci_log_init(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to deinit hci debug mode,
|
||||
* and can only be called internally by Bluetooth
|
||||
*
|
||||
*
|
||||
* @return ESP_OK - success, other - failed
|
||||
*
|
||||
*/
|
||||
esp_err_t bt_hci_log_deinit(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to record hci data without adv report event,
|
||||
* and can only be called internally by Bluetooth
|
||||
*
|
||||
* @param str : data type, define in bt_data_type_to_str()
|
||||
* @param data : data
|
||||
* @param data_len : the length of data
|
||||
*
|
||||
* @return ESP_OK - success, other - failed
|
||||
*
|
||||
*/
|
||||
esp_err_t bt_hci_log_record_hci_data(uint8_t data_type, uint8_t *data, uint8_t data_len);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to record hci adv report event only
|
||||
* and can only be called internally by Bluetooth
|
||||
*
|
||||
* @param str : data type, define in bt_data_type_to_str()
|
||||
* @param data : data
|
||||
* @param data_len : the length of data
|
||||
* @return ESP_OK - success, other - failed
|
||||
*
|
||||
*/
|
||||
esp_err_t bt_hci_log_record_hci_adv(uint8_t data_type, uint8_t *data, uint8_t data_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ESP_BT_HCI_LOG_H__ */
|
||||
@@ -72,6 +72,24 @@
|
||||
#define BT_BLE_DYNAMIC_ENV_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#if UC_BT_HCI_LOG_DEBUG_EN
|
||||
#define BT_HCI_LOG_INCLUDED UC_BT_HCI_LOG_DEBUG_EN
|
||||
#else
|
||||
#define BT_HCI_LOG_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#if UC_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#define HCI_LOG_DATA_BUFFER_SIZE UC_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#else
|
||||
#define HCI_BUFFER_SIZE (5)
|
||||
#endif
|
||||
|
||||
#if UC_BT_HCI_ADV_BUFFER_SIZE
|
||||
#define HCI_LOG_ADV_BUFFER_SIZE UC_BT_HCI_LOG_ADV_BUFFER_SIZE
|
||||
#else
|
||||
#define HCI_LOG_ADV_BUFFER_SIZE (5)
|
||||
#endif
|
||||
|
||||
/* OS Configuration from User config (eg: sdkconfig) */
|
||||
#define TASK_PINNED_TO_CORE UC_TASK_PINNED_TO_CORE
|
||||
#define BT_TASK_MAX_PRIORITIES configMAX_PRIORITIES
|
||||
|
||||
@@ -52,6 +52,15 @@
|
||||
#define UC_BTC_TASK_STACK_SIZE 4096
|
||||
#endif
|
||||
|
||||
/**********************************************************
|
||||
* Alarm reference
|
||||
**********************************************************/
|
||||
#ifdef CONFIG_BT_ALARM_MAX_NUM
|
||||
#define UC_ALARM_MAX_NUM CONFIG_BT_ALARM_MAX_NUM
|
||||
#else
|
||||
#define UC_ALARM_MAX_NUM 50
|
||||
#endif
|
||||
|
||||
/**********************************************************
|
||||
* Trace reference
|
||||
**********************************************************/
|
||||
@@ -100,4 +109,22 @@
|
||||
#define UC_BT_BLUEDROID_MEM_DEBUG FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCI_LOG_DEBUG_EN
|
||||
#define UC_BT_HCI_LOG_DEBUG_EN TRUE
|
||||
#else
|
||||
#define UC_BT_HCI_LOG_DEBUG_EN FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#define UC_BT_HCI_LOG_DATA_BUFFER_SIZE CONFIG_BT_HCI_LOG_DATA_BUFFER_SIZE
|
||||
#else
|
||||
#define UC_BT_HCI_LOG_DATA_BUFFER_SIZE (5)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_HCI_LOG_ADV_BUFFER_SIZE
|
||||
#define UC_BT_HCI_LOG_ADV_BUFFER_SIZE CONFIG_BT_HCI_LOG_ADV_BUFFER_SIZE
|
||||
#else
|
||||
#define UC_BT_HCI_LOG_ADV_BUFFER_SIZE (5)
|
||||
#endif
|
||||
|
||||
#endif /* __BT_USER_CONFIG_H__ */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "esp_timer.h"
|
||||
#include "bt_user_config.h"
|
||||
|
||||
typedef struct alarm_t osi_alarm_t;
|
||||
typedef uint64_t period_ms_t;
|
||||
@@ -33,7 +34,7 @@ typedef enum {
|
||||
OSI_ALARM_ERR_INVALID_STATE = -3,
|
||||
} osi_alarm_err_t;
|
||||
|
||||
#define ALARM_CBS_NUM 50
|
||||
#define ALARM_CBS_NUM UC_ALARM_MAX_NUM
|
||||
#define ALARM_ID_BASE 1000
|
||||
|
||||
int osi_alarm_create_mux(void);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -172,7 +172,7 @@ config BTDM_CTRL_PINNED_TO_CORE
|
||||
choice BTDM_CTRL_HCI_MODE_CHOICE
|
||||
prompt "HCI mode"
|
||||
help
|
||||
Speicify HCI mode as VHCI or UART(H4)
|
||||
Specify HCI mode as VHCI or UART(H4)
|
||||
|
||||
config BTDM_CTRL_HCI_MODE_VHCI
|
||||
bool "VHCI"
|
||||
@@ -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)"
|
||||
@@ -393,6 +398,14 @@ config BTDM_CTRL_FULL_SCAN_SUPPORTED
|
||||
The full scan function is mainly used to provide BLE scan performance.
|
||||
This is required for scenes with high scan performance requirements, such as BLE Mesh scenes.
|
||||
|
||||
config BTDM_CTRL_SCAN_BACKOFF_UPPERLIMITMAX
|
||||
bool "Disable active scan backoff"
|
||||
default n
|
||||
help
|
||||
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 BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
|
||||
bool "BLE adv report flow control supported"
|
||||
depends on (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ do{\
|
||||
} while(0)
|
||||
|
||||
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
|
||||
#define OSI_VERSION 0x00010004
|
||||
#define OSI_VERSION 0x00010005
|
||||
#define OSI_MAGIC_VALUE 0xFADEBEAD
|
||||
|
||||
/* Types definition
|
||||
@@ -176,6 +176,7 @@ struct osi_funcs_t {
|
||||
void (*_interrupt_l3_restore)(void);
|
||||
void *(* _customer_queue_create)(uint32_t queue_len, uint32_t item_size);
|
||||
int (* _coex_version_get)(unsigned int *major, unsigned int *minor, unsigned int *patch);
|
||||
void (* _patch_apply)(void);
|
||||
uint32_t _magic;
|
||||
};
|
||||
|
||||
@@ -234,6 +235,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;
|
||||
@@ -244,16 +247,16 @@ extern uint32_t _data_end_btdm_rom;
|
||||
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _nimble_bss_start;
|
||||
extern uint32_t _nimble_bss_end;
|
||||
extern uint32_t _btdm_bss_start;
|
||||
extern uint32_t _btdm_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
extern uint32_t _bt_controller_bss_end;
|
||||
extern uint32_t _bt_data_start;
|
||||
extern uint32_t _bt_data_end;
|
||||
extern uint32_t _nimble_data_start;
|
||||
extern uint32_t _nimble_data_end;
|
||||
extern uint32_t _btdm_data_start;
|
||||
extern uint32_t _btdm_data_end;
|
||||
extern uint32_t _bt_controller_data_start;
|
||||
extern uint32_t _bt_controller_data_end;
|
||||
|
||||
extern void config_bt_funcs_reset(void);
|
||||
extern void config_ble_funcs_reset(void);
|
||||
extern void config_btdm_funcs_reset(void);
|
||||
|
||||
/* Local Function Declare
|
||||
*********************************************************************
|
||||
@@ -327,6 +330,7 @@ static void *customer_queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t i
|
||||
static void IRAM_ATTR interrupt_l3_disable(void);
|
||||
static void IRAM_ATTR interrupt_l3_restore(void);
|
||||
static void bt_controller_deinit_internal(void);
|
||||
static void patch_apply(void);
|
||||
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
@@ -414,6 +418,7 @@ static const struct osi_funcs_t osi_funcs_ro = {
|
||||
._customer_queue_create = NULL,
|
||||
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||
._coex_version_get = coex_version_get_wrapper,
|
||||
._patch_apply = patch_apply,
|
||||
._magic = OSI_MAGIC_VALUE,
|
||||
};
|
||||
|
||||
@@ -795,7 +800,7 @@ static int32_t queue_send_hlevel_wrapper(void *queue, void *item, uint32_t block
|
||||
* @param item The message which will be send
|
||||
* @param hptw need do task yield or not
|
||||
* @return send success or not
|
||||
* There is an issue here: When the queue is full, it may reture true but it send fail to the queue, sometimes.
|
||||
* There is an issue here: When the queue is full, it may return true but it send fail to the queue, sometimes.
|
||||
* But in Bluetooth controller's isr, We don't care about the return value.
|
||||
* It only required tp send success when the queue is empty all the time.
|
||||
* So, this function meets the requirement.
|
||||
@@ -1327,7 +1332,45 @@ static esp_err_t try_heap_caps_add_region(intptr_t start, intptr_t end)
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode)
|
||||
typedef struct {
|
||||
intptr_t start;
|
||||
intptr_t end;
|
||||
const char* name;
|
||||
} bt_area_t;
|
||||
|
||||
|
||||
static esp_err_t esp_bt_mem_release_area(const bt_area_t *area)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
intptr_t mem_start = area->start;
|
||||
intptr_t mem_end = area->end;
|
||||
if (mem_start != mem_end) {
|
||||
ESP_LOGD(BTDM_LOG_TAG, "Release %s [0x%08x] - [0x%08x], len %d", area->name, mem_start, mem_end, mem_end - mem_start);
|
||||
ret = try_heap_caps_add_region(mem_start, mem_end);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static esp_err_t esp_bt_mem_release_areas(const bt_area_t *area1, const bt_area_t *area2)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
if (area1->end == area2->start) {
|
||||
bt_area_t merged_area = {
|
||||
.start = area1->start,
|
||||
.end = area2->end,
|
||||
.name = area1->name
|
||||
};
|
||||
ret = esp_bt_mem_release_area(&merged_area);
|
||||
} else {
|
||||
esp_bt_mem_release_area(area1);
|
||||
ret = esp_bt_mem_release_area(area2);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static esp_err_t esp_bt_controller_rom_mem_release(esp_bt_mode_t mode)
|
||||
{
|
||||
bool update = true;
|
||||
intptr_t mem_start=(intptr_t) NULL, mem_end=(intptr_t) NULL;
|
||||
@@ -1378,61 +1421,86 @@ esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode)
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == ESP_BT_MODE_BTDM) {
|
||||
mem_start = (intptr_t)&_btdm_bss_start;
|
||||
mem_end = (intptr_t)&_btdm_bss_end;
|
||||
if (mem_start != mem_end) {
|
||||
ESP_LOGD(BTDM_LOG_TAG, "Release BTDM BSS [0x%08x] - [0x%08x]", mem_start, mem_end);
|
||||
ESP_ERROR_CHECK(try_heap_caps_add_region(mem_start, mem_end));
|
||||
}
|
||||
mem_start = (intptr_t)&_btdm_data_start;
|
||||
mem_end = (intptr_t)&_btdm_data_end;
|
||||
if (mem_start != mem_end) {
|
||||
ESP_LOGD(BTDM_LOG_TAG, "Release BTDM Data [0x%08x] - [0x%08x]", mem_start, mem_end);
|
||||
ESP_ERROR_CHECK(try_heap_caps_add_region(mem_start, mem_end));
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (mode == ESP_BT_MODE_BTDM) {
|
||||
bt_area_t cont_bss = {
|
||||
.start = (intptr_t)&_bt_controller_bss_start,
|
||||
.end = (intptr_t)&_bt_controller_bss_end,
|
||||
.name = "BT Controller BSS",
|
||||
};
|
||||
bt_area_t cont_data = {
|
||||
.start = (intptr_t)&_bt_controller_data_start,
|
||||
.end = (intptr_t)&_bt_controller_data_end,
|
||||
.name = "BT Controller Data"
|
||||
};
|
||||
|
||||
ret = esp_bt_mem_release_areas(&cont_data, &cont_bss);
|
||||
}
|
||||
|
||||
if (ret == ESP_OK) {
|
||||
ret = esp_bt_controller_rom_mem_release(mode);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_mem_release(esp_bt_mode_t mode)
|
||||
{
|
||||
int ret;
|
||||
intptr_t mem_start, mem_end;
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
ret = esp_bt_controller_mem_release(mode);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
bt_area_t bss = {
|
||||
.start = (intptr_t)&_bt_bss_start,
|
||||
.end = (intptr_t)&_bt_bss_end,
|
||||
.name = "BT BSS",
|
||||
};
|
||||
bt_area_t cont_bss = {
|
||||
.start = (intptr_t)&_bt_controller_bss_start,
|
||||
.end = (intptr_t)&_bt_controller_bss_end,
|
||||
.name = "BT Controller BSS",
|
||||
};
|
||||
bt_area_t data = {
|
||||
.start = (intptr_t)&_bt_data_start,
|
||||
.end = (intptr_t)&_bt_data_end,
|
||||
.name = "BT Data",
|
||||
};
|
||||
bt_area_t cont_data = {
|
||||
.start = (intptr_t)&_bt_controller_data_start,
|
||||
.end = (intptr_t)&_bt_controller_data_end,
|
||||
.name = "BT Controller Data"
|
||||
};
|
||||
|
||||
if (mode == ESP_BT_MODE_BTDM) {
|
||||
mem_start = (intptr_t)&_bt_bss_start;
|
||||
mem_end = (intptr_t)&_bt_bss_end;
|
||||
if (mem_start != mem_end) {
|
||||
ESP_LOGD(BTDM_LOG_TAG, "Release BT BSS [0x%08x] - [0x%08x]", mem_start, mem_end);
|
||||
ESP_ERROR_CHECK(try_heap_caps_add_region(mem_start, mem_end));
|
||||
}
|
||||
mem_start = (intptr_t)&_bt_data_start;
|
||||
mem_end = (intptr_t)&_bt_data_end;
|
||||
if (mem_start != mem_end) {
|
||||
ESP_LOGD(BTDM_LOG_TAG, "Release BT Data [0x%08x] - [0x%08x]", mem_start, mem_end);
|
||||
ESP_ERROR_CHECK(try_heap_caps_add_region(mem_start, mem_end));
|
||||
/* Start by freeing Bluetooth BSS section */
|
||||
if (ret == ESP_OK) {
|
||||
ret = esp_bt_mem_release_areas(&bss, &cont_bss);
|
||||
}
|
||||
|
||||
mem_start = (intptr_t)&_nimble_bss_start;
|
||||
mem_end = (intptr_t)&_nimble_bss_end;
|
||||
if (mem_start != mem_end) {
|
||||
ESP_LOGD(BTDM_LOG_TAG, "Release NimBLE BSS [0x%08x] - [0x%08x]", mem_start, mem_end);
|
||||
ESP_ERROR_CHECK(try_heap_caps_add_region(mem_start, mem_end));
|
||||
}
|
||||
mem_start = (intptr_t)&_nimble_data_start;
|
||||
mem_end = (intptr_t)&_nimble_data_end;
|
||||
if (mem_start != mem_end) {
|
||||
ESP_LOGD(BTDM_LOG_TAG, "Release NimBLE Data [0x%08x] - [0x%08x]", mem_start, mem_end);
|
||||
ESP_ERROR_CHECK(try_heap_caps_add_region(mem_start, mem_end));
|
||||
/* Do the same thing with the Bluetooth data section */
|
||||
if (ret == ESP_OK) {
|
||||
ret = esp_bt_mem_release_areas(&data, &cont_data);
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
|
||||
/* free data and BSS section for Bluetooth controller ROM code */
|
||||
if (ret == ESP_OK) {
|
||||
ret = esp_bt_controller_rom_mem_release(mode);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_BTDM_CTRL_HLI
|
||||
@@ -1570,6 +1638,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) {
|
||||
@@ -1690,6 +1764,18 @@ static void bt_shutdown(void)
|
||||
return;
|
||||
}
|
||||
|
||||
static void patch_apply(void)
|
||||
{
|
||||
config_btdm_funcs_reset();
|
||||
|
||||
#ifndef CONFIG_BTDM_CTRL_MODE_BLE_ONLY
|
||||
config_bt_funcs_reset();
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY
|
||||
config_ble_funcs_reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
{
|
||||
@@ -1721,7 +1807,9 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
btdm_controller_enable_sleep(true);
|
||||
}
|
||||
|
||||
// inititalize bluetooth baseband
|
||||
sdk_config_set_bt_pll_track_enable(true);
|
||||
|
||||
// initialize bluetooth baseband
|
||||
btdm_check_and_init_bb();
|
||||
|
||||
ret = btdm_controller_enable(mode);
|
||||
@@ -1884,7 +1972,7 @@ esp_err_t esp_ble_scan_dupilcate_list_flush(void)
|
||||
|
||||
/**
|
||||
* This function re-write controller's function,
|
||||
* As coredump can not show paramerters in function which is in a .a file.
|
||||
* As coredump can not show parameters in function which is in a .a file.
|
||||
*
|
||||
* After coredump fixing this issue, just delete this function.
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ config BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB
|
||||
default 0
|
||||
help
|
||||
BLE ACL buffer have two methods to be allocated. One is persistent allocating
|
||||
(alloate when controller initialise, never free until controller de-initialise)
|
||||
(allocate when controller initialise, never free until controller de-initialise)
|
||||
another is dynamically allocating (allocate before TX and free after TX).
|
||||
|
||||
choice BT_CTRL_PINNED_TO_CORE_CHOICE
|
||||
@@ -72,11 +72,11 @@ config BT_CTRL_HCI_TL
|
||||
HCI mode as VHCI or UART(H4)
|
||||
|
||||
config BT_CTRL_ADV_DUP_FILT_MAX
|
||||
int "The maxinum number of 5.0 extend duplicate scan filter"
|
||||
int "The maximum number of 5.0 extend duplicate scan filter"
|
||||
range 1 500
|
||||
default 30
|
||||
help
|
||||
The maxinum number of suplicate scan filter
|
||||
The maximum number of suplicate scan filter
|
||||
|
||||
choice BT_BLE_CCA_MODE
|
||||
prompt "BLE CCA mode"
|
||||
@@ -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,25 @@ 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.
|
||||
|
||||
config BT_CTRL_CHAN_ASS_EN
|
||||
bool "Enable channel assessment"
|
||||
default y
|
||||
help
|
||||
If this option is enabled, The Controller will records the communication quality
|
||||
for each channel and then start a timer to check and update the channel map every 4 seconds.
|
||||
|
||||
config BT_CTRL_LE_PING_EN
|
||||
bool "Enable LE Ping procedure"
|
||||
default y
|
||||
help
|
||||
If this option is disabled, The Controller will not start the LE authenticated payload timer.
|
||||
This option is used for some compatibility problems related to LE ping procedure.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Submodule components/bt/controller/lib_esp32 updated: 7bb0d445db...a4d7731a95
Submodule components/bt/controller/lib_esp32c3_family updated: 0cfac1b21e...4b1338827f
@@ -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
|
||||
|
||||
@@ -15,7 +15,7 @@ The ESP-BLE-MESH networking enables many-to-many (m:m) device communications and
|
||||
- [FAQ](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/ble_mesh_faq.html)
|
||||
- [API Reference](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/bluetooth/ble_mesh.html)
|
||||
|
||||
|
||||
### [ESP-BLE-MESH Examples](https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/esp_ble_mesh)
|
||||
|
||||
### [ESP-BLE-MESH Examples](../../../examples/bluetooth/esp_ble_mesh)
|
||||
|
||||
- Refer to **ESP-BLE-MESH Examples** of [Getting Started](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/esp_ble_mesh/index.html##getting-started-with-ble-mesh) for the tutorials of ESP BLE Mesh examples.
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -569,9 +569,9 @@ esp_err_t esp_ble_mesh_provisioner_set_heartbeat_filter_info(uint8_t op, esp_ble
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!ESP_BLE_MESH_ADDR_IS_UNICAST(info->hb_src) &&
|
||||
!ESP_BLE_MESH_ADDR_IS_UNICAST(info->hb_dst) &&
|
||||
!ESP_BLE_MESH_ADDR_IS_GROUP(info->hb_dst)) {
|
||||
if (!(ESP_BLE_MESH_ADDR_IS_UNICAST(info->hb_src) &&
|
||||
(ESP_BLE_MESH_ADDR_IS_UNICAST(info->hb_dst) ||
|
||||
ESP_BLE_MESH_ADDR_IS_GROUP(info->hb_dst)))) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,14 @@ typedef uint8_t esp_ble_mesh_octet8_t[ESP_BLE_MESH_OCTET8_LEN];
|
||||
#define ESP_BLE_MESH_KEY_PRIMARY 0x0000
|
||||
#define ESP_BLE_MESH_KEY_ANY 0xFFFF
|
||||
|
||||
/*!< Internal macros used to initialize array members */
|
||||
#define ESP_BLE_MESH_KEY_UNUSED_ELT_(IDX, _) ESP_BLE_MESH_KEY_UNUSED
|
||||
#define ESP_BLE_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) ESP_BLE_MESH_ADDR_UNASSIGNED
|
||||
#define ESP_BLE_MESH_MODEL_KEYS_UNUSED \
|
||||
{ LISTIFY(CONFIG_BLE_MESH_MODEL_KEY_COUNT, ESP_BLE_MESH_KEY_UNUSED_ELT_, (,)) }
|
||||
#define ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED \
|
||||
{ LISTIFY(CONFIG_BLE_MESH_MODEL_GROUP_COUNT, ESP_BLE_MESH_ADDR_UNASSIGNED_ELT_, (,)) }
|
||||
|
||||
/*!< Primary Network Key index */
|
||||
#define ESP_BLE_MESH_NET_PRIMARY 0x000
|
||||
|
||||
@@ -264,26 +272,24 @@ typedef enum {
|
||||
#define ESP_BLE_MESH_SIG_MODEL(_id, _op, _pub, _user_data) \
|
||||
{ \
|
||||
.model_id = (_id), \
|
||||
.op = _op, \
|
||||
.keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \
|
||||
ESP_BLE_MESH_KEY_UNUSED }, \
|
||||
.pub = _pub, \
|
||||
.groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \
|
||||
ESP_BLE_MESH_ADDR_UNASSIGNED }, \
|
||||
.keys = ESP_BLE_MESH_MODEL_KEYS_UNUSED, \
|
||||
.groups = ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED, \
|
||||
.op = _op, \
|
||||
.user_data = _user_data, \
|
||||
}
|
||||
|
||||
/*!< This macro is associated with BLE_MESH_MODEL_VND_CB in mesh_access.h */
|
||||
#define ESP_BLE_MESH_VENDOR_MODEL(_company, _id, _op, _pub, _user_data) \
|
||||
{ \
|
||||
.vnd.company_id = (_company), \
|
||||
.vnd.model_id = (_id), \
|
||||
.op = _op, \
|
||||
.vnd = { \
|
||||
.company_id = (_company), \
|
||||
.model_id = (_id), \
|
||||
}, \
|
||||
.pub = _pub, \
|
||||
.keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \
|
||||
ESP_BLE_MESH_KEY_UNUSED }, \
|
||||
.groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \
|
||||
ESP_BLE_MESH_ADDR_UNASSIGNED }, \
|
||||
.keys = ESP_BLE_MESH_MODEL_KEYS_UNUSED, \
|
||||
.groups = ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED, \
|
||||
.op = _op, \
|
||||
.user_data = _user_data, \
|
||||
}
|
||||
|
||||
@@ -302,8 +308,8 @@ typedef enum {
|
||||
{ \
|
||||
.location = (_loc), \
|
||||
.sig_model_count = ARRAY_SIZE(_mods), \
|
||||
.sig_models = (_mods), \
|
||||
.vnd_model_count = ARRAY_SIZE(_vnd_mods), \
|
||||
.sig_models = (_mods), \
|
||||
.vnd_models = (_vnd_mods), \
|
||||
}
|
||||
|
||||
@@ -416,8 +422,8 @@ typedef struct {
|
||||
#define ESP_BLE_MESH_MODEL_PUB_DEFINE(_name, _msg_len, _role) \
|
||||
NET_BUF_SIMPLE_DEFINE_STATIC(bt_mesh_pub_msg_##_name, _msg_len); \
|
||||
static esp_ble_mesh_model_pub_t _name = { \
|
||||
.update = (uint32_t)NULL, \
|
||||
.msg = &bt_mesh_pub_msg_##_name, \
|
||||
.update = (uint32_t)NULL, \
|
||||
.dev_role = _role, \
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -840,22 +840,22 @@ struct net_buf_pool {
|
||||
#if defined(CONFIG_BLE_MESH_NET_BUF_POOL_USAGE)
|
||||
#define NET_BUF_POOL_INITIALIZER(_pool, _alloc, _bufs, _count, _destroy) \
|
||||
{ \
|
||||
.alloc = _alloc, \
|
||||
.__bufs = (struct net_buf *)_bufs, \
|
||||
.buf_count = _count, \
|
||||
.uninit_count = _count, \
|
||||
.avail_count = _count, \
|
||||
.destroy = _destroy, \
|
||||
.name = STRINGIFY(_pool), \
|
||||
.destroy = _destroy, \
|
||||
.alloc = _alloc, \
|
||||
.__bufs = (struct net_buf *)_bufs, \
|
||||
}
|
||||
#else
|
||||
#define NET_BUF_POOL_INITIALIZER(_pool, _alloc, _bufs, _count, _destroy) \
|
||||
{ \
|
||||
.alloc = _alloc, \
|
||||
.__bufs = (struct net_buf *)_bufs, \
|
||||
.buf_count = _count, \
|
||||
.uninit_count = _count, \
|
||||
.destroy = _destroy, \
|
||||
.alloc = _alloc, \
|
||||
.__bufs = (struct net_buf *)_bufs, \
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_NET_BUF_POOL_USAGE */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <stddef.h>
|
||||
#include "esp_bit_defs.h"
|
||||
#include "mesh_types.h"
|
||||
#include "mesh_utils_loops.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -180,6 +181,40 @@ extern "C" {
|
||||
*/
|
||||
#define Z_IS_ENABLED3(ignore_this, val, ...) val
|
||||
|
||||
/* Used to remove brackets from around a single argument. */
|
||||
#define __DEBRACKET(...) __VA_ARGS__
|
||||
|
||||
#define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, __VA_ARGS__)
|
||||
#define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
|
||||
|
||||
/**
|
||||
* @brief Generates a sequence of code with configurable separator.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* #define FOO(i, _) MY_PWM ## i
|
||||
* { LISTIFY(PWM_COUNT, FOO, (,)) }
|
||||
*
|
||||
* The above two lines expand to:
|
||||
*
|
||||
* { MY_PWM0 , MY_PWM1 }
|
||||
*
|
||||
* @param LEN The length of the sequence. Must be an integer literal less
|
||||
* than 255.
|
||||
* @param F A macro function that accepts at least two arguments:
|
||||
* <tt>F(i, ...)</tt>. @p F is called repeatedly in the expansion.
|
||||
* Its first argument @p i is the index in the sequence, and
|
||||
* the variable list of arguments passed to LISTIFY are passed
|
||||
* through to @p F.
|
||||
*
|
||||
* @param sep Separator (e.g. comma or semicolon). Must be in parentheses;
|
||||
* this is required to enable providing a comma as separator.
|
||||
*
|
||||
* @note Calling LISTIFY with undefined arguments has undefined
|
||||
* behavior.
|
||||
*/
|
||||
#define LISTIFY(LEN, F, sep, ...) UTIL_CAT(Z_UTIL_LISTIFY_, LEN)(F, sep, __VA_ARGS__)
|
||||
|
||||
const char *bt_hex(const void *buf, size_t len);
|
||||
|
||||
void mem_rcopy(uint8_t *dst, uint8_t const *src, uint16_t len);
|
||||
|
||||
1051
components/bt/esp_ble_mesh/mesh_common/include/mesh_utils_loops.h
Normal file
1051
components/bt/esp_ble_mesh/mesh_common/include/mesh_utils_loops.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb;
|
||||
static tBTA_GATTS_IF bt_mesh_gatts_if;
|
||||
static BD_ADDR bt_mesh_gatts_addr;
|
||||
static uint16_t svc_handle, char_handle;
|
||||
static future_t *future_mesh;
|
||||
static future_t *gatts_future_mesh;
|
||||
|
||||
/* Static Functions */
|
||||
static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(uint16_t handle);
|
||||
@@ -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());
|
||||
@@ -518,6 +539,9 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
case BTA_GATTS_REG_EVT:
|
||||
if (p_data->reg_oper.status == BTA_GATT_OK) {
|
||||
bt_mesh_gatts_if = p_data->reg_oper.server_if;
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
} else {
|
||||
future_ready(gatts_future_mesh, FUTURE_FAIL);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_READ_EVT: {
|
||||
@@ -575,27 +599,27 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
break;
|
||||
case BTA_GATTS_CREATE_EVT:
|
||||
svc_handle = p_data->create.service_id;
|
||||
BT_DBG("svc_handle %d, future_mesh %p", svc_handle, future_mesh);
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
BT_DBG("svc_handle %d, gatts_future_mesh %p", svc_handle, gatts_future_mesh);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_ADD_INCL_SRVC_EVT:
|
||||
svc_handle = p_data->add_result.attr_id;
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_ADD_CHAR_EVT:
|
||||
char_handle = p_data->add_result.attr_id;
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_ADD_CHAR_DESCR_EVT:
|
||||
char_handle = p_data->add_result.attr_id;
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_DELELTE_EVT:
|
||||
@@ -921,11 +945,11 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
if (svc->attrs[i].uuid->type == BLE_MESH_UUID_TYPE_16) {
|
||||
switch (BLE_MESH_UUID_16(svc->attrs[i].uuid)->val) {
|
||||
case BLE_MESH_UUID_GATT_PRIMARY_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, (struct bt_mesh_uuid *)svc->attrs[i].user_data);
|
||||
BTA_GATTS_CreateService(bt_mesh_gatts_if,
|
||||
&bta_uuid, 0, svc->attr_count, true);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add primary service");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@@ -935,11 +959,11 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
break;
|
||||
}
|
||||
case BLE_MESH_UUID_GATT_SECONDARY_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, (struct bt_mesh_uuid *)svc->attrs[i].user_data);
|
||||
BTA_GATTS_CreateService(bt_mesh_gatts_if,
|
||||
&bta_uuid, 0, svc->attr_count, false);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add secondary service");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@@ -952,11 +976,11 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
break;
|
||||
}
|
||||
case BLE_MESH_UUID_GATT_CHRC_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
struct bt_mesh_gatt_char *gatts_chrc = (struct bt_mesh_gatt_char *)svc->attrs[i].user_data;
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, gatts_chrc->uuid);
|
||||
BTA_GATTS_AddCharacteristic(svc_handle, &bta_uuid, bt_mesh_perm_to_bta_perm(svc->attrs[i + 1].perm), gatts_chrc->properties, NULL, NULL);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add characteristic");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@@ -978,10 +1002,10 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
case BLE_MESH_UUID_ES_CONFIGURATION_VAL:
|
||||
case BLE_MESH_UUID_ES_MEASUREMENT_VAL:
|
||||
case BLE_MESH_UUID_ES_TRIGGER_SETTING_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, svc->attrs[i].uuid);
|
||||
BTA_GATTS_AddCharDescriptor(svc_handle, bt_mesh_perm_to_bta_perm(svc->attrs[i].perm), &bta_uuid, NULL, NULL);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add descriptor");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@@ -1724,7 +1748,19 @@ void bt_mesh_gatt_init(void)
|
||||
CONFIG_BLE_MESH_GATT_PROXY_SERVER
|
||||
tBT_UUID gatts_app_uuid = {LEN_UUID_128, {0}};
|
||||
memset(&gatts_app_uuid.uu.uuid128, BLE_MESH_GATTS_APP_UUID_BYTE, LEN_UUID_128);
|
||||
|
||||
gatts_future_mesh = future_new();
|
||||
if (!gatts_future_mesh) {
|
||||
BT_ERR("Mesh gatts sync lock alloc failed");
|
||||
return;
|
||||
}
|
||||
|
||||
BTA_GATTS_AppRegister(&gatts_app_uuid, bt_mesh_bta_gatts_cb);
|
||||
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Mesh gatts app register failed");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
|
||||
|
||||
@@ -50,8 +50,8 @@ extern "C" {
|
||||
{ \
|
||||
.loc = (_loc), \
|
||||
.model_count = ARRAY_SIZE(_mods), \
|
||||
.models = (_mods), \
|
||||
.vnd_model_count = ARRAY_SIZE(_vnd_mods), \
|
||||
.models = (_mods), \
|
||||
.vnd_models = (_vnd_mods), \
|
||||
}
|
||||
|
||||
@@ -255,14 +255,12 @@ struct bt_mesh_model_op {
|
||||
#define BLE_MESH_MODEL_CB(_id, _op, _pub, _user_data, _cb) \
|
||||
{ \
|
||||
.id = (_id), \
|
||||
.op = (_op), \
|
||||
.keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \
|
||||
BLE_MESH_KEY_UNUSED }, \
|
||||
.pub = (_pub), \
|
||||
.groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \
|
||||
BLE_MESH_ADDR_UNASSIGNED }, \
|
||||
.user_data = (_user_data), \
|
||||
.keys = ESP_BLE_MESH_MODEL_KEYS_UNUSED, \
|
||||
.groups = ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED, \
|
||||
.op = (_op), \
|
||||
.cb = (_cb), \
|
||||
.user_data = (_user_data), \
|
||||
}
|
||||
|
||||
/** @def BLE_MESH_MODEL_VND_CB
|
||||
@@ -280,14 +278,12 @@ struct bt_mesh_model_op {
|
||||
{ \
|
||||
.vnd.company = (_company), \
|
||||
.vnd.id = (_id), \
|
||||
.op = (_op), \
|
||||
.pub = (_pub), \
|
||||
.keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] = \
|
||||
BLE_MESH_KEY_UNUSED }, \
|
||||
.groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] = \
|
||||
BLE_MESH_ADDR_UNASSIGNED }, \
|
||||
.user_data = (_user_data), \
|
||||
.keys = ESP_BLE_MESH_MODEL_KEYS_UNUSED, \
|
||||
.groups = ESP_BLE_MESH_MODEL_GROUPS_UNASSIGNED, \
|
||||
.op = (_op), \
|
||||
.cb = (_cb), \
|
||||
.user_data = (_user_data), \
|
||||
}
|
||||
|
||||
/** @def BLE_MESH_TRANSMIT
|
||||
@@ -419,8 +415,8 @@ struct bt_mesh_model_pub {
|
||||
#define BLE_MESH_MODEL_PUB_DEFINE(_name, _update, _msg_len) \
|
||||
NET_BUF_SIMPLE_DEFINE_STATIC(bt_mesh_pub_msg_##_name, _msg_len); \
|
||||
static struct bt_mesh_model_pub _name = { \
|
||||
.update = _update, \
|
||||
.msg = &bt_mesh_pub_msg_##_name, \
|
||||
.update = _update, \
|
||||
}
|
||||
|
||||
/** Model callback functions. */
|
||||
|
||||
@@ -573,9 +573,9 @@ struct bt_mesh_gatt_attr {
|
||||
#define BLE_MESH_GATT_PRIMARY_SERVICE(_service) \
|
||||
{ \
|
||||
.uuid = BLE_MESH_UUID_GATT_PRIMARY, \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
.read = bt_mesh_gatts_attr_read_service, \
|
||||
.user_data = _service, \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
}
|
||||
|
||||
/** @def BLE_MESH_GATT_SECONDARY_SERVICE
|
||||
@@ -588,9 +588,9 @@ struct bt_mesh_gatt_attr {
|
||||
#define BLE_MESH_GATT_SECONDARY_SERVICE(_service) \
|
||||
{ \
|
||||
.uuid = BLE_MESH_UUID_GATT_SECONDARY, \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
.read = bt_mesh_gatts_attr_read_service, \
|
||||
.user_data = _service, \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
}
|
||||
|
||||
/** @def BLE_MESH_GATT_INCLUDE_SERVICE
|
||||
@@ -603,9 +603,9 @@ struct bt_mesh_gatt_attr {
|
||||
#define BLE_MESH_GATT_INCLUDE_SERVICE(_service_incl) \
|
||||
{ \
|
||||
.uuid = BLE_MESH_UUID_GATT_INCLUDE, \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
.read = bt_mesh_gatts_attr_read_included, \
|
||||
.user_data = _service_incl, \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
}
|
||||
|
||||
/** @def BLE_MESH_GATT_CHARACTERISTIC
|
||||
@@ -619,10 +619,10 @@ struct bt_mesh_gatt_attr {
|
||||
#define BLE_MESH_GATT_CHARACTERISTIC(_uuid, _props) \
|
||||
{ \
|
||||
.uuid = BLE_MESH_UUID_GATT_CHRC, \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
.read = bt_mesh_gatts_attr_read_chrc, \
|
||||
.user_data = (&(struct bt_mesh_gatt_char) { .uuid = _uuid, \
|
||||
.properties = _props, }), \
|
||||
.perm = BLE_MESH_GATT_PERM_READ, \
|
||||
}
|
||||
|
||||
/** @def BLE_MESH_GATT_DESCRIPTOR
|
||||
@@ -639,10 +639,10 @@ struct bt_mesh_gatt_attr {
|
||||
#define BLE_MESH_GATT_DESCRIPTOR(_uuid, _perm, _read, _write, _value) \
|
||||
{ \
|
||||
.uuid = _uuid, \
|
||||
.perm = _perm, \
|
||||
.read = _read, \
|
||||
.write = _write, \
|
||||
.user_data = _value, \
|
||||
.perm = _perm, \
|
||||
}
|
||||
|
||||
/** @def BLE_MESH_GATT_SERVICE
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1432,9 +1432,7 @@ static bool ignore_net_msg(uint16_t src, uint16_t dst)
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
|
||||
bt_mesh_is_provisioner_en() &&
|
||||
BLE_MESH_ADDR_IS_UNICAST(dst) &&
|
||||
bt_mesh_elem_find(dst)) {
|
||||
bt_mesh_is_provisioner_en()) {
|
||||
/* If the destination address of the message is the element
|
||||
* address of Provisioner, but Provisioner fails to find the
|
||||
* node in its provisioning database, then this message will
|
||||
@@ -1509,7 +1507,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,
|
||||
@@ -597,7 +599,7 @@ static int provisioner_start_prov_pb_adv(const uint8_t uuid[16], const bt_mesh_a
|
||||
|
||||
if (is_unprov_dev_being_provision(uuid)) {
|
||||
bt_mesh_pb_adv_unlock();
|
||||
return -EALREADY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < CONFIG_BLE_MESH_PBA_SAME_TIME; i++) {
|
||||
@@ -658,7 +660,7 @@ static int provisioner_start_prov_pb_gatt(const uint8_t uuid[16], const bt_mesh_
|
||||
|
||||
if (is_unprov_dev_being_provision(uuid)) {
|
||||
bt_mesh_pb_gatt_unlock();
|
||||
return -EALREADY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = CONFIG_BLE_MESH_PBA_SAME_TIME; i < BLE_MESH_PROV_SAME_TIME; i++) {
|
||||
@@ -1700,7 +1702,7 @@ static void prov_capabilities(const uint8_t idx, const uint8_t *data)
|
||||
|
||||
algorithms = sys_get_be16(&data[1]);
|
||||
BT_INFO("Algorithms: 0x%04x", algorithms);
|
||||
if (algorithms != BIT(PROV_ALG_P256)) {
|
||||
if (!(algorithms & BIT(PROV_ALG_P256))) {
|
||||
BT_ERR("Invalid algorithms 0x%04x", algorithms);
|
||||
goto fail;
|
||||
}
|
||||
@@ -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
|
||||
@@ -246,7 +259,7 @@ config BT_GATTC_CACHE_NVS_FLASH
|
||||
config BT_GATTC_CONNECT_RETRY_COUNT
|
||||
int "The number of attempts to reconnect if the connection establishment failed"
|
||||
depends on BT_GATTC_ENABLE
|
||||
range 0 7
|
||||
range 0 255
|
||||
default 3
|
||||
help
|
||||
The number of attempts to reconnect if the connection establishment failed
|
||||
@@ -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
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
#include "esp_bt.h"
|
||||
#include "osi/future.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "bt_common.h"
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
#include "hci_log/bt_hci_log.h"
|
||||
#endif
|
||||
|
||||
static bool bd_already_enable = false;
|
||||
static bool bd_already_init = false;
|
||||
@@ -165,6 +169,10 @@ esp_err_t esp_bluedroid_init(void)
|
||||
|
||||
bd_already_init = true;
|
||||
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
bt_hci_log_init();
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -207,6 +215,10 @@ esp_err_t esp_bluedroid_deinit(void)
|
||||
|
||||
btc_deinit();
|
||||
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
bt_hci_log_deinit();
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
|
||||
bd_already_init = false;
|
||||
|
||||
return ESP_OK;
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "btc/btc_manage.h"
|
||||
#include "btc_gap_ble.h"
|
||||
#include "btc/btc_ble_storage.h"
|
||||
|
||||
#include "esp_random.h"
|
||||
|
||||
esp_err_t esp_ble_gap_register_callback(esp_gap_ble_cb_t callback)
|
||||
{
|
||||
@@ -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)
|
||||
@@ -170,6 +188,25 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_addr_create_static(esp_bd_addr_t rand_addr)
|
||||
{
|
||||
// Static device address: First two bits are '11', rest is random
|
||||
rand_addr[0] = 0xC0 | (esp_random() & 0x3F);
|
||||
for (int i = 1; i < 6; i++) {
|
||||
rand_addr[i] = esp_random() & 0xFF; // Randomize remaining bits
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_addr_create_nrpa(esp_bd_addr_t rand_addr)
|
||||
{
|
||||
// Non-resolvable private address: First two bits are '00', rest is random
|
||||
rand_addr[0] = (esp_random() & 0x3F);
|
||||
for (int i = 1; i < 6; i++) {
|
||||
rand_addr[i] = esp_random() & 0xFF; // Randomize remaining bits
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr)
|
||||
{
|
||||
@@ -186,6 +223,48 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr)
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeout)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (rpa_timeout < 0x0001 || rpa_timeout > 0x0E10) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT;
|
||||
arg.set_rpa_timeout.rpa_timeout = rpa_timeout;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
|
||||
esp_err_t esp_ble_gap_add_device_to_resolving_list(esp_bd_addr_t peer_addr, uint8_t addr_type, uint8_t *peer_irk)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (addr_type > BLE_ADDR_TYPE_RANDOM ||!peer_addr || (addr_type && ((peer_addr[0] & 0xC0) != 0xC0))) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST;
|
||||
|
||||
memcpy(arg.add_dev_to_resolving_list.addr, peer_addr, ESP_BD_ADDR_LEN);
|
||||
arg.add_dev_to_resolving_list.addr_type = addr_type;
|
||||
memcpy(arg.add_dev_to_resolving_list.irk, peer_irk, ESP_PEER_IRK_LEN);
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_clear_rand_addr(void)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
@@ -281,6 +360,7 @@ esp_err_t esp_ble_gap_config_local_icon (uint16_t icon)
|
||||
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV:
|
||||
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD:
|
||||
case ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV:
|
||||
case ESP_BLE_APPEARANCE_STANDALONE_SPEAKER:
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON;
|
||||
@@ -470,8 +550,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 +656,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;
|
||||
|
||||
@@ -818,6 +901,122 @@ esp_err_t esp_gap_ble_set_authorization(esp_bd_addr_t bd_addr, bool authorize)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
esp_err_t esp_ble_dtm_tx_start(const esp_ble_dtm_tx_t *tx_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
if (!tx_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
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_DTM_TX_START;
|
||||
|
||||
memcpy(&arg.dtm_tx_start, tx_params, sizeof(esp_ble_dtm_tx_t));
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_dtm_rx_start(const esp_ble_dtm_rx_t *rx_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
if (!rx_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
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_DTM_RX_START;
|
||||
|
||||
memcpy(&arg.dtm_rx_start, rx_params, sizeof(esp_ble_dtm_rx_t));
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
esp_err_t esp_ble_dtm_enh_tx_start(const esp_ble_dtm_enh_tx_t *tx_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (!tx_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
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_DTM_ENH_TX_START;
|
||||
|
||||
memcpy(&arg.dtm_enh_tx_start, tx_params, sizeof(esp_ble_dtm_enh_tx_t));
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_dtm_enh_rx_start(const esp_ble_dtm_enh_rx_t *rx_params)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_5_gap_args_t arg;
|
||||
|
||||
if (!rx_params) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
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_DTM_ENH_RX_START;
|
||||
|
||||
memcpy(&arg.dtm_enh_rx_start, rx_params, sizeof(esp_ble_dtm_enh_rx_t));
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
esp_err_t esp_ble_dtm_stop(void)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
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_DTM_STOP;
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_addr_t addr, esp_ble_privacy_mode_t mode)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
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_SET_PRIVACY_MODE;
|
||||
|
||||
arg.set_privacy_mode.addr_type = addr_type;
|
||||
memcpy(arg.set_privacy_mode.addr, addr, sizeof(esp_bd_addr_t));
|
||||
arg.set_privacy_mode.privacy_mode = mode;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr)
|
||||
@@ -1481,3 +1680,31 @@ esp_err_t esp_ble_gap_set_periodic_adv_sync_trans_params(esp_bd_addr_t addr, con
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cmd_param)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
if (!vendor_cmd_param || !vendor_cmd_param->p_param_buf || !vendor_cmd_param->param_len) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
// If command is not a VSC, return error
|
||||
if ((vendor_cmd_param->opcode & VENDOR_HCI_CMD_MASK) != VENDOR_HCI_CMD_MASK) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT;
|
||||
arg.vendor_cmd_send.opcode = vendor_cmd_param->opcode;
|
||||
arg.vendor_cmd_send.param_len = vendor_cmd_param->param_len;
|
||||
arg.vendor_cmd_send.p_param_buf = vendor_cmd_param->p_param_buf;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -97,8 +89,11 @@ esp_err_t esp_spp_connect(esp_spp_sec_t sec_mask,
|
||||
btc_spp_args_t arg;
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) {
|
||||
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n");
|
||||
if (sec_mask != ESP_SPP_SEC_NONE &&
|
||||
sec_mask != ESP_SPP_SEC_AUTHENTICATE &&
|
||||
sec_mask != (ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT)) {
|
||||
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHENTICATE"
|
||||
"or (ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT) only\n");
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
@@ -140,8 +135,16 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) {
|
||||
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n");
|
||||
if (sec_mask != ESP_SPP_SEC_NONE &&
|
||||
sec_mask != ESP_SPP_SEC_AUTHENTICATE &&
|
||||
sec_mask != (ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT) &&
|
||||
sec_mask != ESP_SPP_SEC_IN_16_DIGITS &&
|
||||
sec_mask != (ESP_SPP_SEC_IN_16_DIGITS | ESP_SPP_SEC_AUTHENTICATE) &&
|
||||
sec_mask != (ESP_SPP_SEC_IN_16_DIGITS | ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT)) {
|
||||
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHENTICATE,"
|
||||
"(ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT),"
|
||||
"ESP_SPP_SEC_IN_16_DIGITS, (ESP_SPP_SEC_IN_16_DIGITS | ESP_SPP_SEC_AUTHENTICATE), or"
|
||||
"(ESP_SPP_SEC_IN_16_DIGITS | ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT) only\n");
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
|
||||
@@ -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,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-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_BT_DEFS_H__
|
||||
#define __ESP_BT_DEFS_H__
|
||||
@@ -27,7 +19,7 @@ extern "C" {
|
||||
return ESP_ERR_INVALID_STATE; \
|
||||
}
|
||||
|
||||
#define ESP_BT_STATUS_BASE_FOR_HCI_ERR 0X0100 /* base for coverting HCI error code to ESP status */
|
||||
#define ESP_BT_STATUS_BASE_FOR_HCI_ERR 0X0100 /* base for converting HCI error code to ESP status */
|
||||
|
||||
/* relate to BT_STATUS_xxx in bt_def.h */
|
||||
/// Status Return Value
|
||||
@@ -171,6 +163,9 @@ typedef enum {
|
||||
/// Bluetooth address length
|
||||
#define ESP_BD_ADDR_LEN 6
|
||||
|
||||
/// Bluetooth peer irk
|
||||
#define ESP_PEER_IRK_LEN 16
|
||||
|
||||
/// Bluetooth device address
|
||||
typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN];
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -104,6 +104,7 @@ typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_CADENCE 0x0483 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_CADENCE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_POWER 0x0484 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_POWER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 /*!< relate to BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_STANDALONE_SPEAKER 0x0841 /*!< relate to BTM_BLE_APPEARANCE_STANDALONE_SPEAKER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 /*!< relate to BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 /*!< relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 /*!< relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST in stack/btm_ble_api.h */
|
||||
@@ -125,6 +126,18 @@ typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit
|
||||
|
||||
typedef uint8_t esp_ble_io_cap_t; /*!< combination of the io capability */
|
||||
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x00 0x00 /*!< PRBS9 sequence ‘11111111100000111101...’ (in transmission order) as described in [Vol 6] Part F, Section 4.1.5 */
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x01 0x01 /*!< Repeated ‘11110000’ (in transmission order) sequence as described in [Vol 6] Part F, Section 4.1.5 */
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x02 0x02 /*!< Repeated ‘10101010’ (in transmission order) sequence as described in [Vol 6] Part F, Section 4.1.5 */
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x03 0x03 /*!< PRBS15 sequence as described in [Vol 6] Part F, Section 4.1.5 */
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x04 0x04 /*!< Repeated ‘11111111’ (in transmission order) sequence */
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x05 0x05 /*!< Repeated ‘00000000’ (in transmission order) sequence */
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x06 0x06 /*!< Repeated ‘00001111’ (in transmission order) sequence */
|
||||
#define BLE_DTM_PKT_PAYLOAD_0x07 0x07 /*!< Repeated ‘01010101’ (in transmission order) sequence */
|
||||
#define BLE_DTM_PKT_PAYLOAD_MAX 0x08 /*!< 0x08 ~ 0xFF, Reserved for future use */
|
||||
|
||||
typedef uint8_t esp_ble_dtm_pkt_payload_t;
|
||||
|
||||
/// GAP BLE callback event type
|
||||
typedef enum {
|
||||
//BLE_42_FEATURE_SUPPORT
|
||||
@@ -144,7 +157,7 @@ typedef enum {
|
||||
ESP_GAP_BLE_PASSKEY_REQ_EVT, /*!< passkey request event */
|
||||
ESP_GAP_BLE_OOB_REQ_EVT, /*!< OOB request event */
|
||||
ESP_GAP_BLE_LOCAL_IR_EVT, /*!< BLE local IR (identity Root 128-bit random static value used to generate Long Term Key) event */
|
||||
ESP_GAP_BLE_LOCAL_ER_EVT, /*!< BLE local ER (Encryption Root vakue used to genrate identity resolving key) event */
|
||||
ESP_GAP_BLE_LOCAL_ER_EVT, /*!< BLE local ER (Encryption Root value used to generate identity resolving key) event */
|
||||
ESP_GAP_BLE_NC_REQ_EVT, /*!< Numeric Comparison request event */
|
||||
//BLE_42_FEATURE_SUPPORT
|
||||
ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT, /*!< When stop adv complete, the event comes */
|
||||
@@ -208,6 +221,14 @@ 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 */
|
||||
// DTM
|
||||
ESP_GAP_BLE_DTM_TEST_UPDATE_EVT, /*!< when direct test mode state changes, the event comes */
|
||||
// BLE_INCLUDED
|
||||
ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT, /*!< When clear advertising complete, the event comes */
|
||||
ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT, /*!< When set the Resolvable Private Address (RPA) timeout completes, the event comes */
|
||||
ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT, /*!< when add a device to the resolving list completes, the event comes*/
|
||||
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */
|
||||
ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT, /*!< When set privacy mode complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
@@ -222,6 +243,8 @@ typedef uint8_t esp_gap_ble_channels[ESP_GAP_BLE_CHANNELS_LEN];
|
||||
/// Scan response data maximum length
|
||||
#define ESP_BLE_SCAN_RSP_DATA_LEN_MAX 31
|
||||
|
||||
#define VENDOR_HCI_CMD_MASK (0x3F << 10) /**!< 0xFC00 */
|
||||
|
||||
/* relate to BTM_BLE_AD_TYPE_xxx in stack/btm_ble_api.h */
|
||||
/// The type of advertising data(not adv_type)
|
||||
typedef enum {
|
||||
@@ -339,7 +362,42 @@ typedef enum {
|
||||
ESP_BLE_SM_MAX_PARAM,
|
||||
} esp_ble_sm_param_t;
|
||||
|
||||
typedef enum {
|
||||
/// DTM TX start event
|
||||
DTM_TX_START_EVT = 0x00,
|
||||
///DTM RX start event
|
||||
DTM_RX_START_EVT,
|
||||
///DTM test end event
|
||||
DTM_TEST_STOP_EVT,
|
||||
} esp_ble_dtm_update_evt_t;
|
||||
|
||||
/**
|
||||
* @brief Vendor HCI command parameters
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t opcode; /*!< vendor hci command opcode */
|
||||
uint8_t param_len; /*!< the length of parameter */
|
||||
uint8_t *p_param_buf; /*!< the point of parameter buffer */
|
||||
} esp_ble_vendor_cmd_params_t;
|
||||
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
/**
|
||||
* @brief DTM TX parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t tx_channel; /*!< channel for sending test data, tx_channel = (Frequency -2402)/2, tx_channel range:0x00-0x27, Frequency range: 2402 MHz to 2480 MHz */
|
||||
uint8_t len_of_data; /*!< length in bytes of payload data in each packet */
|
||||
esp_ble_dtm_pkt_payload_t pkt_payload; /*!< packet payload type. value range: 0x00-0x07 */
|
||||
} esp_ble_dtm_tx_t;
|
||||
/**
|
||||
* @brief DTM RX parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rx_channel; /*!< channel for test data reception, rx_channel = (Frequency -2402)/2, tx_channel range:0x00-0x27, Frequency range: 2402 MHz to 2480 MHz */
|
||||
} esp_ble_dtm_rx_t;
|
||||
|
||||
/// Advertising parameters
|
||||
typedef struct {
|
||||
uint16_t adv_int_min; /*!< Minimum advertising interval for
|
||||
@@ -417,7 +475,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 +736,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 +745,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;
|
||||
|
||||
@@ -738,9 +803,9 @@ typedef uint8_t esp_ble_gap_all_phys_t;
|
||||
#define ESP_BLE_GAP_PRI_PHY_CODED ESP_BLE_GAP_PHY_CODED /*!< Primary Phy is LE CODED */
|
||||
typedef uint8_t esp_ble_gap_pri_phy_t; // primary phy
|
||||
|
||||
#define ESP_BLE_GAP_PHY_1M_PREF_MASK (1 << 0) /*!< The Host prefers use the LE1M transmitter or reciever PHY */
|
||||
#define ESP_BLE_GAP_PHY_2M_PREF_MASK (1 << 1) /*!< The Host prefers use the LE2M transmitter or reciever PHY */
|
||||
#define ESP_BLE_GAP_PHY_CODED_PREF_MASK (1 << 2) /*!< The Host prefers use the LE CODED transmitter or reciever PHY */
|
||||
#define ESP_BLE_GAP_PHY_1M_PREF_MASK (1 << 0) /*!< The Host prefers use the LE1M transmitter or receiver PHY */
|
||||
#define ESP_BLE_GAP_PHY_2M_PREF_MASK (1 << 1) /*!< The Host prefers use the LE2M transmitter or receiver PHY */
|
||||
#define ESP_BLE_GAP_PHY_CODED_PREF_MASK (1 << 2) /*!< The Host prefers use the LE CODED transmitter or receiver PHY */
|
||||
typedef uint8_t esp_ble_gap_phy_mask_t;
|
||||
|
||||
#define ESP_BLE_GAP_PHY_OPTIONS_NO_PREF 0 /*!< The Host has no preferred coding when transmitting on the LE Coded PHY */
|
||||
@@ -887,7 +952,7 @@ typedef struct {
|
||||
esp_ble_gap_ext_adv_data_status_t data_status; /*!< data type */
|
||||
uint8_t adv_data_len; /*!< extend advertising data length */
|
||||
uint8_t adv_data[251]; /*!< extend advertising data */
|
||||
} esp_ble_gap_ext_adv_reprot_t;
|
||||
} esp_ble_gap_ext_adv_report_t;
|
||||
|
||||
/**
|
||||
* @brief periodic adv report parameters
|
||||
@@ -915,6 +980,27 @@ typedef struct {
|
||||
uint8_t adv_clk_accuracy; /*!< periodic advertising clock accuracy */
|
||||
} esp_ble_gap_periodic_adv_sync_estab_t;
|
||||
|
||||
/**
|
||||
* @brief DTM TX parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t tx_channel; /*!< channel for sending test data, tx_channel = (Frequency -2402)/2, tx_channel range:0x00-0x27, Frequency range: 2402 MHz to 2480 MHz */
|
||||
uint8_t len_of_data; /*!< length in bytes of payload data in each packet */
|
||||
esp_ble_dtm_pkt_payload_t pkt_payload; /*!< packet payload type. value range: 0x00-0x07 */
|
||||
esp_ble_gap_phy_t phy; /*!< the phy type used by the transmitter, coded phy with S=2:0x04 */
|
||||
} esp_ble_dtm_enh_tx_t;
|
||||
|
||||
/**
|
||||
* @brief DTM RX parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t rx_channel; /*!< channel for test data reception, rx_channel = (Frequency -2402)/2, tx_channel range:0x00-0x27, Frequency range: 2402 MHz to 2480 MHz */
|
||||
esp_ble_gap_phy_t phy; /*!< the phy type used by the receiver, 1M phy: 0x01, 2M phy:0x02, coded phy:0x03 */
|
||||
uint8_t modulation_idx; /*!< modulation index, 0x00:standard modulation index, 0x01:stable modulation index */
|
||||
} esp_ble_dtm_enh_rx_t;
|
||||
|
||||
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
@@ -936,6 +1022,11 @@ typedef struct {
|
||||
} esp_ble_gap_past_params_t;
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
typedef enum{
|
||||
ESP_BLE_NETWORK_PRIVACY_MODE = 0X00, /*!< Network Privacy Mode for peer device (default) */
|
||||
ESP_BLE_DEVICE_PRIVACY_MODE = 0X01, /*!< Device Privacy Mode for peer device */
|
||||
} esp_ble_privacy_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Gap callback parameters union
|
||||
*/
|
||||
@@ -1022,6 +1113,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
|
||||
@@ -1055,6 +1152,19 @@ typedef union {
|
||||
struct ble_local_privacy_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set local privacy operation success status */
|
||||
} local_privacy_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_rpa_timeout_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set RPA timeout operation success status */
|
||||
} set_rpa_timeout_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_add_dev_to_resolving_list_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicates the success status of adding a device to the resolving list */
|
||||
} add_dev_to_resolving_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT
|
||||
*/
|
||||
@@ -1325,7 +1435,7 @@ typedef union {
|
||||
* @brief ESP_GAP_BLE_EXT_ADV_REPORT_EVT
|
||||
*/
|
||||
struct ble_ext_adv_report_param {
|
||||
esp_ble_gap_ext_adv_reprot_t params; /*!< extend advertising report parameters */
|
||||
esp_ble_gap_ext_adv_report_t params; /*!< extend advertising report parameters */
|
||||
} ext_adv_report; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_REPORT_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_PERIODIC_ADV_REPORT_EVT
|
||||
@@ -1378,6 +1488,28 @@ typedef union {
|
||||
uint8_t adv_clk_accuracy; /*!< Periodic advertising clock accuracy */
|
||||
} past_received; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_SYNC_TRANS_RECV_EVT */
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_DTM_TEST_UPDATE_EVT
|
||||
*/
|
||||
struct ble_dtm_state_update_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate DTM operation success status */
|
||||
esp_ble_dtm_update_evt_t update_evt; /*!< DTM state change event, 0x00: DTM TX start, 0x01: DTM RX start, 0x02:DTM end */
|
||||
uint16_t num_of_pkt; /*!< number of packets received, only valid if update_evt is DTM_TEST_STOP_EVT and shall be reported as 0 for a transmitter */
|
||||
} dtm_state_update; /*!< Event parameter of ESP_GAP_BLE_DTM_TEST_UPDATE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT
|
||||
*/
|
||||
struct vendor_cmd_cmpl_evt_param {
|
||||
uint16_t opcode; /*!< vendor hci command opcode */
|
||||
uint16_t param_len; /*!< The length of parameter buffer */
|
||||
uint8_t *p_param_buf; /*!< The point of parameter buffer */
|
||||
} vendor_cmd_cmpl; /*!< Event parameter of ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_set_privacy_mode_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate privacy mode set operation success status */
|
||||
} set_privacy_mode_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@@ -1399,6 +1531,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.
|
||||
@@ -1506,13 +1647,13 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_
|
||||
*
|
||||
* @param[in] rand_addr: The address to be configured. Refer to the table below for possible address subtypes:
|
||||
*
|
||||
* | address [47:46] | Address Type |
|
||||
* |-----------------|--------------------------|
|
||||
* | 0b00 | Non-Resolvable Private |
|
||||
* | | Address |
|
||||
* |-----------------|--------------------------|
|
||||
* | 0b11 | Static Random Address |
|
||||
* |-----------------|--------------------------|
|
||||
* | address [47:46] | Address Type | Corresponding API |
|
||||
* |-----------------|-----------------------------|----------------------------------------|
|
||||
* | 0b00 | Non-Resolvable Private | esp_ble_gap_addr_create_nrpa |
|
||||
* | | Address (NRPA) | |
|
||||
* |-----------------|-----------------------------|----------------------------------------|
|
||||
* | 0b11 | Static Random Address | esp_ble_gap_addr_create_static |
|
||||
* |-----------------|-----------------------------|----------------------------------------|
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
@@ -1521,6 +1662,60 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
|
||||
|
||||
/**
|
||||
* @brief Create a static device address
|
||||
* @param[out] rand_addr: Pointer to the buffer where the static device address will be stored.
|
||||
* @return - ESP_OK : Success
|
||||
* - Other : Failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_addr_create_static(esp_bd_addr_t rand_addr);
|
||||
|
||||
/**
|
||||
* @brief Create a non-resolvable private address (NRPA)
|
||||
* @param[out] rand_addr: Pointer to the buffer where the NRPA will be stored.
|
||||
* @return - ESP_OK : Success
|
||||
* - Other : Failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_addr_create_nrpa(esp_bd_addr_t rand_addr);
|
||||
|
||||
/**
|
||||
* @brief This function sets the length of time the Controller uses a Resolvable Private Address
|
||||
* before generating and starting to use a new resolvable private address.
|
||||
*
|
||||
* @note Note: This function is currently not supported on the ESP32 but will be enabled in a future update.
|
||||
*
|
||||
* @param[in] rpa_timeout: The timeout duration in seconds for how long a Resolvable Private Address
|
||||
* is used before a new one is generated. The value must be within the range specified by
|
||||
* the Bluetooth specification (0x0001 to 0x0E10), which corresponds to a time range of
|
||||
* 1 second to 1 hour. The default value is 0x0384 (900 seconds or 15 minutes).
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeout);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function adds a device to the resolving list used to generate and resolve Resolvable Private Addresses
|
||||
* in the Controller.
|
||||
*
|
||||
* @note Note: This function shall not be used when address resolution is enabled in the Controller and:
|
||||
* - Advertising (other than periodic advertising) is enabled,
|
||||
* - Scanning is enabled, or
|
||||
* - an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection, or HCI_LE_Periodic_Advertising_Create_Sync command is pending.
|
||||
* This command may be used at any time when address resolution is disabled in the Controller.
|
||||
* The added device shall be set to Network Privacy mode.
|
||||
*
|
||||
* @param[in] peer_addr: The peer identity address of the device to be added to the resolving list.
|
||||
* @param[in] addr_type: The address type of the peer identity address (BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM).
|
||||
* @param[in] peer_irk: The Identity Resolving Key (IRK) of the device.
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_add_device_to_resolving_list(esp_bd_addr_t peer_addr, uint8_t addr_type, uint8_t *peer_irk);
|
||||
/**
|
||||
* @brief This function clears the random address for the application
|
||||
*
|
||||
@@ -1531,8 +1726,6 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
|
||||
*/
|
||||
esp_err_t esp_ble_gap_clear_rand_addr(void);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enable/disable privacy (including address resolution) on the local device
|
||||
*
|
||||
@@ -1847,7 +2040,6 @@ esp_err_t esp_ble_remove_bond_device(esp_bd_addr_t bd_addr);
|
||||
*/
|
||||
int esp_ble_get_bond_device_num(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the device from the security database list of peer device.
|
||||
* It will return the device bonded information immediately.
|
||||
@@ -2198,8 +2390,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 +2556,108 @@ 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)
|
||||
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
/**
|
||||
* @brief This function is used to start a test where the DUT generates reference packets
|
||||
* at a fixed interval.
|
||||
*
|
||||
* @param[in] tx_params : DTM Transmitter parameters
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_dtm_tx_start(const esp_ble_dtm_tx_t *tx_params);
|
||||
|
||||
/**
|
||||
* @brief This function is used to start a test where the DUT receives test reference packets
|
||||
* at a fixed interval.
|
||||
*
|
||||
* @param[in] rx_params : DTM Receiver parameters
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_dtm_rx_start(const esp_ble_dtm_rx_t *rx_params);
|
||||
#endif //#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
/**
|
||||
* @brief This function is used to start a test where the DUT generates reference packets
|
||||
* at a fixed interval.
|
||||
*
|
||||
* @param[in] tx_params : DTM Transmitter parameters
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_dtm_enh_tx_start(const esp_ble_dtm_enh_tx_t *tx_params);
|
||||
|
||||
/**
|
||||
* @brief This function is used to start a test where the DUT receives test reference packets
|
||||
* at a fixed interval.
|
||||
*
|
||||
* @param[in] rx_params : DTM Receiver parameters
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_dtm_enh_rx_start(const esp_ble_dtm_enh_rx_t *rx_params);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
/**
|
||||
* @brief This function is used to stop any test which is in progress
|
||||
*
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_dtm_stop(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to clear legacy advertising
|
||||
*
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_clear_advertising(void);
|
||||
|
||||
/**
|
||||
* @brief This function is called to send vendor hci command.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param[in] vendor_cmd_param: vendor hci command parameters
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cmd_param);
|
||||
|
||||
/**
|
||||
* @brief This function set the privacy mode of the device in resolving list.
|
||||
*
|
||||
* @note This feature is not supported on ESP32.
|
||||
*
|
||||
* @param[in] addr_type: The address type of the peer identity address (BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM).
|
||||
* @param[in] addr: The peer identity address of the device.
|
||||
* @param[in] mode: The privacy mode of the device.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_addr_t addr, esp_ble_privacy_mode_t mode);
|
||||
|
||||
#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 {
|
||||
/**
|
||||
|
||||
@@ -1,345 +1,552 @@
|
||||
// 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.
|
||||
|
||||
#ifndef __ESP_GATT_DEFS_H__
|
||||
#define __ESP_GATT_DEFS_H__
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// GATT INVALID UUID
|
||||
/** @brief GATT INVALID UUID. */
|
||||
#define ESP_GATT_ILLEGAL_UUID 0
|
||||
/// GATT INVALID HANDLE
|
||||
|
||||
/** @brief GATT INVALID HANDLE. */
|
||||
#define ESP_GATT_ILLEGAL_HANDLE 0
|
||||
/// GATT attribute max handle
|
||||
|
||||
/** @brief GATT attribute max handle. */
|
||||
#define ESP_GATT_ATTR_HANDLE_MAX UC_CONFIG_BT_GATT_MAX_SR_ATTRIBUTES
|
||||
#define ESP_GATT_MAX_READ_MULTI_HANDLES 10 /* Max attributes to read in one request */
|
||||
|
||||
/** @brief Maximum number of attributes to read in one request. */
|
||||
#define ESP_GATT_MAX_READ_MULTI_HANDLES 10
|
||||
|
||||
|
||||
/**@{
|
||||
* All "ESP_GATT_UUID_xxx" is attribute types
|
||||
/**
|
||||
* @defgroup GATT_UUIDs GATT Service UUIDs
|
||||
* @brief Definitions of GATT Service UUIDs.
|
||||
*
|
||||
* This module contains the definitions of standard GATT service UUIDs. These UUIDs
|
||||
* identify the type of GATT service.
|
||||
* @{
|
||||
*/
|
||||
#define ESP_GATT_UUID_IMMEDIATE_ALERT_SVC 0x1802 /* Immediate alert Service*/
|
||||
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/
|
||||
#define ESP_GATT_UUID_TX_POWER_SVC 0x1804 /* TX Power Service*/
|
||||
#define ESP_GATT_UUID_CURRENT_TIME_SVC 0x1805 /* Current Time Service Service*/
|
||||
#define ESP_GATT_UUID_REF_TIME_UPDATE_SVC 0x1806 /* Reference Time Update Service*/
|
||||
#define ESP_GATT_UUID_NEXT_DST_CHANGE_SVC 0x1807 /* Next DST Change Service*/
|
||||
#define ESP_GATT_UUID_GLUCOSE_SVC 0x1808 /* Glucose Service*/
|
||||
#define ESP_GATT_UUID_HEALTH_THERMOM_SVC 0x1809 /* Health Thermometer Service*/
|
||||
#define ESP_GATT_UUID_DEVICE_INFO_SVC 0x180A /* Device Information Service*/
|
||||
#define ESP_GATT_UUID_HEART_RATE_SVC 0x180D /* Heart Rate Service*/
|
||||
#define ESP_GATT_UUID_PHONE_ALERT_STATUS_SVC 0x180E /* Phone Alert Status Service*/
|
||||
#define ESP_GATT_UUID_BATTERY_SERVICE_SVC 0x180F /* Battery Service*/
|
||||
#define ESP_GATT_UUID_BLOOD_PRESSURE_SVC 0x1810 /* Blood Pressure Service*/
|
||||
#define ESP_GATT_UUID_ALERT_NTF_SVC 0x1811 /* Alert Notification Service*/
|
||||
#define ESP_GATT_UUID_HID_SVC 0x1812 /* HID Service*/
|
||||
#define ESP_GATT_UUID_SCAN_PARAMETERS_SVC 0x1813 /* Scan Parameters Service*/
|
||||
#define ESP_GATT_UUID_RUNNING_SPEED_CADENCE_SVC 0x1814 /* Running Speed and Cadence Service*/
|
||||
#define ESP_GATT_UUID_Automation_IO_SVC 0x1815 /* Automation IO Service*/
|
||||
#define ESP_GATT_UUID_CYCLING_SPEED_CADENCE_SVC 0x1816 /* Cycling Speed and Cadence Service*/
|
||||
#define ESP_GATT_UUID_CYCLING_POWER_SVC 0x1818 /* Cycling Power Service*/
|
||||
#define ESP_GATT_UUID_LOCATION_AND_NAVIGATION_SVC 0x1819 /* Location and Navigation Service*/
|
||||
#define ESP_GATT_UUID_ENVIRONMENTAL_SENSING_SVC 0x181A /* Environmental Sensing Service*/
|
||||
#define ESP_GATT_UUID_BODY_COMPOSITION 0x181B /* Body Composition Service*/
|
||||
#define ESP_GATT_UUID_USER_DATA_SVC 0x181C /* User Data Service*/
|
||||
#define ESP_GATT_UUID_WEIGHT_SCALE_SVC 0x181D /* Weight Scale Service*/
|
||||
#define ESP_GATT_UUID_BOND_MANAGEMENT_SVC 0x181E /* Bond Management Service*/
|
||||
#define ESP_GATT_UUID_CONT_GLUCOSE_MONITOR_SVC 0x181F /* Continuous Glucose Monitoring Service*/
|
||||
|
||||
/** @brief Immediate Alert Service UUID. */
|
||||
#define ESP_GATT_UUID_IMMEDIATE_ALERT_SVC 0x1802
|
||||
/** @brief Link Loss Service UUID. */
|
||||
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803
|
||||
/** @brief TX Power Service UUID. */
|
||||
#define ESP_GATT_UUID_TX_POWER_SVC 0x1804
|
||||
/** @brief Current Time Service UUID. */
|
||||
#define ESP_GATT_UUID_CURRENT_TIME_SVC 0x1805
|
||||
/** @brief Reference Time Update Service UUID. */
|
||||
#define ESP_GATT_UUID_REF_TIME_UPDATE_SVC 0x1806
|
||||
/** @brief Next DST Change Service UUID. */
|
||||
#define ESP_GATT_UUID_NEXT_DST_CHANGE_SVC 0x1807
|
||||
/** @brief Glucose Service UUID. */
|
||||
#define ESP_GATT_UUID_GLUCOSE_SVC 0x1808
|
||||
/** @brief Health Thermometer Service UUID. */
|
||||
#define ESP_GATT_UUID_HEALTH_THERMOM_SVC 0x1809
|
||||
/** @brief Device Information Service UUID. */
|
||||
#define ESP_GATT_UUID_DEVICE_INFO_SVC 0x180A
|
||||
/** @brief Heart Rate Service UUID. */
|
||||
#define ESP_GATT_UUID_HEART_RATE_SVC 0x180D
|
||||
/** @brief Phone Alert Status Service UUID. */
|
||||
#define ESP_GATT_UUID_PHONE_ALERT_STATUS_SVC 0x180E
|
||||
/** @brief Battery Service UUID. */
|
||||
#define ESP_GATT_UUID_BATTERY_SERVICE_SVC 0x180F
|
||||
/** @brief Blood Pressure Service UUID. */
|
||||
#define ESP_GATT_UUID_BLOOD_PRESSURE_SVC 0x1810
|
||||
/** @brief Alert Notification Service UUID. */
|
||||
#define ESP_GATT_UUID_ALERT_NTF_SVC 0x1811
|
||||
/** @brief HID Service UUID. */
|
||||
#define ESP_GATT_UUID_HID_SVC 0x1812
|
||||
/** @brief Scan Parameters Service UUID. */
|
||||
#define ESP_GATT_UUID_SCAN_PARAMETERS_SVC 0x1813
|
||||
/** @brief Running Speed and Cadence Service UUID. */
|
||||
#define ESP_GATT_UUID_RUNNING_SPEED_CADENCE_SVC 0x1814
|
||||
/** @brief Automation IO Service UUID. */
|
||||
#define ESP_GATT_UUID_Automation_IO_SVC 0x1815
|
||||
/** @brief Cycling Speed and Cadence Service UUID. */
|
||||
#define ESP_GATT_UUID_CYCLING_SPEED_CADENCE_SVC 0x1816
|
||||
/** @brief Cycling Power Service UUID. */
|
||||
#define ESP_GATT_UUID_CYCLING_POWER_SVC 0x1818
|
||||
/** @brief Location and Navigation Service UUID. */
|
||||
#define ESP_GATT_UUID_LOCATION_AND_NAVIGATION_SVC 0x1819
|
||||
/** @brief Environmental Sensing Service UUID. */
|
||||
#define ESP_GATT_UUID_ENVIRONMENTAL_SENSING_SVC 0x181A
|
||||
/** @brief Body Composition Service UUID. */
|
||||
#define ESP_GATT_UUID_BODY_COMPOSITION 0x181B
|
||||
/** @brief User Data Service UUID. */
|
||||
#define ESP_GATT_UUID_USER_DATA_SVC 0x181C
|
||||
/** @brief Weight Scale Service UUID. */
|
||||
#define ESP_GATT_UUID_WEIGHT_SCALE_SVC 0x181D
|
||||
/** @brief Bond Management Service UUID. */
|
||||
#define ESP_GATT_UUID_BOND_MANAGEMENT_SVC 0x181E
|
||||
/** @brief Continuous Glucose Monitoring Service UUID. */
|
||||
#define ESP_GATT_UUID_CONT_GLUCOSE_MONITOR_SVC 0x181F
|
||||
/** @brief Primary Service UUID. */
|
||||
#define ESP_GATT_UUID_PRI_SERVICE 0x2800
|
||||
/** @brief Secondary Service UUID. */
|
||||
#define ESP_GATT_UUID_SEC_SERVICE 0x2801
|
||||
/** @brief Include Service UUID. */
|
||||
#define ESP_GATT_UUID_INCLUDE_SERVICE 0x2802
|
||||
#define ESP_GATT_UUID_CHAR_DECLARE 0x2803 /* Characteristic Declaration*/
|
||||
|
||||
#define ESP_GATT_UUID_CHAR_EXT_PROP 0x2900 /* Characteristic Extended Properties */
|
||||
#define ESP_GATT_UUID_CHAR_DESCRIPTION 0x2901 /* Characteristic User Description*/
|
||||
#define ESP_GATT_UUID_CHAR_CLIENT_CONFIG 0x2902 /* Client Characteristic Configuration */
|
||||
#define ESP_GATT_UUID_CHAR_SRVR_CONFIG 0x2903 /* Server Characteristic Configuration */
|
||||
#define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904 /* Characteristic Presentation Format*/
|
||||
#define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905 /* Characteristic Aggregate Format*/
|
||||
#define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906 /* Characteristic Valid Range */
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907 /* External Report Reference */
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908 /* Report Reference */
|
||||
#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909 /* Number of Digitals */
|
||||
#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A /* Value Trigger Setting */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B /* Environmental Sensing Configuration */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C /* Environmental Sensing Measurement */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D /* Environmental Sensing Trigger Setting */
|
||||
#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E /* Time Trigger Setting */
|
||||
/** @brief Characteristic Declaration UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_DECLARE 0x2803
|
||||
/** @brief Characteristic Extended Properties UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_EXT_PROP 0x2900
|
||||
/** @brief Characteristic User Description UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_DESCRIPTION 0x2901
|
||||
/** @brief Client Characteristic Configuration UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_CLIENT_CONFIG 0x2902
|
||||
/** @brief Server Characteristic Configuration UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_SRVR_CONFIG 0x2903
|
||||
/** @brief Characteristic Presentation Format UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904
|
||||
/** @brief Characteristic Aggregate Format UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905
|
||||
/** @brief Characteristic Valid Range UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906
|
||||
/** @brief External Report Reference Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907
|
||||
/** @brief Report Reference Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908
|
||||
/** @brief Number of Digitals Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909
|
||||
/** @brief Value Trigger Setting Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A
|
||||
/** @brief Environmental Sensing Configuration Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B
|
||||
/** @brief Environmental Sensing Measurement Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C
|
||||
/** @brief Environmental Sensing Trigger Setting Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D
|
||||
/** @brief Time Trigger Setting Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E
|
||||
|
||||
/* GAP Profile Attributes */
|
||||
/** @brief GAP Device Name UUID. */
|
||||
#define ESP_GATT_UUID_GAP_DEVICE_NAME 0x2A00
|
||||
/** @brief GAP Icon UUID. */
|
||||
#define ESP_GATT_UUID_GAP_ICON 0x2A01
|
||||
/** @brief GAP Preferred Connection Parameters UUID. */
|
||||
#define ESP_GATT_UUID_GAP_PREF_CONN_PARAM 0x2A04
|
||||
/** @brief GAP Central Address Resolution UUID. */
|
||||
#define ESP_GATT_UUID_GAP_CENTRAL_ADDR_RESOL 0x2AA6
|
||||
|
||||
/* Attribute Profile Attribute UUID */
|
||||
/** @brief GATT Service Changed UUID. */
|
||||
#define ESP_GATT_UUID_GATT_SRV_CHGD 0x2A05
|
||||
|
||||
/* Link ESP_Loss Service */
|
||||
#define ESP_GATT_UUID_ALERT_LEVEL 0x2A06 /* Alert Level */
|
||||
#define ESP_GATT_UUID_TX_POWER_LEVEL 0x2A07 /* TX power level */
|
||||
/* Link Loss Service */
|
||||
/** @brief Alert Level UUID. */
|
||||
#define ESP_GATT_UUID_ALERT_LEVEL 0x2A06
|
||||
/** @brief TX Power Level UUID. */
|
||||
#define ESP_GATT_UUID_TX_POWER_LEVEL 0x2A07
|
||||
|
||||
/* Current Time Service */
|
||||
#define ESP_GATT_UUID_CURRENT_TIME 0x2A2B /* Current Time */
|
||||
#define ESP_GATT_UUID_LOCAL_TIME_INFO 0x2A0F /* Local time info */
|
||||
#define ESP_GATT_UUID_REF_TIME_INFO 0x2A14 /* reference time information */
|
||||
/** @brief Current Time UUID. */
|
||||
#define ESP_GATT_UUID_CURRENT_TIME 0x2A2B
|
||||
/** @brief Local Time Info UUID. */
|
||||
#define ESP_GATT_UUID_LOCAL_TIME_INFO 0x2A0F
|
||||
/** @brief Reference Time Information UUID. */
|
||||
#define ESP_GATT_UUID_REF_TIME_INFO 0x2A14
|
||||
|
||||
/* Network availability Profile */
|
||||
#define ESP_GATT_UUID_NW_STATUS 0x2A18 /* network availability status */
|
||||
#define ESP_GATT_UUID_NW_TRIGGER 0x2A1A /* Network availability trigger */
|
||||
/* Network Availability Service */
|
||||
/** @brief Network Availability Status UUID. */
|
||||
#define ESP_GATT_UUID_NW_STATUS 0x2A18
|
||||
/** @brief Network Availability Trigger UUID. */
|
||||
#define ESP_GATT_UUID_NW_TRIGGER 0x2A1A
|
||||
|
||||
/* Phone alert */
|
||||
#define ESP_GATT_UUID_ALERT_STATUS 0x2A3F /* alert status */
|
||||
#define ESP_GATT_UUID_RINGER_CP 0x2A40 /* ringer control point */
|
||||
#define ESP_GATT_UUID_RINGER_SETTING 0x2A41 /* ringer setting */
|
||||
/* Phone Alert Status Service */
|
||||
/** @brief Alert Status UUID. */
|
||||
#define ESP_GATT_UUID_ALERT_STATUS 0x2A3F
|
||||
/** @brief Ringer Control Point UUID. */
|
||||
#define ESP_GATT_UUID_RINGER_CP 0x2A40
|
||||
/** @brief Ringer Setting UUID. */
|
||||
#define ESP_GATT_UUID_RINGER_SETTING 0x2A41
|
||||
|
||||
/* Glucose Service */
|
||||
/** @brief Glucose Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_MEASUREMENT 0x2A18
|
||||
/** @brief Glucose Measurement Context Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_CONTEXT 0x2A34
|
||||
/** @brief Glucose Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_CONTROL_POINT 0x2A52
|
||||
/** @brief Glucose Feature Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_FEATURE 0x2A51
|
||||
|
||||
/* device information characteristic */
|
||||
/* Device Information Service Characteristics */
|
||||
/** @brief System ID Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SYSTEM_ID 0x2A23
|
||||
/** @brief Model Number String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_MODEL_NUMBER_STR 0x2A24
|
||||
/** @brief Serial Number String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SERIAL_NUMBER_STR 0x2A25
|
||||
/** @brief Firmware Revision String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_FW_VERSION_STR 0x2A26
|
||||
/** @brief Hardware Revision String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HW_VERSION_STR 0x2A27
|
||||
/** @brief Software Revision String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SW_VERSION_STR 0x2A28
|
||||
/** @brief Manufacturer Name String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_MANU_NAME 0x2A29
|
||||
/** @brief IEEE 11073-20601 Regulatory Certification Data List Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_IEEE_DATA 0x2A2A
|
||||
/** @brief PnP ID Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_PNP_ID 0x2A50
|
||||
|
||||
/* HID characteristics */
|
||||
/* HID Service Characteristics */
|
||||
/** @brief HID Information Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_INFORMATION 0x2A4A
|
||||
/** @brief HID Report Map Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_REPORT_MAP 0x2A4B
|
||||
/** @brief HID Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_CONTROL_POINT 0x2A4C
|
||||
/** @brief HID Report Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_REPORT 0x2A4D
|
||||
/** @brief HID Protocol Mode Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_PROTO_MODE 0x2A4E
|
||||
/** @brief HID Bluetooth Keyboard Input Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_BT_KB_INPUT 0x2A22
|
||||
/** @brief HID Bluetooth Keyboard Output Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_BT_KB_OUTPUT 0x2A32
|
||||
/** @brief HID Bluetooth Mouse Input Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_BT_MOUSE_INPUT 0x2A33
|
||||
|
||||
/// Heart Rate Measurement
|
||||
#define ESP_GATT_HEART_RATE_MEAS 0x2A37
|
||||
/// Body Sensor Location
|
||||
#define ESP_GATT_BODY_SENSOR_LOCATION 0x2A38
|
||||
/// Heart Rate Control Point
|
||||
#define ESP_GATT_HEART_RATE_CNTL_POINT 0x2A39
|
||||
/* Heart Rate Service Characteristics */
|
||||
/** @brief Heart Rate Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_HEART_RATE_MEAS 0x2A37
|
||||
/** @brief Body Sensor Location Characteristic UUID. */
|
||||
#define ESP_GATT_BODY_SENSOR_LOCATION 0x2A38
|
||||
/** @brief Heart Rate Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_HEART_RATE_CNTL_POINT 0x2A39
|
||||
|
||||
/* Battery Service characteristics */
|
||||
/* Battery Service Characteristics */
|
||||
/** @brief Battery Level Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_BATTERY_LEVEL 0x2A19
|
||||
|
||||
/* Sensor Service */
|
||||
/* Sensor Service Characteristics */
|
||||
/** @brief Sensor Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SC_CONTROL_POINT 0x2A55
|
||||
/** @brief Sensor Location Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SENSOR_LOCATION 0x2A5D
|
||||
|
||||
/* Runners speed and cadence service */
|
||||
/* Running Speed and Cadence Service Characteristics */
|
||||
/** @brief RSC Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_RSC_MEASUREMENT 0x2A53
|
||||
/** @brief RSC Feature Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_RSC_FEATURE 0x2A54
|
||||
|
||||
/* Cycling speed and cadence service */
|
||||
/* Cycling Speed and Cadence Service Characteristics */
|
||||
/** @brief CSC Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_CSC_MEASUREMENT 0x2A5B
|
||||
/** @brief CSC Feature Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_CSC_FEATURE 0x2A5C
|
||||
|
||||
/* Scan ESP_Parameter characteristics */
|
||||
/* Scan Parameters Service Characteristics */
|
||||
/** @brief Scan Interval Window Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SCAN_INT_WINDOW 0x2A4F
|
||||
/** @brief Scan Refresh UUID. */
|
||||
#define ESP_GATT_UUID_SCAN_REFRESH 0x2A31
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/* Additional GATT Services not covered yet */
|
||||
/** @} */ // End of group GATT_UUIDs
|
||||
|
||||
/* relate to BTA_GATT_PREP_WRITE_xxx in bta/bta_gatt_api.h */
|
||||
/// Attribute write data type from the client
|
||||
|
||||
/**
|
||||
* @brief Defines the attribute write operation types from the client.
|
||||
*
|
||||
* These values are used to specify the type of write operation in a prepare write sequence.
|
||||
* relate to BTA_GATT_PREP_WRITE_xxx in bta/bta_gatt_api.h.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel */ /* relate to BTA_GATT_PREP_WRITE_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute */ /* relate to BTA_GATT_PREP_WRITE_EXEC in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel. Corresponds to BTA_GATT_PREP_WRITE_CANCEL. */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute. Corresponds to BTA_GATT_PREP_WRITE_EXEC. */
|
||||
} esp_gatt_prep_write_type;
|
||||
|
||||
/* relate to BTA_GATT_xxx in bta/bta_gatt_api.h */
|
||||
|
||||
/**
|
||||
* @brief GATT success code and error codes
|
||||
* @brief GATT operation status codes.
|
||||
*
|
||||
* These status codes are used to indicate the result of various GATT operations.
|
||||
* relate to BTA_GATT_xxx in bta/bta_gatt_api.h .
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_OK = 0x0, /* relate to BTA_GATT_OK in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /* 0x0001 */ /* relate to BTA_GATT_INVALID_HANDLE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /* 0x0002 */ /* relate to BTA_GATT_READ_NOT_PERMIT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /* 0x0003 */ /* relate to BTA_GATT_WRITE_NOT_PERMIT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /* 0x0004 */ /* relate to BTA_GATT_INVALID_PDU in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /* 0x0005 */ /* relate to BTA_GATT_INSUF_AUTHENTICATION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /* 0x0006 */ /* relate to BTA_GATT_REQ_NOT_SUPPORTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /* 0x0007 */ /* relate to BTA_GATT_INVALID_OFFSET in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /* 0x0008 */ /* relate to BTA_GATT_INSUF_AUTHORIZATION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /* 0x0009 */ /* relate to BTA_GATT_PREPARE_Q_FULL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /* 0x000a */ /* relate to BTA_GATT_NOT_FOUND in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /* 0x000b */ /* relate to BTA_GATT_NOT_LONG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /* 0x000c */ /* relate to BTA_GATT_INSUF_KEY_SIZE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /* 0x000d */ /* relate to BTA_GATT_INVALID_ATTR_LEN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /* 0x000e */ /* relate to BTA_GATT_ERR_UNLIKELY in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /* 0x000f */ /* relate to BTA_GATT_INSUF_ENCRYPTION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /* 0x0010 */ /* relate to BTA_GATT_UNSUPPORT_GRP_TYPE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /* 0x0011 */ /* relate to BTA_GATT_INSUF_RESOURCE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_OK = 0x0, /*!< 0x0, Operation successful. Corresponds to BTA_GATT_OK. */
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /*!< 0x01, Invalid handle. Corresponds to BTA_GATT_INVALID_HANDLE. */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /*!< 0x02, Read operation not permitted. Corresponds to BTA_GATT_READ_NOT_PERMIT. */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /*!< 0x03, Write operation not permitted. Corresponds to BTA_GATT_WRITE_NOT_PERMIT. */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /*!< 0x04, Invalid PDU. Corresponds to BTA_GATT_INVALID_PDU. */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /*!< 0x05, Insufficient authentication. Corresponds to BTA_GATT_INSUF_AUTHENTICATION. */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /*!< 0x06, Request not supported. Corresponds to BTA_GATT_REQ_NOT_SUPPORTED. */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /*!< 0x07, Invalid offset. Corresponds to BTA_GATT_INVALID_OFFSET. */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /*!< 0x08, Insufficient authorization. Corresponds to BTA_GATT_INSUF_AUTHORIZATION. */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /*!< 0x09, Prepare queue full. Corresponds to BTA_GATT_PREPARE_Q_FULL. */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /*!< 0x0a, Not found. Corresponds to BTA_GATT_NOT_FOUND. */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /*!< 0x0b, Not long. Corresponds to BTA_GATT_NOT_LONG. */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /*!< 0x0c, Insufficient key size. Corresponds to BTA_GATT_INSUF_KEY_SIZE. */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /*!< 0x0d, Invalid attribute length. Corresponds to BTA_GATT_INVALID_ATTR_LEN. */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /*!< 0x0e, Unlikely error. Corresponds to BTA_GATT_ERR_UNLIKELY. */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /*!< 0x0f, Insufficient encryption. Corresponds to BTA_GATT_INSUF_ENCRYPTION. */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /*!< 0x10, Unsupported group type. Corresponds to BTA_GATT_UNSUPPORT_GRP_TYPE. */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /*!< 0x11, Insufficient resource. Corresponds to BTA_GATT_INSUF_RESOURCE. */
|
||||
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /* 0x80 */ /* relate to BTA_GATT_NO_RESOURCES in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /* 0x81 */ /* relate to BTA_GATT_INTERNAL_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /* 0x82 */ /* relate to BTA_GATT_WRONG_STATE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_DB_FULL = 0x83, /* 0x83 */ /* relate to BTA_GATT_DB_FULL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_BUSY = 0x84, /* 0x84 */ /* relate to BTA_GATT_BUSY in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ERROR = 0x85, /* 0x85 */ /* relate to BTA_GATT_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /* 0x86 */ /* relate to BTA_GATT_CMD_STARTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /* 0x87 */ /* relate to BTA_GATT_ILLEGAL_PARAMETER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PENDING = 0x88, /* 0x88 */ /* relate to BTA_GATT_PENDING in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /* 0x89 */ /* relate to BTA_GATT_AUTH_FAIL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_MORE = 0x8a, /* 0x8a */ /* relate to BTA_GATT_MORE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /* 0x8b */ /* relate to BTA_GATT_INVALID_CFG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /* 0x8c */ /* relate to BTA_GATT_SERVICE_STARTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_MITM = ESP_GATT_OK, /* relate to BTA_GATT_ENCRYPED_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_NO_MITM = 0x8d, /* 0x8d */ /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /* 0x8e */ /* relate to BTA_GATT_NOT_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONGESTED = 0x8f, /* 0x8f */ /* relate to BTA_GATT_CONGESTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_DUP_REG = 0x90, /* 0x90 */ /* relate to BTA_GATT_DUP_REG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /* 0x91 */ /* relate to BTA_GATT_ALREADY_OPEN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CANCEL = 0x92, /* 0x92 */ /* relate to BTA_GATT_CANCEL in bta/bta_gatt_api.h */
|
||||
/* Additional error codes specific to implementation or future use */
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /*!< 0x80, No resources. Corresponds to BTA_GATT_NO_RESOURCES. */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /*!< 0x81, Internal error. Corresponds to BTA_GATT_INTERNAL_ERROR. */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /*!< 0x82, Wrong state. Corresponds to BTA_GATT_WRONG_STATE. */
|
||||
ESP_GATT_DB_FULL = 0x83, /*!< 0x83, Database full. Corresponds to BTA_GATT_DB_FULL. */
|
||||
ESP_GATT_BUSY = 0x84, /*!< 0x84, Busy. Corresponds to BTA_GATT_BUSY. */
|
||||
ESP_GATT_ERROR = 0x85, /*!< 0x85, Generic error. Corresponds to BTA_GATT_ERROR. */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /*!< 0x86, Command started. Corresponds to BTA_GATT_CMD_STARTED. */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /*!< 0x87, Illegal parameter. Corresponds to BTA_GATT_ILLEGAL_PARAMETER. */
|
||||
ESP_GATT_PENDING = 0x88, /*!< 0x88, Operation pending. Corresponds to BTA_GATT_PENDING. */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /*!< 0x89, Authentication failed. Corresponds to BTA_GATT_AUTH_FAIL. */
|
||||
ESP_GATT_MORE = 0x8a, /*!< 0x8a, More data available. Corresponds to BTA_GATT_MORE. */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /*!< 0x8b, Invalid configuration. Corresponds to BTA_GATT_INVALID_CFG. */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /*!< 0x8c, Service started. Corresponds to BTA_GATT_SERVICE_STARTED. */
|
||||
ESP_GATT_ENCRYPTED_MITM = ESP_GATT_OK, /*!< 0x0, Encrypted, with MITM protection. Corresponds to BTA_GATT_ENCRYPTED_MITM. */
|
||||
ESP_GATT_ENCRYPTED_NO_MITM = 0x8d, /*!< 0x8d, Encrypted, without MITM protection. Corresponds to BTA_GATT_ENCRYPTED_NO_MITM. */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /*!< 0x8e, Not encrypted. Corresponds to BTA_GATT_NOT_ENCRYPTED. */
|
||||
ESP_GATT_CONGESTED = 0x8f, /*!< 0x8f, Congested. Corresponds to BTA_GATT_CONGESTED. */
|
||||
ESP_GATT_DUP_REG = 0x90, /*!< 0x90, Duplicate registration. Corresponds to BTA_GATT_DUP_REG. */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /*!< 0x91, Already open. Corresponds to BTA_GATT_ALREADY_OPEN. */
|
||||
ESP_GATT_CANCEL = 0x92, /*!< 0x92, Operation cancelled. Corresponds to BTA_GATT_CANCEL. */
|
||||
/* 0xE0 ~ 0xFC reserved for future use */
|
||||
ESP_GATT_STACK_RSP = 0xe0, /* 0xe0 */ /* relate to BTA_GATT_STACK_RSP in bta/bta_gatt_api.h */
|
||||
ESP_GATT_APP_RSP = 0xe1, /* 0xe1 */ /* relate to BTA_GATT_APP_RSP in bta/bta_gatt_api.h */
|
||||
//Error caused by customer application or stack bug
|
||||
ESP_GATT_UNKNOWN_ERROR = 0xef, /* 0xef */ /* relate to BTA_GATT_UNKNOWN_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */ /* relate to BTA_GATT_CCC_CFG_ERR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /* 0xFE Procedure Already in progress */ /* relate to BTA_GATT_PRC_IN_PROGRESS in bta/bta_gatt_api.h */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff, /* 0xFFAttribute value out of range */ /* relate to BTA_GATT_OUT_OF_RANGE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_STACK_RSP = 0xe0, /*!< 0xe0, Stack response. Corresponds to BTA_GATT_STACK_RSP. */
|
||||
ESP_GATT_APP_RSP = 0xe1, /*!< 0xe1, Application response. Corresponds to BTA_GATT_APP_RSP. */
|
||||
/* Error caused by customer application or stack bug */
|
||||
ESP_GATT_UNKNOWN_ERROR = 0xef, /*!< 0xef, Unknown error. Corresponds to BTA_GATT_UNKNOWN_ERROR. */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /*!< 0xfd, Client Characteristic Configuration Descriptor improperly configured. Corresponds to BTA_GATT_CCC_CFG_ERR. */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /*!< 0xfe, Procedure already in progress. Corresponds to BTA_GATT_PRC_IN_PROGRESS. */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff /*!< 0xff, Attribute value out of range. Corresponds to BTA_GATT_OUT_OF_RANGE. */
|
||||
} esp_gatt_status_t;
|
||||
|
||||
/* relate to BTA_GATT_CONN_xxx in bta/bta_gatt_api.h */
|
||||
|
||||
/**
|
||||
* @brief Gatt Connection reason enum
|
||||
* @brief Enumerates reasons for GATT connection.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Gatt connection unknown */ /* relate to BTA_GATT_CONN_UNKNOWN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2cap failure */ /* relate to BTA_GATT_CONN_L2C_FAILURE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout */ /* relate to BTA_GATT_CONN_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminate by peer user */ /* relate to BTA_GATT_CONN_TERMINATE_PEER_USER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connection terminated by local host */ /* relate to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Connection fail to establish */ /* relate to BTA_GATT_CONN_FAIL_ESTABLISH in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection fail for LMP response tout */ /* relate to BTA_GATT_CONN_LMP_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled */ /* relate to BTA_GATT_CONN_CONN_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel */ /* relate to BTA_GATT_CONN_NONE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Unknown connection reason. Corresponds to BTA_GATT_CONN_UNKNOWN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2CAP failure. Corresponds to BTA_GATT_CONN_L2C_FAILURE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout. Corresponds to BTA_GATT_CONN_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminated by peer user. Corresponds to BTA_GATT_CONN_TERMINATE_PEER_USER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connection terminated by local host. Corresponds to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Failure to establish connection. Corresponds to BTA_GATT_CONN_FAIL_ESTABLISH in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection failed due to LMP response timeout. Corresponds to BTA_GATT_CONN_LMP_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled. Corresponds to BTA_GATT_CONN_CONN_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel. Corresponds to BTA_GATT_CONN_NONE in bta/bta_gatt_api.h */
|
||||
} esp_gatt_conn_reason_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gatt id, include uuid and instance id
|
||||
* @brief Represents a GATT identifier.
|
||||
*/
|
||||
typedef struct {
|
||||
esp_bt_uuid_t uuid; /*!< UUID */
|
||||
uint8_t inst_id; /*!< Instance id */
|
||||
esp_bt_uuid_t uuid; /*!< @brief The UUID component of the GATT ID. */
|
||||
uint8_t inst_id; /*!< @brief The instance ID component of the GATT ID, providing further differentiation of the GATT ID. */
|
||||
} __attribute__((packed)) esp_gatt_id_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gatt service id, include id
|
||||
* (uuid and instance id) and primary flag
|
||||
* @brief Represents a GATT service identifier.
|
||||
*/
|
||||
typedef struct {
|
||||
esp_gatt_id_t id; /*!< Gatt id, include uuid and instance */
|
||||
bool is_primary; /*!< This service is primary or not */
|
||||
esp_gatt_id_t id; /*!< @brief Encapsulates the UUID and instance ID of the GATT service. */
|
||||
bool is_primary; /*!< @brief Indicates if the service is primary. A value of true means it is a primary service, false indicates a secondary service. */
|
||||
} __attribute__((packed)) esp_gatt_srvc_id_t;
|
||||
|
||||
/* relate to BTA_GATT_AUTH_REQ_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Gatt authentication request type
|
||||
* @brief Defines the GATT authentication request types.
|
||||
*
|
||||
* This enumeration lists the types of authentication requests that can be made.
|
||||
* It corresponds to the `BTA_GATT_AUTH_REQ_xxx` values defined in `bta/bta_gatt_api.h`.
|
||||
* The types include options for no authentication, unauthenticated encryption, authenticated encryption,
|
||||
* and both signed versions with and without MITM (Man-In-The-Middle) protection.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_AUTH_REQ_NONE = 0, /* relate to BTA_GATT_AUTH_REQ_NONE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /* unauthenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /* authenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3, /* relate to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4, /* relate to BTA_GATT_AUTH_REQ_SIGNED_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NONE = 0, /*!< No authentication required. Corresponds to BTA_GATT_AUTH_REQ_NONE. */
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /*!< Unauthenticated encryption. Corresponds to BTA_GATT_AUTH_REQ_NO_MITM. */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /*!< Authenticated encryption (MITM protection). Corresponds to BTA_GATT_AUTH_REQ_MITM. */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3, /*!< Signed data, no MITM protection. Corresponds to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM. */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4, /*!< Signed data with MITM protection. Corresponds to BTA_GATT_AUTH_REQ_SIGNED_MITM. */
|
||||
} esp_gatt_auth_req_t;
|
||||
|
||||
/* relate to BTA_GATT_PERM_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Attribute permissions
|
||||
*/
|
||||
#define ESP_GATT_PERM_READ (1 << 0) /* bit 0 - 0x0001 */ /* relate to BTA_GATT_PERM_READ in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENCRYPTED (1 << 1) /* bit 1 - 0x0002 */ /* relate to BTA_GATT_PERM_READ_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENC_MITM (1 << 2) /* bit 2 - 0x0004 */ /* relate to BTA_GATT_PERM_READ_ENC_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE (1 << 4) /* bit 4 - 0x0010 */ /* relate to BTA_GATT_PERM_WRITE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENCRYPTED (1 << 5) /* bit 5 - 0x0020 */ /* relate to BTA_GATT_PERM_WRITE_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 - 0x0040 */ /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 - 0x0080 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 - 0x0100 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_AUTHORIZATION (1 << 9) /* bit 9 - 0x0200 */
|
||||
#define ESP_GATT_PERM_WRITE_AUTHORIZATION (1 << 10) /* bit 10 - 0x0400 */
|
||||
#define ESP_GATT_PERM_ENCRYPT_KEY_SIZE(keysize) (((keysize - 6) & 0xF) << 12) /* bit 12:15 - 0xF000 */
|
||||
typedef uint16_t esp_gatt_perm_t;
|
||||
|
||||
/* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta/bta_gatt_api.h */
|
||||
/* definition of characteristic properties */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_BROADCAST (1 << 0) /* 0x01 */ /* relate to BTA_GATT_CHAR_PROP_BIT_BROADCAST in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_READ (1 << 1) /* 0x02 */ /* relate to BTA_GATT_CHAR_PROP_BIT_READ in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2) /* 0x04 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE_NR in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE (1 << 3) /* 0x08 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_NOTIFY (1 << 4) /* 0x10 */ /* relate to BTA_GATT_CHAR_PROP_BIT_NOTIFY in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_INDICATE (1 << 5) /* 0x20 */ /* relate to BTA_GATT_CHAR_PROP_BIT_INDICATE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_AUTH (1 << 6) /* 0x40 */ /* relate to BTA_GATT_CHAR_PROP_BIT_AUTH in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7) /* 0x80 */ /* relate to BTA_GATT_CHAR_PROP_BIT_EXT_PROP in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Defines GATT attribute permission flags.
|
||||
*
|
||||
* These permission flags are used to specify the security requirements for GATT attributes.
|
||||
* They correlate directly with the BTA_GATT_PERM_xxx definitions found in bta/bta_gatt_api.h.
|
||||
*/
|
||||
|
||||
/** @defgroup GATT_PERMS GATT Attribute Permissions
|
||||
* @brief Definitions of permission flags for GATT attributes.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Permission to read the attribute. Corresponds to BTA_GATT_PERM_READ. */
|
||||
#define ESP_GATT_PERM_READ (1 << 0)
|
||||
|
||||
/** @brief Permission to read the attribute with encryption. Corresponds to BTA_GATT_PERM_READ_ENCRYPTED. */
|
||||
#define ESP_GATT_PERM_READ_ENCRYPTED (1 << 1)
|
||||
|
||||
/** @brief Permission to read the attribute with encrypted MITM (Man In The Middle) protection. Corresponds to BTA_GATT_PERM_READ_ENC_MITM.*/
|
||||
#define ESP_GATT_PERM_READ_ENC_MITM (1 << 2)
|
||||
|
||||
/** @brief Permission to write to the attribute. Corresponds to BTA_GATT_PERM_WRITE. */
|
||||
#define ESP_GATT_PERM_WRITE (1 << 4)
|
||||
|
||||
/** @brief Permission to write to the attribute with encryption. Corresponds to BTA_GATT_PERM_WRITE_ENCRYPTED. */
|
||||
#define ESP_GATT_PERM_WRITE_ENCRYPTED (1 << 5)
|
||||
|
||||
/** @brief Permission to write to the attribute with encrypted MITM protection. Corresponds to BTA_GATT_PERM_WRITE_ENC_MITM. */
|
||||
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6)
|
||||
|
||||
/** @brief Permission for signed writes to the attribute. Corresponds to BTA_GATT_PERM_WRITE_SIGNED. */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7)
|
||||
|
||||
/** @brief Permission for signed writes to the attribute with MITM protection. Corresponds to BTA_GATT_PERM_WRITE_SIGNED_MITM. */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8)
|
||||
|
||||
/** @brief Permission to read the attribute with authorization. */
|
||||
#define ESP_GATT_PERM_READ_AUTHORIZATION (1 << 9)
|
||||
|
||||
/** @brief Permission to write to the attribute with authorization. */
|
||||
#define ESP_GATT_PERM_WRITE_AUTHORIZATION (1 << 10)
|
||||
|
||||
/**
|
||||
* @brief Macro to specify minimum encryption key size.
|
||||
*
|
||||
* @param keysize The minimum size of the encryption key, in bytes.
|
||||
*/
|
||||
#define ESP_GATT_PERM_ENCRYPT_KEY_SIZE(keysize) (((keysize - 6) & 0xF) << 12)
|
||||
|
||||
/** @} */ // End of GATT_PERMS group
|
||||
|
||||
typedef uint16_t esp_gatt_perm_t; ///< Type to represent GATT attribute permissions.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Defines GATT characteristic properties.
|
||||
*
|
||||
* These properties are related to `BTA_GATT_CHAR_PROP_BIT_xxx` in `bta/bta_gatt_api.h`.
|
||||
*/
|
||||
|
||||
/** @defgroup GATT_CHAR_PROPERTIES GATT Characteristic Properties
|
||||
* These properties define various capabilities of a GATT characteristic.
|
||||
* @{
|
||||
*/
|
||||
/** @brief Ability to broadcast.Corresponds to BTA_GATT_CHAR_PROP_BIT_BROADCAST. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_BROADCAST (1 << 0)
|
||||
|
||||
/** @brief Ability to read.Corresponds to BTA_GATT_CHAR_PROP_BIT_READ. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_READ (1 << 1)
|
||||
|
||||
/** @brief Ability to write without response.Corresponds to BTA_GATT_CHAR_PROP_BIT_WRITE_NR. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2)
|
||||
|
||||
/** @brief Ability to write.Corresponds to BTA_GATT_CHAR_PROP_BIT_WRITE. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE (1 << 3)
|
||||
|
||||
/** @brief Ability to notify.Corresponds to BTA_GATT_CHAR_PROP_BIT_NOTIFY. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_NOTIFY (1 << 4)
|
||||
|
||||
/** @brief Ability to indicate.Corresponds to BTA_GATT_CHAR_PROP_BIT_INDICATE. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_INDICATE (1 << 5)
|
||||
|
||||
/** @brief Ability to authenticate.Corresponds to BTA_GATT_CHAR_PROP_BIT_AUTH. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_AUTH (1 << 6)
|
||||
|
||||
/** @brief Has extended properties.Corresponds to BTA_GATT_CHAR_PROP_BIT_EXT_PROP. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7)
|
||||
|
||||
/** @} */ // end of GATT_CHAR_PROPERTIES
|
||||
|
||||
/**
|
||||
* @typedef esp_gatt_char_prop_t
|
||||
* @brief Type for characteristic properties bitmask.
|
||||
*/
|
||||
typedef uint8_t esp_gatt_char_prop_t;
|
||||
|
||||
/// GATT maximum attribute length
|
||||
#define ESP_GATT_MAX_ATTR_LEN 600 //as same as GATT_MAX_ATTR_LEN
|
||||
|
||||
/**
|
||||
* @brief Defines the maximum length of a GATT attribute.
|
||||
*
|
||||
* This definition specifies the maximum number of bytes that a GATT attribute can hold.
|
||||
*/
|
||||
#define ESP_GATT_MAX_ATTR_LEN 512 /*!< As same as GATT_MAX_ATTR_LEN. */
|
||||
|
||||
/**
|
||||
* @brief Enumerates the possible sources of a GATT service discovery.
|
||||
*
|
||||
* This enumeration identifies the source of a GATT service discovery process,
|
||||
* indicating whether the service information was obtained from a remote device,
|
||||
* from NVS (Non-Volatile Storage) flash, or the source is unknown.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_SERVICE_FROM_REMOTE_DEVICE = 0, /* relate to BTA_GATTC_SERVICE_INFO_FROM_REMOTE_DEVICE in bta_gattc_int.h */
|
||||
ESP_GATT_SERVICE_FROM_NVS_FLASH = 1, /* relate to BTA_GATTC_SERVICE_INFO_FROM_NVS_FLASH in bta_gattc_int.h */
|
||||
ESP_GATT_SERVICE_FROM_UNKNOWN = 2, /* relate to BTA_GATTC_SERVICE_INFO_FROM_UNKNOWN in bta_gattc_int.h */
|
||||
ESP_GATT_SERVICE_FROM_REMOTE_DEVICE = 0, /*!< Service information from a remote device. Relates to BTA_GATTC_SERVICE_INFO_FROM_REMOTE_DEVICE. */
|
||||
ESP_GATT_SERVICE_FROM_NVS_FLASH = 1, /*!< Service information from NVS flash. Relates to BTA_GATTC_SERVICE_INFO_FROM_NVS_FLASH. */
|
||||
ESP_GATT_SERVICE_FROM_UNKNOWN = 2, /*!< Service source is unknown. Relates to BTA_GATTC_SERVICE_INFO_FROM_UNKNOWN. */
|
||||
} esp_service_source_t;
|
||||
|
||||
/**
|
||||
* @brief Attribute description (used to create database)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t uuid_length; /*!< UUID length */
|
||||
uint8_t *uuid_p; /*!< UUID value */
|
||||
uint16_t perm; /*!< Attribute permission */
|
||||
uint16_t max_length; /*!< Maximum length of the element*/
|
||||
uint16_t length; /*!< Current length of the element*/
|
||||
uint8_t *value; /*!< Element value array*/
|
||||
} esp_attr_desc_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief attribute auto response flag
|
||||
* @brief Defines an attribute's description.
|
||||
*
|
||||
* This structure is used to describe an attribute in the GATT database. It includes
|
||||
* details such as the UUID of the attribute, its permissions, and its value.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t uuid_length; /*!< Length of the UUID in bytes. */
|
||||
uint8_t *uuid_p; /*!< Pointer to the UUID value. */
|
||||
uint16_t perm; /*!< Attribute permissions, defined by esp_gatt_perm_t. */
|
||||
uint16_t max_length; /*!< Maximum length of the attribute's value. */
|
||||
uint16_t length; /*!< Current length of the attribute's value. */
|
||||
uint8_t *value; /*!< Pointer to the attribute's value array. */
|
||||
} esp_attr_desc_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Defines attribute control for GATT operations.
|
||||
*
|
||||
* This module provides definitions for controlling attribute auto responses
|
||||
* in GATT operations.
|
||||
*/
|
||||
|
||||
/** @brief Response to Write/Read operations should be handled by the application. */
|
||||
#define ESP_GATT_RSP_BY_APP 0
|
||||
|
||||
/** @brief Response to Write/Read operations should be automatically handled by the GATT stack. */
|
||||
#define ESP_GATT_AUTO_RSP 1
|
||||
|
||||
/**
|
||||
* @brief Defines the auto response setting for attribute operations.
|
||||
*
|
||||
* This structure is used to control whether the GATT stack or the application
|
||||
* will handle responses to Read/Write operations.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
#define ESP_GATT_RSP_BY_APP 0
|
||||
#define ESP_GATT_AUTO_RSP 1
|
||||
/**
|
||||
* @brief if auto_rsp set to ESP_GATT_RSP_BY_APP, means the response of Write/Read operation will by replied by application.
|
||||
if auto_rsp set to ESP_GATT_AUTO_RSP, means the response of Write/Read operation will be replied by GATT stack automatically.
|
||||
* @brief Controls who handles the response to Read/Write operations.
|
||||
*
|
||||
* - If set to @c ESP_GATT_RSP_BY_APP, the application is responsible for
|
||||
* generating the response.
|
||||
* - If set to @c ESP_GATT_AUTO_RSP, the GATT stack will automatically generate
|
||||
* the response.
|
||||
*/
|
||||
uint8_t auto_rsp;
|
||||
} esp_attr_control_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief attribute type added to the gatt server database
|
||||
* @brief attribute type added to the GATT server database
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
@@ -378,116 +585,103 @@ typedef struct
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
|
||||
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
|
||||
|
||||
/// Gatt attribute value
|
||||
/**
|
||||
* @brief Represents a GATT attribute's value.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t value[ESP_GATT_MAX_ATTR_LEN]; /*!< Gatt attribute value */
|
||||
uint16_t handle; /*!< Gatt attribute handle */
|
||||
uint16_t offset; /*!< Gatt attribute value offset */
|
||||
uint16_t len; /*!< Gatt attribute value length */
|
||||
uint8_t auth_req; /*!< Gatt authentication request */
|
||||
uint8_t value[ESP_GATT_MAX_ATTR_LEN]; /*!< Array holding the value of the GATT attribute. */
|
||||
uint16_t handle; /*!< Unique identifier (handle) of the GATT attribute. */
|
||||
uint16_t offset; /*!< Offset within the attribute's value, for partial updates. */
|
||||
uint16_t len; /*!< Current length of the data in the value array. */
|
||||
uint8_t auth_req; /*!< Authentication requirements for accessing this attribute. */
|
||||
} esp_gatt_value_t;
|
||||
|
||||
/// GATT remote read request response type
|
||||
/**
|
||||
* @brief Represents the response type for a GATT remote read request.
|
||||
*/
|
||||
typedef union {
|
||||
esp_gatt_value_t attr_value; /*!< Gatt attribute structure */
|
||||
uint16_t handle; /*!< Gatt attribute handle */
|
||||
esp_gatt_value_t attr_value; /*!< The GATT attribute value, including its data, handle, and metadata. */
|
||||
uint16_t handle; /*!< Only the handle of the GATT attribute, when that's the only required information. */
|
||||
} esp_gatt_rsp_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gatt write type
|
||||
*/
|
||||
* @brief Defines the types of GATT write operations.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_WRITE_TYPE_NO_RSP = 1, /*!< Gatt write attribute need no response */
|
||||
ESP_GATT_WRITE_TYPE_RSP, /*!< Gatt write attribute need remote response */
|
||||
ESP_GATT_WRITE_TYPE_NO_RSP = 1, /*!< Write operation where no response is needed. */
|
||||
ESP_GATT_WRITE_TYPE_RSP = 2, /*!< Write operation that requires a remote response. */
|
||||
} esp_gatt_write_type_t;
|
||||
|
||||
/**
|
||||
* @brief Connection parameters information
|
||||
*/
|
||||
|
||||
/** @brief Connection parameters for GATT. */
|
||||
typedef struct {
|
||||
uint16_t interval; /*!< connection interval */
|
||||
uint16_t latency; /*!< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3 */
|
||||
uint16_t timeout; /*!< Supervision timeout for the LE Link. Range: 0x000A to 0x0C80.
|
||||
Mandatory Range: 0x000A to 0x0C80 Time = N * 10 msec
|
||||
Time Range: 100 msec to 32 seconds */
|
||||
uint16_t interval; /*!< Connection interval. */
|
||||
uint16_t latency; /*!< Slave latency for the connection in number of connection events. */
|
||||
uint16_t timeout; /*!< Supervision timeout for the LE Link. */
|
||||
} esp_gatt_conn_params_t;
|
||||
|
||||
#define ESP_GATT_IF_NONE 0xff /*!< If callback report gattc_if/gatts_if as this macro, means this event is not correspond to any app */
|
||||
/** @brief Macro indicating no specific GATT interface. */
|
||||
#define ESP_GATT_IF_NONE 0xff /*!< No specific application GATT interface. */
|
||||
|
||||
typedef uint8_t esp_gatt_if_t; /*!< Gatt interface type, different application on GATT client use different gatt_if */
|
||||
/** @brief GATT interface type for client applications. */
|
||||
typedef uint8_t esp_gatt_if_t;
|
||||
|
||||
/**
|
||||
* @brief the type of attribute element
|
||||
*/
|
||||
/** @brief Enumerates types of GATT database attributes. */
|
||||
typedef enum {
|
||||
ESP_GATT_DB_PRIMARY_SERVICE, /*!< Gattc primary service attribute type in the cache */
|
||||
ESP_GATT_DB_SECONDARY_SERVICE, /*!< Gattc secondary service attribute type in the cache */
|
||||
ESP_GATT_DB_CHARACTERISTIC, /*!< Gattc characteristic attribute type in the cache */
|
||||
ESP_GATT_DB_DESCRIPTOR, /*!< Gattc characteristic descriptor attribute type in the cache */
|
||||
ESP_GATT_DB_INCLUDED_SERVICE, /*!< Gattc include service attribute type in the cache */
|
||||
ESP_GATT_DB_ALL, /*!< Gattc all the attribute (primary service & secondary service & include service & char & descriptor) type in the cache */
|
||||
} esp_gatt_db_attr_type_t; /*!< Gattc attribute type element */
|
||||
ESP_GATT_DB_PRIMARY_SERVICE, /*!< Primary service attribute. */
|
||||
ESP_GATT_DB_SECONDARY_SERVICE, /*!< Secondary service attribute. */
|
||||
ESP_GATT_DB_CHARACTERISTIC, /*!< Characteristic attribute. */
|
||||
ESP_GATT_DB_DESCRIPTOR, /*!< Descriptor attribute. */
|
||||
ESP_GATT_DB_INCLUDED_SERVICE, /*!< Included service attribute. */
|
||||
ESP_GATT_DB_ALL, /*!< All attribute types. */
|
||||
} esp_gatt_db_attr_type_t;
|
||||
|
||||
/**
|
||||
* @brief read multiple attribute
|
||||
*/
|
||||
/** @brief Represents multiple attributes for reading. */
|
||||
typedef struct {
|
||||
uint8_t num_attr; /*!< The number of the attribute */
|
||||
uint16_t handles[ESP_GATT_MAX_READ_MULTI_HANDLES]; /*!< The handles list */
|
||||
} esp_gattc_multi_t; /*!< The gattc multiple read element */
|
||||
uint8_t num_attr; /*!< Number of attributes. */
|
||||
uint16_t handles[ESP_GATT_MAX_READ_MULTI_HANDLES]; /*!< List of attribute handles. */
|
||||
} esp_gattc_multi_t;
|
||||
|
||||
/**
|
||||
* @brief data base attribute element
|
||||
*/
|
||||
/** @brief GATT database attribute element. */
|
||||
typedef struct {
|
||||
esp_gatt_db_attr_type_t type; /*!< The attribute type */
|
||||
uint16_t attribute_handle; /*!< The attribute handle, it's valid for all of the type */
|
||||
uint16_t start_handle; /*!< The service start handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
|
||||
uint16_t end_handle; /*!< The service end handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
|
||||
esp_gatt_char_prop_t properties; /*!< The characteristic properties, it's valid only when the type = ESP_GATT_DB_CHARACTERISTIC */
|
||||
esp_bt_uuid_t uuid; /*!< The attribute uuid, it's valid for all of the type */
|
||||
} esp_gattc_db_elem_t; /*!< The gattc service data base element in the cache */
|
||||
esp_gatt_db_attr_type_t type; /*!< Attribute type. */
|
||||
uint16_t attribute_handle; /*!< Attribute handle. */
|
||||
uint16_t start_handle; /*!< Service start handle. */
|
||||
uint16_t end_handle; /*!< Service end handle. */
|
||||
esp_gatt_char_prop_t properties; /*!< Characteristic properties. */
|
||||
esp_bt_uuid_t uuid; /*!< Attribute UUID. */
|
||||
} esp_gattc_db_elem_t;
|
||||
|
||||
/**
|
||||
* @brief service element
|
||||
*/
|
||||
/** @brief Represents a GATT service element. */
|
||||
typedef struct {
|
||||
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondary service */
|
||||
uint16_t start_handle; /*!< The start handle of the service */
|
||||
uint16_t end_handle; /*!< The end handle of the service */
|
||||
esp_bt_uuid_t uuid; /*!< The uuid of the service */
|
||||
} esp_gattc_service_elem_t; /*!< The gattc service element */
|
||||
bool is_primary; /*!< Indicates if the service is primary. */
|
||||
uint16_t start_handle; /*!< Service start handle. */
|
||||
uint16_t end_handle; /*!< Service end handle. */
|
||||
esp_bt_uuid_t uuid; /*!< Service UUID. */
|
||||
} esp_gattc_service_elem_t;
|
||||
|
||||
/**
|
||||
* @brief characteristic element
|
||||
*/
|
||||
/** @brief Represents a GATT characteristic element. */
|
||||
typedef struct {
|
||||
uint16_t char_handle; /*!< The characteristic handle */
|
||||
esp_gatt_char_prop_t properties; /*!< The characteristic properties */
|
||||
esp_bt_uuid_t uuid; /*!< The characteristic uuid */
|
||||
} esp_gattc_char_elem_t; /*!< The gattc characteristic element */
|
||||
uint16_t char_handle; /*!< Characteristic handle. */
|
||||
esp_gatt_char_prop_t properties; /*!< Characteristic properties. */
|
||||
esp_bt_uuid_t uuid; /*!< Characteristic UUID. */
|
||||
} esp_gattc_char_elem_t;
|
||||
|
||||
/**
|
||||
* @brief descriptor element
|
||||
*/
|
||||
/** @brief Represents a GATT descriptor element. */
|
||||
typedef struct {
|
||||
uint16_t handle; /*!< The characteristic descriptor handle */
|
||||
esp_bt_uuid_t uuid; /*!< The characteristic descriptor uuid */
|
||||
} esp_gattc_descr_elem_t; /*!< The gattc descriptor type element */
|
||||
uint16_t handle; /*!< Descriptor handle. */
|
||||
esp_bt_uuid_t uuid; /*!< Descriptor UUID. */
|
||||
} esp_gattc_descr_elem_t;
|
||||
|
||||
/**
|
||||
* @brief include service element
|
||||
*/
|
||||
/** @brief Represents an included GATT service element. */
|
||||
typedef struct {
|
||||
uint16_t handle; /*!< The include service current attribute handle */
|
||||
uint16_t incl_srvc_s_handle; /*!< The start handle of the service which has been included */
|
||||
uint16_t incl_srvc_e_handle; /*!< The end handle of the service which has been included */
|
||||
esp_bt_uuid_t uuid; /*!< The include service uuid */
|
||||
} esp_gattc_incl_svc_elem_t; /*!< The gattc include service element */
|
||||
|
||||
uint16_t handle; /*!< Current attribute handle of the included service. */
|
||||
uint16_t incl_srvc_s_handle; /*!< Start handle of the included service. */
|
||||
uint16_t incl_srvc_e_handle; /*!< End handle of the included service. */
|
||||
esp_bt_uuid_t uuid; /*!< Included service UUID. */
|
||||
} esp_gattc_incl_svc_elem_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ESP_GATT_DEFS_H__ */
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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_SPP_API_H__
|
||||
#define __ESP_SPP_API_H__
|
||||
@@ -35,10 +27,18 @@ typedef enum {
|
||||
} esp_spp_status_t;
|
||||
|
||||
/* Security Setting Mask
|
||||
Use these three mask mode:
|
||||
Use these three mask modes on both sides:
|
||||
1. ESP_SPP_SEC_NONE
|
||||
2. ESP_SPP_SEC_AUTHENTICATE
|
||||
3. (ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE)
|
||||
3. (ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT)
|
||||
Use these three mask modes only on acceptor side:
|
||||
1. ESP_SPP_SEC_IN_16_DIGITS
|
||||
2. (ESP_SPP_SEC_IN_16_DIGITS | ESP_SPP_SEC_AUTHENTICATE)
|
||||
3. (ESP_SPP_SEC_IN_16_DIGITS | ESP_SPP_SEC_AUTHENTICATE | ESP_SPP_SEC_ENCRYPT)
|
||||
Due to certain limitations, do not use these mask modes:
|
||||
1. ESP_SPP_SEC_AUTHORIZE
|
||||
2. ESP_SPP_SEC_MODE4_LEVEL4
|
||||
3. ESP_SPP_SEC_MITM
|
||||
*/
|
||||
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta/bta_api.h */
|
||||
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta/bta_api.h*/
|
||||
|
||||
@@ -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
|
||||
@@ -604,6 +612,11 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
|
||||
btm_ble_resolving_list_cleanup (); //by TH, because cmn_ble_vsc_cb.max_filter has something mistake as btm_ble_adv_filter_cleanup
|
||||
#endif
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
// btm_ble_multi_adv_init is called when the host is enabled, so btm_ble_multi_adv_cleanup is called when the host is disabled.
|
||||
btm_ble_multi_adv_cleanup();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -638,7 +651,7 @@ static void bta_dm_disable_timer_cback (TIMER_LIST_ENT *p_tle)
|
||||
}
|
||||
|
||||
/* Retrigger disable timer in case ACL disconnect failed, DISABLE_EVT still need
|
||||
to be sent out to avoid jave layer disable timeout */
|
||||
to be sent out to avoid the layer disable timeout */
|
||||
if (trigger_disc) {
|
||||
bta_dm_cb.disable_timer.p_cback = (TIMER_CBACK *)&bta_dm_disable_timer_cback;
|
||||
bta_dm_cb.disable_timer.param = 1;
|
||||
@@ -694,6 +707,14 @@ void bta_dm_get_dev_name (tBTA_DM_MSG *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
void bta_dm_send_vendor_hci(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_VendorSpecificCommand(p_data->vendor_hci_cmd.opcode,
|
||||
p_data->vendor_hci_cmd.param_len,
|
||||
p_data->vendor_hci_cmd.p_param_buf,
|
||||
p_data->vendor_hci_cmd.vendor_hci_cb);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_set_afh_channels
|
||||
@@ -742,7 +763,7 @@ static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT tr
|
||||
APPL_TRACE_DEBUG("bta_dm_read_remote_device_name: BTM_ReadRemoteDeviceName is busy");
|
||||
|
||||
/* Remote name discovery is on going now so BTM cannot notify through "bta_dm_remname_cback" */
|
||||
/* adding callback to get notified that current reading remore name done */
|
||||
/* adding callback to get notified that current reading remote name done */
|
||||
BTM_SecAddRmtNameNotifyCallback(&bta_dm_service_search_remname_cback);
|
||||
|
||||
return (TRUE);
|
||||
@@ -1073,7 +1094,7 @@ void bta_dm_add_device (tBTA_DM_MSG *p_data)
|
||||
}
|
||||
|
||||
if (p_dev->is_trusted) {
|
||||
/* covert BTA service mask to BTM mask */
|
||||
/* convert BTA service mask to BTM mask */
|
||||
while (p_dev->tm && (index < BTA_MAX_SERVICE_ID)) {
|
||||
if (p_dev->tm & (UINT32)(1 << index)) {
|
||||
|
||||
@@ -1101,7 +1122,7 @@ void bta_dm_add_device (tBTA_DM_MSG *p_data)
|
||||
** Function bta_dm_close_acl
|
||||
**
|
||||
** Description This function forces to close the connection to a remote device
|
||||
** and optionaly remove the device from security database if
|
||||
** and optionally remove the device from security database if
|
||||
** required.
|
||||
****
|
||||
*******************************************************************************/
|
||||
@@ -2626,7 +2647,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
|
||||
&bta_dm_search_cb.services_found );
|
||||
}
|
||||
|
||||
/* if seaching with EIR is not completed */
|
||||
/* if searching with EIR is not completed */
|
||||
if (bta_dm_search_cb.services_to_search) {
|
||||
/* check whether connection already exists to the device
|
||||
if connection exists, we don't have to wait for ACL
|
||||
@@ -3700,7 +3721,7 @@ static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle)
|
||||
tBTA_SYS_HW_MSG *sys_enable_event;
|
||||
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
/* disable the power managment module */
|
||||
/* disable the power management module */
|
||||
bta_dm_disable_pm();
|
||||
#endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
|
||||
|
||||
@@ -4082,7 +4103,7 @@ static void bta_dm_set_eir (char *local_name)
|
||||
p = (UINT8 *)p_buf + BTM_HCI_EIR_OFFSET; /* reset p */
|
||||
#endif // BTA_EIR_CANNED_UUID_LIST
|
||||
|
||||
/* if UUID doesn't fit remaing space, shorten local name */
|
||||
/* if UUID doesn't fit remaining space, shorten local name */
|
||||
if ( local_name_len > (free_eir_length - 4 - num_uuid * LEN_UUID_16)) {
|
||||
APPL_TRACE_WARNING("BTA EIR: local name is shortened");
|
||||
local_name_len = p_bta_dm_eir_cfg->bta_dm_eir_min_name_len;
|
||||
@@ -5101,14 +5122,14 @@ void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data)
|
||||
**
|
||||
** Description This function set the LE random address for the device.
|
||||
**
|
||||
** Parameters: rand_addr:the random address whitch should be setting
|
||||
** Parameters: rand_addr:the random address which should be setting
|
||||
** Explanation: This function added by Yulong at 2016/9/9
|
||||
*******************************************************************************/
|
||||
void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
tBTM_STATUS status = BTM_SET_STATIC_RAND_ADDR_FAIL;
|
||||
if (p_data->set_addr.addr_type != BLE_ADDR_RANDOM) {
|
||||
APPL_TRACE_ERROR("Invalid random adress type = %d\n", p_data->set_addr.addr_type);
|
||||
APPL_TRACE_ERROR("Invalid random address type = %d\n", p_data->set_addr.addr_type);
|
||||
if(p_data->set_addr.p_set_rand_addr_cback) {
|
||||
(*p_data->set_addr.p_set_rand_addr_cback)(status);
|
||||
}
|
||||
@@ -5463,7 +5484,7 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
|
||||
}
|
||||
|
||||
p_acl_cb->p_set_pkt_data_cback = p_data->ble_set_data_length.p_set_pkt_data_cback;
|
||||
// if the value of the data length is same, triger callback directly
|
||||
// if the value of the data length is same, trigger callback directly
|
||||
if(p_data->ble_set_data_length.tx_data_length == p_acl_cb->data_length_params.tx_len) {
|
||||
if(p_data->ble_set_data_length.p_set_pkt_data_cback) {
|
||||
(*p_data->ble_set_data_length.p_set_pkt_data_cback)(status, &p_acl_cb->data_length_params);
|
||||
@@ -5472,7 +5493,7 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
|
||||
}
|
||||
|
||||
if(p_acl_cb->data_len_updating) {
|
||||
// aleady have one cmd
|
||||
// already have one cmd
|
||||
if(p_acl_cb->data_len_waiting) {
|
||||
status = BTM_ILLEGAL_ACTION;
|
||||
} else {
|
||||
@@ -5633,7 +5654,66 @@ 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_dtm_tx_start(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_BleTransmitterTest(p_data->dtm_tx_start.tx_channel, p_data->dtm_tx_start.len_of_data, p_data->dtm_tx_start.pkt_payload, p_data->dtm_tx_start.p_dtm_cmpl_cback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_dtm_rx_start(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_BleReceiverTest(p_data->dtm_rx_start.rx_channel, p_data->dtm_rx_start.p_dtm_cmpl_cback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_BleTestEnd(p_data->dtm_stop.p_dtm_cmpl_cback);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, rpa_timeout = %d", __func__, p_data->set_rpa_timeout.rpa_timeout);
|
||||
BTM_BleSetRpaTimeout(p_data->set_rpa_timeout.rpa_timeout,p_data->set_rpa_timeout.p_set_rpa_timeout_cback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s", __func__);
|
||||
BTM_BleAddDevToResolvingList(p_data->add_dev_to_resolving_list.addr,
|
||||
p_data->add_dev_to_resolving_list.addr_type,
|
||||
p_data->add_dev_to_resolving_list.irk,
|
||||
p_data->add_dev_to_resolving_list.p_add_dev_to_resolving_list_callback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, privacy_mode = %d", __func__, p_data->ble_set_privacy_mode.privacy_mode);
|
||||
BTM_BleSetPrivacyMode(p_data->ble_set_privacy_mode.addr_type, p_data->ble_set_privacy_mode.addr,
|
||||
p_data->ble_set_privacy_mode.privacy_mode, p_data->ble_set_privacy_mode.p_cback);
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_BleEnhancedTransmitterTest(p_data->dtm_enh_tx_start.tx_channel, p_data->dtm_enh_tx_start.len_of_data,
|
||||
p_data->dtm_enh_tx_start.pkt_payload, p_data->dtm_enh_tx_start.phy, p_data->dtm_enh_tx_start.p_dtm_cmpl_cback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_BleEnhancedReceiverTest(p_data->dtm_enh_rx_start.rx_channel, p_data->dtm_enh_rx_start.phy,
|
||||
p_data->dtm_enh_rx_start.modulation_index, p_data->dtm_enh_rx_start.p_dtm_cmpl_cback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
//tBTM_STATUS btm_status = 0;
|
||||
@@ -6302,7 +6382,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
|
||||
}
|
||||
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s out of room to accomodate more service ids ble_raw_size = %d ble_raw_used = %d", __FUNCTION__, bta_dm_search_cb.ble_raw_size, bta_dm_search_cb.ble_raw_used );
|
||||
APPL_TRACE_ERROR("%s out of room to accommodate more service ids ble_raw_size = %d ble_raw_used = %d", __FUNCTION__, bta_dm_search_cb.ble_raw_size, bta_dm_search_cb.ble_raw_used );
|
||||
}
|
||||
|
||||
APPL_TRACE_API("%s service_id_uuid_len=%d ", __func__, service_id.uuid.len);
|
||||
|
||||
@@ -202,6 +202,21 @@ void BTA_DmGetDeviceName(tBTA_GET_DEV_NAME_CBACK *p_cback)
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmsendVendorHciCmd(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf, tBTA_SEND_VENDOR_HCI_CMPL_CBACK p_vendor_cmd_complete_cback)
|
||||
{
|
||||
tBTA_DM_API_SEND_VENDOR_HCI_CMD *p_msg;
|
||||
if ((p_msg = (tBTA_DM_API_SEND_VENDOR_HCI_CMD *)osi_malloc(sizeof(tBTA_DM_API_SEND_VENDOR_HCI_CMD) + param_len)) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_SEND_VENDOR_HCI_CMD_EVT;
|
||||
p_msg->opcode = opcode;
|
||||
p_msg->param_len = param_len;
|
||||
p_msg->p_param_buf = (UINT8 *)(p_msg + 1);
|
||||
memcpy(p_msg->p_param_buf, p_param_buf, param_len);
|
||||
p_msg->vendor_hci_cb = p_vendor_cmd_complete_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config)
|
||||
@@ -847,7 +862,7 @@ void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, LINK_KEY link_key,
|
||||
**
|
||||
** Function BTA_DmRemoveDevice
|
||||
**
|
||||
** Description This function removes a device fromthe security database list of
|
||||
** Description This function removes a device from the security database list of
|
||||
** peer device. It manages unpairing even while connected.
|
||||
**
|
||||
**
|
||||
@@ -1065,7 +1080,7 @@ void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, int auth_mode
|
||||
** Description Send BLE SMP passkey reply.
|
||||
**
|
||||
** Parameters: bd_addr - BD address of the peer
|
||||
** accept - passkey entry sucessful or declined.
|
||||
** accept - passkey entry successful or declined.
|
||||
** passkey - passkey value, must be a 6 digit number,
|
||||
** can be lead by 0.
|
||||
**
|
||||
@@ -1744,6 +1759,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
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -1881,7 +1919,7 @@ void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
|
||||
** p_services: if service is not empty, service discovery will be done.
|
||||
** for all GATT based service condition, put num_uuid, and
|
||||
** p_uuid is the pointer to the list of UUID values.
|
||||
** p_cback: callback functino when search is completed.
|
||||
** p_cback: callback function when search is completed.
|
||||
**
|
||||
**
|
||||
**
|
||||
@@ -1969,7 +2007,7 @@ void BTA_DmBleUpdateConnectionParam(BD_ADDR bd_addr, UINT16 min_int,
|
||||
**
|
||||
** Description Enable/disable privacy on the local device
|
||||
**
|
||||
** Parameters: privacy_enable - enable/disabe privacy on remote device.
|
||||
** Parameters: privacy_enable - enable/disable privacy on remote device.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -2021,7 +2059,7 @@ void BTA_DmBleConfigLocalIcon(uint16_t icon)
|
||||
**
|
||||
** Function BTA_BleEnableAdvInstance
|
||||
**
|
||||
** Description This function enable a Multi-ADV instance with the specififed
|
||||
** Description This function enable a Multi-ADV instance with the specified
|
||||
** adv parameters
|
||||
**
|
||||
** Parameters p_params: pointer to the adv parameter structure.
|
||||
@@ -2060,7 +2098,7 @@ void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
|
||||
**
|
||||
** Function BTA_BleUpdateAdvInstParam
|
||||
**
|
||||
** Description This function update a Multi-ADV instance with the specififed
|
||||
** Description This function update a Multi-ADV instance with the specified
|
||||
** adv parameters.
|
||||
**
|
||||
** Parameters inst_id: Adv instance to update the parameter.
|
||||
@@ -2091,7 +2129,7 @@ void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
|
||||
**
|
||||
** Function BTA_BleCfgAdvInstData
|
||||
**
|
||||
** Description This function configure a Multi-ADV instance with the specififed
|
||||
** Description This function configure a Multi-ADV instance with the specified
|
||||
** adv data or scan response data.
|
||||
**
|
||||
** Parameter inst_id: Adv instance to configure the adv data or scan response.
|
||||
@@ -2478,6 +2516,64 @@ void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length, tBTA_S
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleDtmTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
{
|
||||
tBTA_DM_API_BLE_DTM_TX_START *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_DTM_TX_START *)osi_malloc(sizeof(tBTA_DM_API_BLE_DTM_TX_START)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_DTM_TX_START_EVT;
|
||||
p_msg->tx_channel = tx_channel;
|
||||
p_msg->len_of_data = len_of_data;
|
||||
p_msg->pkt_payload = pkt_payload;
|
||||
p_msg->p_dtm_cmpl_cback = p_dtm_cmpl_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleDtmRxStart(uint8_t rx_channel, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
{
|
||||
tBTA_DM_API_BLE_DTM_RX_START *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_DTM_RX_START *)osi_malloc(sizeof(tBTA_DM_API_BLE_DTM_RX_START)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_DTM_RX_START_EVT;
|
||||
p_msg->rx_channel= rx_channel;
|
||||
p_msg->p_dtm_cmpl_cback = p_dtm_cmpl_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
{
|
||||
tBTA_DM_API_BLE_DTM_STOP *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_DTM_STOP *)osi_malloc(sizeof(tBTA_DM_API_BLE_DTM_STOP)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_DTM_STOP_EVT;
|
||||
p_msg->p_dtm_cmpl_cback = p_dtm_cmpl_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t privacy_mode, tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback)
|
||||
{
|
||||
tBTA_DM_API_SET_PRIVACY_MODE *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_SET_PRIVACY_MODE *)osi_malloc(sizeof(tBTA_DM_API_SET_PRIVACY_MODE)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PRIVACY_MODE_EVT;
|
||||
p_msg->addr_type = addr_type;
|
||||
memcpy(p_msg->addr, addr, sizeof(BD_ADDR));
|
||||
p_msg->privacy_mode = privacy_mode;
|
||||
p_msg->p_cback = p_cback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -2491,7 +2587,7 @@ void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length, tBTA_S
|
||||
**
|
||||
** Parameters: bd_addr - Address of the peer device
|
||||
** transport - transport of the link to be encruypted
|
||||
** p_callback - Pointer to callback function to indicat the
|
||||
** p_callback - Pointer to callback function to indicate the
|
||||
** link encryption status
|
||||
** sec_act - This is the security action to indicate
|
||||
** what kind of BLE security level is required for
|
||||
@@ -2671,7 +2767,7 @@ extern void BTA_DmBleStopAdvertising(void)
|
||||
**
|
||||
** Description This function set the random address for the APP
|
||||
**
|
||||
** Parameters rand_addr: the random address whith should be setting
|
||||
** Parameters rand_addr: the random address with should be setting
|
||||
** p_set_rand_addr_cback: complete callback
|
||||
** Returns void
|
||||
**
|
||||
@@ -2687,7 +2783,68 @@ extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_
|
||||
p_msg->hdr.event = BTA_DM_API_SET_RAND_ADDR_EVT;
|
||||
p_msg->addr_type = BLE_ADDR_RANDOM;
|
||||
p_msg->p_set_rand_addr_cback = p_set_rand_addr_cback;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetRpaTimeout
|
||||
**
|
||||
** Description This function sets the Resolvable Private Address (RPA) timeout
|
||||
** for the Bluetooth device. The RPA timeout defines how long an RPA
|
||||
** remains in use before a new one is generated.
|
||||
**
|
||||
** Parameters rpa_timeout: The timeout in seconds within the range of 1s to 1 hour
|
||||
** as defined by the Bluetooth specification. This duration
|
||||
** specifies how long the controller uses an RPA before
|
||||
** generating a new one.
|
||||
** Returns void
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleSetRpaTimeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback)
|
||||
{
|
||||
tBTA_DM_API_SET_RPA_TIMEOUT *p_msg;
|
||||
if ((p_msg = (tBTA_DM_API_SET_RPA_TIMEOUT *) osi_malloc(sizeof(tBTA_DM_API_SET_RPA_TIMEOUT))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_RPA_TIMEOUT));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_RPA_TIMEOUT_EVT;
|
||||
p_msg->rpa_timeout = rpa_timeout; // Assign the RPA timeout value to the message
|
||||
p_msg->p_set_rpa_timeout_cback = p_set_rpa_timeout_cback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleAddDevToResolvingList
|
||||
**
|
||||
** Description This function adds a device to the resolving list of the
|
||||
** Bluetooth controller. The resolving list is used for resolving
|
||||
** the identity of devices using resolvable private addresses (RPAs).
|
||||
**
|
||||
** Parameters addr: Bluetooth device address to be added to the resolving list
|
||||
** addr_type: Type of the address (public or random)
|
||||
** irk: Identity Resolving Key (IRK) of the device
|
||||
** add_dev_to_resolving_list_callback: Callback function to be invoked
|
||||
** upon completion of the operation
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleAddDevToResolvingList(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
PEER_IRK irk,
|
||||
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *add_dev_to_resolving_list_callback)
|
||||
{
|
||||
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST *p_msg;
|
||||
if ((p_msg = (tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST *) osi_malloc(sizeof(tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST));
|
||||
p_msg->hdr.event = BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT;
|
||||
memcpy(p_msg->addr, addr, BD_ADDR_LEN); // Copy the device address to the message
|
||||
p_msg->addr_type = addr_type; // Assign the address type to the message
|
||||
memcpy(p_msg->irk, irk, PEER_IRK_LEN); // Copy the IRK to the message
|
||||
p_msg->p_add_dev_to_resolving_list_callback = add_dev_to_resolving_list_callback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
@@ -2747,7 +2904,6 @@ void BTA_VendorCleanup (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
btm_ble_multi_adv_cleanup();
|
||||
}
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void BTA_DmBleGapReadPHY(BD_ADDR addr)
|
||||
@@ -2758,7 +2914,7 @@ void BTA_DmBleGapReadPHY(BD_ADDR addr)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_READ_PHY));
|
||||
p_msg->hdr.event = BTA_DM_API_READ_PHY_EVT;
|
||||
memcpy(p_msg->bd_addr, addr, BD_ADDR_LEN);
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2770,13 +2926,13 @@ void BTA_DmBleGapSetPreferedDefaultPHY(tBTA_DM_BLE_GAP_PHY_MASK tx_phy_mask,
|
||||
tBTA_DM_BLE_GAP_PHY_MASK rx_phy_mask)
|
||||
{
|
||||
tBTA_DM_API_SET_PER_DEF_PHY *p_msg;
|
||||
APPL_TRACE_API("%s, Set prefered default phy.", __func__);
|
||||
APPL_TRACE_API("%s, Set preferred default phy.", __func__);
|
||||
if ((p_msg = (tBTA_DM_API_SET_PER_DEF_PHY *) osi_malloc(sizeof(tBTA_DM_API_SET_PER_DEF_PHY))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_PER_DEF_PHY));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PER_DEF_PHY_EVT;
|
||||
p_msg->tx_phy_mask = tx_phy_mask;
|
||||
p_msg->rx_phy_mask = rx_phy_mask;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2791,7 +2947,7 @@ void BTA_DmBleGapSetPreferedPHY(BD_ADDR addr,
|
||||
UINT16 phy_options)
|
||||
{
|
||||
tBTA_DM_API_SET_PER_PHY *p_msg;
|
||||
APPL_TRACE_API("%s, Set prefered phy.", __func__);
|
||||
APPL_TRACE_API("%s, Set preferred phy.", __func__);
|
||||
if ((p_msg = (tBTA_DM_API_SET_PER_PHY *) osi_malloc(sizeof(tBTA_DM_API_SET_PER_PHY))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_PER_PHY));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PER_PHY_EVT;
|
||||
@@ -2800,7 +2956,7 @@ void BTA_DmBleGapSetPreferedPHY(BD_ADDR addr,
|
||||
p_msg->tx_phy_mask = tx_phy_mask;
|
||||
p_msg->rx_phy_mask = rx_phy_mask;
|
||||
p_msg->phy_options = phy_options;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2816,7 +2972,7 @@ void BTA_DmBleGapExtAdvSetRandaddr(UINT16 instance, BD_ADDR addr)
|
||||
p_msg->hdr.event = BTA_DM_API_SET_EXT_ADV_RAND_ADDR_EVT;
|
||||
p_msg->instance = instance;
|
||||
memcpy(&p_msg->rand_addr, addr, BD_ADDR_LEN);
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2834,7 +2990,7 @@ void BTA_DmBleGapExtAdvSetParams(UINT16 instance,
|
||||
p_msg->hdr.event = BTA_DM_API_SET_EXT_ADV_PARAMS_EVT;
|
||||
p_msg->instance = instance;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_GAP_EXT_ADV_PARAMS));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2857,7 +3013,7 @@ void BTA_DmBleGapConfigExtAdvDataRaw(BOOLEAN is_scan_rsp, UINT8 instance, UINT16
|
||||
if (data) {
|
||||
memcpy(p_msg->data, data, length);
|
||||
}
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2877,7 +3033,7 @@ void BTA_DmBleGapExtAdvEnable(BOOLEAN enable, UINT8 num, tBTA_DM_BLE_EXT_ADV *ex
|
||||
if (ext_adv) {
|
||||
memcpy(p_msg->ext_adv, ext_adv, sizeof(tBTA_DM_BLE_EXT_ADV)*num);
|
||||
}
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2892,7 +3048,7 @@ void BTA_DmBleGapExtAdvSetRemove(UINT8 instance)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE));
|
||||
p_msg->hdr.event = BTA_DM_API_EXT_ADV_SET_REMOVE_EVT;
|
||||
p_msg->instance = instance;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2906,7 +3062,7 @@ void BTA_DmBleGapExtAdvSetClear(void)
|
||||
if ((p_msg = (tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR *) osi_malloc(sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR));
|
||||
p_msg->hdr.event = BTA_DM_API_EXT_ADV_SET_CLEAR_EVT;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2923,7 +3079,7 @@ void BTA_DmBleGapPeriodicAdvSetParams(UINT8 instance,
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SET_PARAMS_EVT;
|
||||
p_msg->instance = instance;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_Periodic_Adv_Params));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2945,7 +3101,7 @@ void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
||||
memcpy(p_msg->data, data, length);
|
||||
p_msg->data = length != 0 ? (UINT8 *)(p_msg + 1) : NULL;
|
||||
p_msg->only_update_did = only_update_did;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2962,7 +3118,7 @@ void BTA_DmBleGapPeriodicAdvEnable(UINT8 enable, UINT8 instance)
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_ENABLE_EVT;
|
||||
p_msg->instance = instance;
|
||||
p_msg->enable = enable;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2978,7 +3134,7 @@ void BTA_DmBleGapPeriodicAdvCreateSync(tBTA_DM_BLE_Periodic_Sync_Params *params)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SYNC_EVT;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_Periodic_Sync_Params));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2993,7 +3149,7 @@ void BTA_DmBleGapPeriodicAdvSyncCancel(void)
|
||||
if ((p_msg = (tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL *) osi_malloc(sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SYNC_CANCEL_EVT;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3009,7 +3165,7 @@ void BTA_DmBleGapPeriodicAdvSyncTerm(UINT16 sync_handle)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC_TERM));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SYNC_TERMINATE_EVT;
|
||||
p_msg->sync_handle = sync_handle;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3029,7 +3185,7 @@ void BTA_DmBleGapPeriodicAdvAddDevToList(tBLE_ADDR_TYPE addr_type,
|
||||
p_msg->addr_type = addr_type;
|
||||
p_msg->sid = sid;
|
||||
memcpy(p_msg->addr, addr, sizeof(BD_ADDR));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3049,7 +3205,7 @@ void BTA_DmBleGapPeriodicAdvRemoveDevFromList(tBLE_ADDR_TYPE addr_type,
|
||||
p_msg->addr_type = addr_type;
|
||||
p_msg->sid = sid;
|
||||
memcpy(p_msg->addr, addr, sizeof(BD_ADDR));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3064,7 +3220,7 @@ void BTA_DmBleGapPeriodicAdvClearDev(void)
|
||||
if ((p_msg = (tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR *) osi_malloc(sizeof(tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_CLEAR_DEV_EVT;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3080,7 +3236,7 @@ void BTA_DmBleGapSetExtScanParams(tBTA_DM_BLE_EXT_SCAN_PARAMS *params)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_EXT_SCAN_PARAMS));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_EXT_SCAN_PARAMS_EVT;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_EXT_SCAN_PARAMS));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3098,7 +3254,7 @@ void BTA_DmBleGapExtScan(BOOLEAN start, UINT32 duration, UINT16 period)
|
||||
p_msg->start = start;
|
||||
p_msg->duration = duration;
|
||||
p_msg->period = period;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3132,7 +3288,7 @@ void BTA_DmBleGapPreferExtConnectParamsSet(BD_ADDR bd_addr,
|
||||
if (phy_coded_conn_params) {
|
||||
memcpy(&p_msg->phy_coded_conn_params, phy_coded_conn_params, sizeof(tBTA_DM_BLE_CONN_PARAMS));
|
||||
}
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3151,7 +3307,7 @@ void BTA_DmBleGapExtConnect(tBLE_ADDR_TYPE own_addr_type, const BD_ADDR peer_add
|
||||
p_msg->hdr.event = BTA_DM_API_EXT_CONN_EVT;
|
||||
p_msg->own_addr_type = own_addr_type;
|
||||
memcpy(p_msg->peer_addr, peer_addr, sizeof(BD_ADDR));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3159,6 +3315,39 @@ void BTA_DmBleGapExtConnect(tBLE_ADDR_TYPE own_addr_type, const BD_ADDR peer_add
|
||||
|
||||
}
|
||||
|
||||
void BTA_DmBleDtmEnhTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t pkt_payload, uint8_t phy, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
{
|
||||
tBTA_DM_API_BLE_DTM_ENH_TX_START *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_DTM_ENH_TX_START *)osi_malloc(sizeof(tBTA_DM_API_BLE_DTM_ENH_TX_START)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_DTM_ENH_TX_START_EVT;
|
||||
p_msg->tx_channel = tx_channel;
|
||||
p_msg->len_of_data = len_of_data;
|
||||
p_msg->pkt_payload = pkt_payload;
|
||||
p_msg->phy = phy;
|
||||
p_msg->p_dtm_cmpl_cback = p_dtm_cmpl_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleDtmEnhRxStart(uint8_t rx_channel, uint8_t phy, uint8_t modulation_index, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
{
|
||||
tBTA_DM_API_BLE_DTM_ENH_RX_START *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_DTM_ENH_RX_START *)osi_malloc(sizeof(tBTA_DM_API_BLE_DTM_ENH_RX_START)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_DTM_ENH_RX_START_EVT;
|
||||
p_msg->rx_channel= rx_channel;
|
||||
p_msg->phy = phy;
|
||||
p_msg->modulation_index = modulation_index;
|
||||
p_msg->p_dtm_cmpl_cback = p_dtm_cmpl_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
@@ -3171,7 +3360,7 @@ void BTA_DmBleGapPeriodicAdvRecvEnable(UINT16 sync_handle, UINT8 enable)
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_RECV_ENABLE_EVT;
|
||||
p_msg->sync_handle = sync_handle;
|
||||
p_msg->enable = enable;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3188,7 +3377,7 @@ void BTA_DmBleGapPeriodicAdvSyncTrans(BD_ADDR peer_addr, UINT16 service_data, UI
|
||||
memcpy(p_msg->addr, peer_addr, sizeof(BD_ADDR));
|
||||
p_msg->service_data = service_data;
|
||||
p_msg->sync_handle = sync_handle;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3205,7 +3394,7 @@ void BTA_DmBleGapPeriodicAdvSetInfoTrans(BD_ADDR peer_addr, UINT16 service_data,
|
||||
memcpy(p_msg->addr, peer_addr, sizeof(BD_ADDR));
|
||||
p_msg->service_data = service_data;
|
||||
p_msg->adv_hanlde = adv_handle;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3221,7 +3410,7 @@ void BTA_DmBleGapSetPeriodicAdvSyncTransParams(BD_ADDR peer_addr, tBTA_DM_BLE_PA
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PERIODIC_ADV_SYNC_TRANS_PARAMS_EVT;
|
||||
memcpy(p_msg->addr, peer_addr, sizeof(BD_ADDR));
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_PAST_PARAMS));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_disable, /* BTA_DM_API_DISABLE_EVT */
|
||||
bta_dm_set_dev_name, /* BTA_DM_API_SET_NAME_EVT */
|
||||
bta_dm_get_dev_name, /* BTA_DM_API_GET_NAME_EVT */
|
||||
bta_dm_send_vendor_hci, /* BTA_DM_API_SEND_VENDOR_HCI_CMD_EVT */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_dm_config_eir, /* BTA_DM_API_CONFIG_EIR_EVT */
|
||||
#endif
|
||||
@@ -202,6 +203,8 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_ble_gap_ext_scan, /* BTA_DM_API_START_EXT_SCAN_EVT */
|
||||
bta_dm_ble_gap_set_prefer_ext_conn_params, /* BTA_DM_API_SET_PERF_EXT_CONN_PARAMS_EVT */
|
||||
NULL, /* BTA_DM_API_EXT_CONN_EVT */
|
||||
bta_dm_ble_gap_dtm_enhance_tx_start, /* BTA_DM_API_DTM_ENH_TX_START_EVT */
|
||||
bta_dm_ble_gap_dtm_enhance_rx_start, /* BTA_DM_API_DTM_ENH_RX_START_EVT */
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
bta_dm_ble_gap_periodic_adv_recv_enable, /* BTA_DM_API_PERIODIC_ADV_RECV_ENABLE_EVT */
|
||||
@@ -209,6 +212,15 @@ 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_dtm_tx_start, /* BTA_DM_API_DTM_TX_START_EVT */
|
||||
bta_dm_ble_gap_dtm_rx_start, /* BTA_DM_API_DTM_RX_START_EVT */
|
||||
bta_dm_ble_gap_dtm_stop, /* BTA_DM_API_DTM_STOP_EVT */
|
||||
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
|
||||
bta_dm_ble_gap_set_rpa_timeout, /* BTA_DM_API_SET_RPA_TIMEOUT_EVT */
|
||||
bta_dm_ble_gap_add_dev_to_resolving_list, /* BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT */
|
||||
bta_dm_ble_gap_set_privacy_mode, /* BTA_DM_API_SET_PRIVACY_MODE_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);
|
||||
|
||||
@@ -54,6 +54,7 @@ enum {
|
||||
BTA_DM_API_DISABLE_EVT,
|
||||
BTA_DM_API_SET_NAME_EVT,
|
||||
BTA_DM_API_GET_NAME_EVT,
|
||||
BTA_DM_API_SEND_VENDOR_HCI_CMD_EVT,
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTA_DM_API_CONFIG_EIR_EVT,
|
||||
#endif
|
||||
@@ -74,7 +75,7 @@ enum {
|
||||
BTA_DM_API_PIN_REPLY_EVT,
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
/* power manger events */
|
||||
/* power manager events */
|
||||
BTA_DM_PM_BTM_STATUS_EVT,
|
||||
BTA_DM_PM_TIMER_EVT,
|
||||
#endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
|
||||
@@ -199,6 +200,8 @@ enum {
|
||||
BTA_DM_API_START_EXT_SCAN_EVT,
|
||||
BTA_DM_API_SET_PERF_EXT_CONN_PARAMS_EVT,
|
||||
BTA_DM_API_EXT_CONN_EVT,
|
||||
BTA_DM_API_DTM_ENH_TX_START_EVT,
|
||||
BTA_DM_API_DTM_ENH_RX_START_EVT,
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
BTA_DM_API_PERIODIC_ADV_RECV_ENABLE_EVT,
|
||||
@@ -206,6 +209,15 @@ 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_DTM_TX_START_EVT,
|
||||
BTA_DM_API_DTM_RX_START_EVT,
|
||||
BTA_DM_API_DTM_STOP_EVT,
|
||||
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
||||
BTA_DM_API_SET_RPA_TIMEOUT_EVT,
|
||||
BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT,
|
||||
BTA_DM_API_SET_PRIVACY_MODE_EVT,
|
||||
#endif
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
|
||||
@@ -242,6 +254,14 @@ typedef struct {
|
||||
tBTA_GET_DEV_NAME_CBACK *p_cback;
|
||||
} tBTA_DM_API_GET_NAME;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 opcode;
|
||||
UINT8 param_len;
|
||||
UINT8 *p_param_buf;
|
||||
tBTA_SEND_VENDOR_HCI_CMPL_CBACK *vendor_hci_cb;
|
||||
}tBTA_DM_API_SEND_VENDOR_HCI_CMD;
|
||||
|
||||
/* data type for BTA_DM_API_CONFIG_EIR_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@@ -615,7 +635,7 @@ typedef struct {
|
||||
tBTA_DM_BLE_SEL_CBACK *p_select_cback;
|
||||
} tBTA_DM_API_BLE_SET_BG_CONN_TYPE;
|
||||
|
||||
/* set prefered BLE connection parameters for a device */
|
||||
/* set preferred BLE connection parameters for a device */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR peer_bda;
|
||||
@@ -716,6 +736,20 @@ typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_DM_APT_CLEAR_ADDR;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 rpa_timeout;
|
||||
tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback;
|
||||
} tBTA_DM_API_SET_RPA_TIMEOUT;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr; // Event header
|
||||
esp_bd_addr_t addr; // Bluetooth device address
|
||||
UINT8 addr_type; // Type of the address
|
||||
UINT8 irk[PEER_IRK_LEN]; // Identity Resolving Key (IRK)
|
||||
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback; // Callback function pointer
|
||||
} tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST;
|
||||
|
||||
/* set adv parameter for BLE advertising */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@@ -842,6 +876,38 @@ typedef struct {
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_DM_API_BLE_DISCONNECT;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 tx_channel;
|
||||
UINT8 len_of_data;
|
||||
UINT8 pkt_payload;
|
||||
tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback;
|
||||
} tBTA_DM_API_BLE_DTM_TX_START;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 rx_channel;
|
||||
tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback;
|
||||
} tBTA_DM_API_BLE_DTM_RX_START;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback;
|
||||
} tBTA_DM_API_BLE_DTM_STOP;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback;
|
||||
} tBTA_DM_API_CLEAR_ADV;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBLE_ADDR_TYPE addr_type;
|
||||
BD_ADDR addr;
|
||||
UINT8 privacy_mode;
|
||||
tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback;
|
||||
} tBTA_DM_API_SET_PRIVACY_MODE;
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
/* data type for BTA_DM_API_REMOVE_ACL_EVT */
|
||||
@@ -898,6 +964,22 @@ typedef struct {
|
||||
#endif
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 tx_channel;
|
||||
UINT8 len_of_data;
|
||||
UINT8 pkt_payload;
|
||||
UINT8 phy;
|
||||
tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback;
|
||||
} tBTA_DM_API_BLE_DTM_ENH_TX_START;
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 rx_channel;
|
||||
UINT8 phy;
|
||||
UINT8 modulation_index;
|
||||
tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback;
|
||||
} tBTA_DM_API_BLE_DTM_ENH_RX_START;
|
||||
|
||||
#define BTA_PHY_1M_MASK (1 << 0)
|
||||
#define BTA_PHY_2M_MASK (1 << 1)
|
||||
#define BTAS_PHY_CODED_MASK (1 << 2)
|
||||
@@ -1074,6 +1156,7 @@ typedef union {
|
||||
|
||||
tBTA_DM_API_SET_NAME set_name;
|
||||
tBTA_DM_API_GET_NAME get_name;
|
||||
tBTA_DM_API_SEND_VENDOR_HCI_CMD vendor_hci_cmd;
|
||||
tBTA_DM_API_CONFIG_EIR config_eir;
|
||||
|
||||
tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels;
|
||||
@@ -1170,6 +1253,8 @@ typedef union {
|
||||
tBTA_DM_API_BLE_SET_DATA_LENGTH ble_set_data_length;
|
||||
tBTA_DM_APT_SET_DEV_ADDR set_addr;
|
||||
tBTA_DM_APT_CLEAR_ADDR clear_addr;
|
||||
tBTA_DM_API_SET_RPA_TIMEOUT set_rpa_timeout;
|
||||
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST add_dev_to_resolving_list;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_ENB ble_multi_adv_enb;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data;
|
||||
@@ -1205,6 +1290,8 @@ typedef union {
|
||||
tBTA_DM_API_SET_EXT_SCAN_PARAMS ble_set_ext_scan_params;
|
||||
tBTA_DM_API_EXT_SCAN ble_ext_scan;
|
||||
tBTA_DM_API_SET_PER_EXT_CONN_PARAMS ble_set_per_ext_conn_params;
|
||||
tBTA_DM_API_BLE_DTM_ENH_TX_START dtm_enh_tx_start;
|
||||
tBTA_DM_API_BLE_DTM_ENH_RX_START dtm_enh_rx_start;
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
tBTA_DM_API_PERIODIC_ADV_RECV_ENABLE ble_periodic_adv_recv_enable;
|
||||
@@ -1212,6 +1299,12 @@ 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_BLE_DTM_TX_START dtm_tx_start;
|
||||
tBTA_DM_API_BLE_DTM_RX_START dtm_rx_start;
|
||||
tBTA_DM_API_BLE_DTM_STOP dtm_stop;
|
||||
tBTA_DM_API_CLEAR_ADV ble_clear_adv;
|
||||
tBTA_DM_API_SET_PRIVACY_MODE ble_set_privacy_mode;
|
||||
#endif
|
||||
|
||||
tBTA_DM_API_REMOVE_ACL remove_acl;
|
||||
@@ -1346,7 +1439,7 @@ typedef struct {
|
||||
UINT32 role_policy_mask; /* the bits set indicates the modules that wants to remove role switch from the default link policy */
|
||||
UINT16 cur_policy; /* current default link policy */
|
||||
UINT16 rs_event; /* the event waiting for role switch */
|
||||
UINT8 cur_av_count; /* current AV connecions */
|
||||
UINT8 cur_av_count; /* current AV connections */
|
||||
BOOLEAN disable_pair_mode; /* disable pair mode or not */
|
||||
BOOLEAN conn_paired_only; /* allow connectable to paired device only or not */
|
||||
tBTA_DM_API_SEARCH search_msg;
|
||||
@@ -1575,6 +1668,7 @@ extern void bta_dm_enable (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_disable (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_get_dev_name (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_send_vendor_hci(tBTA_DM_MSG *p_data);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
extern void bta_dm_config_eir (tBTA_DM_MSG *p_data);
|
||||
#endif
|
||||
@@ -1643,7 +1737,16 @@ 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_dtm_tx_start(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_dtm_rx_start(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data);
|
||||
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);
|
||||
extern void bta_dm_ble_gap_set_prefer_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 {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user