Compare commits
885 commits
Author | SHA1 | Date | |
---|---|---|---|
Carsten Schmiemann | 25d79ca572 | ||
1ff5e24b1b | |||
844922539e | |||
a5ee881789 | |||
d59ed8bba0 | |||
7124a32fed | |||
44ec7972bd | |||
49ace4968f | |||
1903c05d53 | |||
5d42f3075e | |||
8667591004 | |||
e0a8eb60dd | |||
25781e7c88 | |||
1f78540cbb | |||
843889fd03 | |||
873aca4c0d | |||
81da2bae2a | |||
d8456c621e | |||
cc8f9cc539 | |||
737fce72cc | |||
a15f77e1c7 | |||
652f43d9ee | |||
516ca4698f | |||
59112bbd76 | |||
a4ad6f7547 | |||
71af965514 | |||
1960d3c700 | |||
3280f45259 | |||
66d3783c89 | |||
ec4124676f | |||
3616ae4da4 | |||
312f100551 | |||
39f26cce95 | |||
4e71047a2a | |||
e5cf7bc370 | |||
91fca12f6a | |||
668347e9c1 | |||
c1b49c419d | |||
cd06c14265 | |||
410d59d53d | |||
77486506e3 | |||
adaed2c79d | |||
4a9f946278 | |||
632530ef3c | |||
ef43198018 | |||
4a3e7bc40d | |||
c5b23a85b8 | |||
35b2eeaa65 | |||
fc6f480e89 | |||
394d0ecb65 | |||
2e3dfd23e7 | |||
83809a37a7 | |||
d61459e692 | |||
5543b6a85b | |||
d25b00bd5e | |||
5a287c3a31 | |||
a1c57aa022 | |||
b097435596 | |||
2a0dc304c0 | |||
b94c309fd9 | |||
3901f38de6 | |||
58c5b7a1bf | |||
0d92639439 | |||
23a21f92be | |||
aa329b08ce | |||
7d8d841659 | |||
a5b5467dca | |||
18cc96d188 | |||
3e61d519c1 | |||
ad0b1ac8d7 | |||
651dc8788f | |||
31d272e460 | |||
b4338b61a2 | |||
5d1da96e3e | |||
542b6bdbc1 | |||
733aaa4af0 | |||
0b42900063 | |||
22ce545187 | |||
4a1016411b | |||
a9f6748de9 | |||
b4c3c87c75 | |||
3940ab80a3 | |||
d7c2d66d55 | |||
4fc62b7983 | |||
de15e502a7 | |||
d51431fff5 | |||
d4651bbb30 | |||
e202225bd1 | |||
1a3515ab76 | |||
a662d14a4e | |||
4dcbe2bd7a | |||
22d01ba674 | |||
4782dde73a | |||
151e4e156f | |||
1aa40de934 | |||
471d79edae | |||
1ffeff5948 | |||
0f6b7ad3cf | |||
111e0361c9 | |||
6c2bffe53c | |||
0167a5e96d | |||
021e1189c5 | |||
936c803ccb | |||
02893a2038 | |||
cd86bc9d8d | |||
9401c59f89 | |||
67edd0c10e | |||
abf6cecde1 | |||
67276f5d26 | |||
3c0aee8595 | |||
2233b5d25e | |||
a55f0ebbd5 | |||
e49a6b95ed | |||
4a037fa911 | |||
0b792c44eb | |||
81354cf24f | |||
fcadbaf97c | |||
186ad2f6aa | |||
4f3ddbb299 | |||
9debc7248a | |||
fb18b12efe | |||
251676181a | |||
e12593a79f | |||
7f9a4d25ef | |||
4afc8facde | |||
c73a00e073 | |||
f2f13eb8e8 | |||
c9f4b0aba8 | |||
6e284ea84b | |||
34961db9c1 | |||
b64b375234 | |||
315cbe05cf | |||
f54f776905 | |||
c7a9851de0 | |||
1f32a8d95e | |||
c3e8fb73c7 | |||
9dda741a99 | |||
a7e1c144e2 | |||
8a79415c2e | |||
1d8bf5356b | |||
d7ea1b0a08 | |||
65d829826e | |||
bca1beb3f0 | |||
4f11ecebbc | |||
64adabfd3a | |||
cbcb218418 | |||
cec88e11ed | |||
34f30a878e | |||
908938bc3c | |||
518e1da637 | |||
cccdd13937 | |||
6c5fc42114 | |||
7514850962 | |||
fa24dd7f6d | |||
e1fd76a11f | |||
9b70ddbb77 | |||
1090c12acd | |||
d79e95e6e0 | |||
a3ef2bbe33 | |||
a571bc0d0a | |||
3b79b6b5da | |||
7e6572a34d | |||
93ad53c09d | |||
10d40d1448 | |||
0af1da4416 | |||
77e3b100eb | |||
073542063c | |||
b5ac1871de | |||
2ad0565e3a | |||
ad75a51f43 | |||
6552aef2e7 | |||
468c30843c | |||
f8bf6b1f91 | |||
5725cb9342 | |||
b2b47b4465 | |||
ad2a05a391 | |||
fee489e770 | |||
173c76cb04 | |||
c30a264d21 | |||
31060cf42b | |||
8a19d03a1c | |||
d5e9fc092c | |||
8ae06fde5f | |||
90e2bbe330 | |||
9aa33c344a | |||
7cb6b85ec9 | |||
f11e347e2e | |||
ba47806b8d | |||
cfcc189a89 | |||
41debcfbd2 | |||
726c74ff39 | |||
6a2652c685 | |||
c7cb56b507 | |||
ff1132d2e4 | |||
6ea6de8d42 | |||
7e26c8ddda | |||
f043a3da97 | |||
f6cc9afaa9 | |||
55489bb41a | |||
43ffec0bd7 | |||
c1c4990f75 | |||
72f029abc3 | |||
c902b1fa24 | |||
78003e9437 | |||
2a6b0d68ce | |||
da068a639f | |||
df8b2c5f3a | |||
a194c415a8 | |||
33546a0094 | |||
8fb47ab0c2 | |||
09113e163b | |||
85ca89ee4a | |||
9825d0004f | |||
c7f33524b4 | |||
c2ead692aa | |||
a293dfea7a | |||
9ff108dcd0 | |||
0a75f2d5f8 | |||
fbdcfc8e4a | |||
22e3c00b48 | |||
7952bed766 | |||
ab63b48f6f | |||
8ab3cb0b12 | |||
cb78c1083f | |||
7e1c529b00 | |||
f538307629 | |||
68ecc44d34 | |||
b244afc208 | |||
bfaa14bfdd | |||
12d476427f | |||
debda4a63f | |||
b76f5b2ef2 | |||
d674016d64 | |||
9ce137139b | |||
52c089fba7 | |||
035783039b | |||
2e89f963d7 | |||
aa6730f0e2 | |||
593ca2255c | |||
dc5eeb8e4b | |||
62fea80a01 | |||
44791067ec | |||
55bb42dc63 | |||
fc8ba15b33 | |||
6bbb75f219 | |||
22d636b7b0 | |||
95e43fc2c4 | |||
4f5577446b | |||
7aab15f33d | |||
b64f4bced8 | |||
bf02206096 | |||
e5066c9969 | |||
07942e3991 | |||
62a187b55b | |||
858e12a040 | |||
bfb7757feb | |||
de82bd5d19 | |||
9a205c654d | |||
0137aef471 | |||
ff2fef7e91 | |||
7ca3bc1e48 | |||
83fdac780c | |||
7c95474f6c | |||
28c0673376 | |||
9eb66d49e4 | |||
b45e2699b2 | |||
e84ad136b9 | |||
22926742be | |||
a3ef357b8d | |||
44887f5fde | |||
048fd80450 | |||
6ac7ceef9e | |||
7b89c38034 | |||
9024cd38ec | |||
07830df4d3 | |||
d497c4babd | |||
2d28fd2563 | |||
1592f338a6 | |||
0ee287cd32 | |||
58cf509495 | |||
dc1ca69e5f | |||
5e6bfb77fa | |||
4195d7c2ee | |||
c3465e05c1 | |||
f2c06622b7 | |||
e97f72ea24 | |||
40f01ec30a | |||
6ba62f7b0b | |||
ed7664d19f | |||
3675e3182f | |||
7a79cc4a5e | |||
376377ceca | |||
490a7e682d | |||
1b9d62ad95 | |||
21601f00f4 | |||
81139df91e | |||
e5c15c068e | |||
7e2465995f | |||
aaa0853572 | |||
878d70d9e6 | |||
a8916daeb2 | |||
b7a2516242 | |||
4a9f339447 | |||
c1af728239 | |||
35789eef16 | |||
4a0d8ef478 | |||
23c17c4c0d | |||
2821e99bcc | |||
a4f2283384 | |||
b905f2de4d | |||
c517628c77 | |||
cbec031c91 | |||
90c7885f4d | |||
476d4ba1b7 | |||
da80efa8bc | |||
725ecf108f | |||
d10dec358d | |||
7b2ece3ac2 | |||
293a665601 | |||
c6c1d089cc | |||
e5fe1c0e68 | |||
09cf34c9aa | |||
d76d94549a | |||
f3e22bc23c | |||
444ded835d | |||
57c7a25bb3 | |||
8c17eb91e2 | |||
91ec6068e9 | |||
dab432d7ff | |||
accef886a9 | |||
76719b9c37 | |||
da10a5b7e9 | |||
901e8338ac | |||
fbe566ac67 | |||
381bd7d785 | |||
c0a68466a7 | |||
e9786e3038 | |||
eaf8cfbf8d | |||
055943e293 | |||
b34a0874b1 | |||
0d7f6a54e5 | |||
100379c4aa | |||
5d7d46a76d | |||
eaaad51f81 | |||
f21762eeef | |||
e7f57fef55 | |||
284362d62d | |||
29b009d6fd | |||
86e8983499 | |||
fa42f63226 | |||
93c9c07e22 | |||
483fc9be6f | |||
2ed18dcdd7 | |||
cb2e328c5f | |||
267ce80355 | |||
8b54542a88 | |||
030f17ae28 | |||
a8fe057219 | |||
adc5b2e08f | |||
0be4deeb22 | |||
1ffaf8aad9 | |||
9e7d9ef385 | |||
88eaa34075 | |||
b434b8f5d2 | |||
7e6d1ef4bc | |||
92dc6a6dde | |||
8e51f7e236 | |||
492c682dbe | |||
3886be23c8 | |||
ddbce78bff | |||
a230075447 | |||
4b5be79c0c | |||
b80b5dad32 | |||
ee39083d1b | |||
38b4d1d70c | |||
2e85c5b62e | |||
a820787414 | |||
cea6908238 | |||
d81c79d79f | |||
2f8508c7eb | |||
fd281c11cc | |||
5328154a01 | |||
6dd653392b | |||
dd623febf5 | |||
106c8813ed | |||
524308c98d | |||
553725df84 | |||
7d3733d255 | |||
038f51ffa6 | |||
4e78900fbf | |||
87215ca0c3 | |||
f6bfe13eb3 | |||
294a051538 | |||
4aa1058e8a | |||
a08c77ae96 | |||
df874cd070 | |||
36fff1d751 | |||
fe0d45d549 | |||
6f19193de6 | |||
8f4e7d2456 | |||
4156c6ddec | |||
cb20ba50b1 | |||
131979e517 | |||
9d6cace1fd | |||
a5b007f6bb | |||
0beb60e8fc | |||
9294e4d08d | |||
193b8e93a8 | |||
8da392aa1d | |||
c3cee5e3de | |||
0c13ae6b45 | |||
306a1173af | |||
592a4295be | |||
2549951498 | |||
b2384dc9ee | |||
f95826144e | |||
344cb99d34 | |||
464df4b788 | |||
8ff0d986b6 | |||
225bc0f80a | |||
96c8343e46 | |||
d9cdbcdc8b | |||
3ee11bcafc | |||
bcb543eb10 | |||
bb73659c9c | |||
58bc6be4c0 | |||
5059c7fac3 | |||
cf866f23f2 | |||
faec3211bd | |||
c7d0df5451 | |||
7097cb9c9d | |||
1fcef31195 | |||
acc882f4dd | |||
e4c1bcddc5 | |||
b2455219cc | |||
de6b7d6520 | |||
fa40e43c8d | |||
9f29dbf656 | |||
b2d61989f1 | |||
bb518afb59 | |||
37063ea9b6 | |||
f6837e6117 | |||
c4f39094d3 | |||
2da22620f8 | |||
f77d0a9cdb | |||
ddf4991024 | |||
f8597be435 | |||
6e5e430ef4 | |||
065d451e47 | |||
c8990eb39d | |||
c90f770599 | |||
48978c6f2b | |||
5bb5670d69 | |||
7197811861 | |||
892c2be168 | |||
5c6be8380e | |||
1d8e1c4ce4 | |||
1778573dad | |||
9778549759 | |||
e5e226a121 | |||
71845041e0 | |||
54dff92df5 | |||
a5bd08a6b6 | |||
befc74e0f0 | |||
12bf1017de | |||
006442cd9d | |||
25a134afdc | |||
70811110fc | |||
b87e440c69 | |||
f85294b058 | |||
413b6487fb | |||
f608afbe6b | |||
325fca94c0 | |||
3130b19cf8 | |||
5d2c23c8ab | |||
8480e79ae2 | |||
86052eec78 | |||
5ede49ca4a | |||
bbdb236ab7 | |||
0a0113bcce | |||
84a534a4a0 | |||
286202caa3 | |||
6b4dcd4f5c | |||
4f62227030 | |||
9ebaf36c28 | |||
1ece141c52 | |||
f49e2afe94 | |||
17b260d05c | |||
07fc1d181f | |||
beb29bc88a | |||
76c20ab9b3 | |||
241ba1a6bb | |||
1fac58deb7 | |||
78d32f2e8b | |||
f237b92bc4 | |||
ccc1263ca8 | |||
51a44c81de | |||
1b96cefaf8 | |||
ef82e8d0bc | |||
d6bdaed141 | |||
13018449fe | |||
b6687e56ed | |||
6494927766 | |||
6ce5c7668f | |||
c97a05c0d5 | |||
fed772641a | |||
39d8a89c80 | |||
62980ae995 | |||
029a155a71 | |||
4849d7ae90 | |||
10b4ddb467 | |||
288bc2bfca | |||
8e4ec90dc4 | |||
0e06b4d653 | |||
8fe4007dfa | |||
09f4015300 | |||
56918682f9 | |||
6b49a355f7 | |||
6628fddae6 | |||
ff99e0ea69 | |||
b305a96a74 | |||
fe4e68132f | |||
e870a0f0f1 | |||
12643e063c | |||
a7dc804476 | |||
7342811c37 | |||
8e0b0af09b | |||
e1e82c8949 | |||
d99d92e170 | |||
1ca67e98d6 | |||
f8f0c81077 | |||
727c2cfa00 | |||
1d4eeeb464 | |||
e9a764d9a5 | |||
b2e4af4ed0 | |||
66a0b64e54 | |||
9d48cdb6f3 | |||
258e9c98be | |||
35e491856e | |||
226c790766 | |||
c0d32f6e48 | |||
203f75223e | |||
742f8e7f8a | |||
7e16a79cf7 | |||
22dc4898d9 | |||
f78c96a3d7 | |||
b4727a8765 | |||
8bbd99ad9e | |||
5dcdef0639 | |||
d651ee3d28 | |||
34f1c208a8 | |||
83d7b4591c | |||
f5096892f9 | |||
56694fb4b6 | |||
929542d4fa | |||
be49c8d841 | |||
67aefe1011 | |||
46a3c36343 | |||
58e49d169c | |||
a241f95407 | |||
aaaa491c42 | |||
91aa35e831 | |||
113e829552 | |||
3802fddefb | |||
bb2eb9adeb | |||
78116afa01 | |||
b865e72aec | |||
f1b2457b6c | |||
46fa5654a7 | |||
bf28a1a27b | |||
b7beefba9e | |||
0784c52131 | |||
a7f826750b | |||
38086ae737 | |||
6173660ff0 | |||
79b450cfb4 | |||
c7fbc6dd85 | |||
3b5bba1812 | |||
b4feb67b5f | |||
578d7902af | |||
509884c5ac | |||
8a656f006e | |||
0f79c72704 | |||
6d6f71bbae | |||
332ccd0925 | |||
2ee1c6fd3e | |||
6a328992d7 | |||
b51f109dd7 | |||
85e8dea26a | |||
093c7b176d | |||
30e39631db | |||
a7ff611b10 | |||
2e64d2d56e | |||
3e6b402756 | |||
5568ca2855 | |||
30f2371917 | |||
ebaa944a9a | |||
d83598a64a | |||
00d1068869 | |||
49be9fb836 | |||
6f0c70daf6 | |||
219c85cf60 | |||
524696d59a | |||
9a229f4077 | |||
016c8d8b05 | |||
9914b839aa | |||
76e4ea7f68 | |||
3ec0f415a5 | |||
fa40b3d5d0 | |||
f742808333 | |||
51bd64c754 | |||
b85321be97 | |||
dcd63f73f6 | |||
b8f0c32a0a | |||
8f2e1471af | |||
a159e58ead | |||
fe767855df | |||
1e674fb4ed | |||
3660ccac4c | |||
4f9a4e8ed7 | |||
582bf18789 | |||
2e3f06ece8 | |||
c62a20f162 | |||
ed4d83af8e | |||
1444868917 | |||
05ba4f15d6 | |||
37b7153c0e | |||
1a53334843 | |||
fd29b0165f | |||
9c3262f80b | |||
900dbfd1f6 | |||
13a1f4ed78 | |||
8a69ffc36f | |||
a437e4dc5c | |||
741f97da4e | |||
eae2baa0f1 | |||
f49f5ff35a | |||
020b295f06 | |||
6e14de0fa8 | |||
95c7f45e84 | |||
651a08f710 | |||
18cb87b4ce | |||
1fedece94d | |||
137810915c | |||
bb766355b5 | |||
807ef53c38 | |||
e585121011 | |||
671be20cc5 | |||
022a9295b0 | |||
a34d788a5e | |||
2a47c5c7a4 | |||
cfc4f74b52 | |||
43a722f0de | |||
eff24857bc | |||
18118a6d5c | |||
64757c0228 | |||
bab80ad202 | |||
76f0dda3a4 | |||
ce9878ce71 | |||
403a24ab64 | |||
d2cf266762 | |||
cec39b750a | |||
0420f290a4 | |||
eb6dbeb15a | |||
5c9ab21d81 | |||
bab379faf8 | |||
fb7cd2a7a7 | |||
c208a6b451 | |||
78511c3cc3 | |||
cd6bbaa727 | |||
55b8f2ea8c | |||
ec2f1a6b9a | |||
26646b5b31 | |||
1ae9a2ae0b | |||
28eb488892 | |||
fcf1dba9cd | |||
94ed7b8298 | |||
24fab0b7a9 | |||
c4c1af114e | |||
b1ee25afde | |||
cccaa68467 | |||
6080767379 | |||
42b6c4953d | |||
746e831c19 | |||
36f9091e03 | |||
553ba51924 | |||
929d98538e | |||
b810b32675 | |||
00bf376bc3 | |||
fe19ea977b | |||
a953f73c64 | |||
bed50a93f0 | |||
a80bfc1dcf | |||
51d846417e | |||
ca54a5ce2a | |||
7b1777dd30 | |||
64b46ff1d9 | |||
c355d8a88e | |||
977af32d0f | |||
f0a6432717 | |||
c18e86a826 | |||
b5d53a0eff | |||
10afc3de77 | |||
545878d4e9 | |||
ec7909956d | |||
d9c3a08813 | |||
eb9a93f9b7 | |||
710019a47f | |||
2d27358f61 | |||
b80eba8d5a | |||
7832db7bb3 | |||
efa70bc8e3 | |||
31b7db5c38 | |||
8d02ccd2f7 | |||
62eb0f4c12 | |||
155f034b1e | |||
47dea73b03 | |||
28fdf96828 | |||
3969fe0dad | |||
c70c25afd0 | |||
d59d9eef4f | |||
22514e12d8 | |||
f48ffb37f2 | |||
0f041ee7bb | |||
c320a3ee4c | |||
1f35716ef4 | |||
358de85eb3 | |||
84277e5887 | |||
52a70e0489 | |||
6523d912f2 | |||
aa0d2078b7 | |||
348d6d5d3f | |||
46228db9a8 | |||
2cac11f162 | |||
64eeee4532 | |||
a9eb37e2c8 | |||
c7a297195f | |||
19e96add8a | |||
a0a0328e4f | |||
04aebc464c | |||
30e01847ad | |||
3f6033d8bd | |||
45e59a9f56 | |||
587e6ec93f | |||
6d00c7fc49 | |||
c418714ec6 | |||
19d8c050cd | |||
cb650382ca | |||
e5e592e5b6 | |||
28e20e90e3 | |||
1c4d9f2aca | |||
ded8b0102a | |||
401970495d | |||
5d46bb596d | |||
8de9149b11 | |||
e8b8946e6e | |||
2c1e3d1ef2 | |||
bf608b6709 | |||
24ebdbd3f4 | |||
fd00d3213b | |||
c921a5bc4b | |||
ade85cc850 | |||
5c8d25b795 | |||
ac051f0afc | |||
bb47146710 | |||
07cb228f64 | |||
3cfe1c89b5 | |||
4f805d558c | |||
f53716d851 | |||
f8fd922ca5 | |||
61d07ffbfc | |||
6b5649190f | |||
f44507de53 | |||
88c7a61a63 | |||
6af90457f7 | |||
3aafb2cfcf | |||
8ec0c82c3f | |||
a338c1b712 | |||
0b21be508e | |||
3b4d51bbfa | |||
60c556eb55 | |||
9933e37c8b | |||
67bdc8aaf4 | |||
44bd6f72bc | |||
2d67ce3109 | |||
e85cb6d148 | |||
7658b8ab62 | |||
7969a566e3 | |||
be05b1e654 | |||
ca51b60033 | |||
9b3ff1bed0 | |||
f859f9e25b | |||
f2ae151dab | |||
bae0d8a313 | |||
cfcc0edc33 | |||
54e6f0793a | |||
e98f4d2751 | |||
33cf0faac8 | |||
7385e71c84 | |||
7778ce83bd | |||
0f8070a6fd | |||
0fcb9056f8 | |||
5110d4b303 | |||
fc19954376 | |||
16d32c58e7 | |||
3d926da642 | |||
9bb719dd68 | |||
536cb0489e | |||
98c7cb5560 | |||
4baf333c79 | |||
79401934a1 | |||
ec1daf32e1 | |||
5afc1b0cbb | |||
1cac0d2cf2 | |||
8d1594c339 | |||
a0f516de0b | |||
802d94aa35 | |||
3c3e375d8d | |||
d57ea422be | |||
3b3242cbae | |||
96c2b34eb9 | |||
6b3a8acdc3 | |||
a10abd695b | |||
0f28a51996 | |||
6681096e55 | |||
18b65dca26 | |||
a398116b1c | |||
331c7c7dc3 | |||
7bd9559e7e | |||
e84289077c | |||
c59c40741b | |||
f3c1903791 | |||
2885ec3831 | |||
a7db0e2291 | |||
cb98f5a814 | |||
8725bce5bc | |||
174b3b89e4 | |||
c0b211a480 | |||
8d9d8e27ca | |||
93f4dc6b32 | |||
b021bbdc80 | |||
c9fe4fa13e | |||
96252c493a | |||
007a4fcc4e | |||
dbeb8ae02a | |||
9921c8b91f | |||
e16f65f4e6 | |||
71eff833a1 | |||
fe0a5b41bf | |||
1f7c54ae85 | |||
049bd9fe0a | |||
167fb50a22 | |||
5f3b532c8d | |||
841a6dcd9a | |||
f2fbfeca87 | |||
65355d28dd | |||
812f959cec | |||
0c627b22f2 | |||
0fb2019f2b | |||
55d915e918 | |||
1a1a544afa | |||
c49e29f8b9 | |||
9cad14b151 | |||
5e0d903dfd | |||
f4905cdf2f | |||
9d8e44e0f0 | |||
daef4b5c11 | |||
0f978bcb45 | |||
78be47aad7 | |||
751f307e51 | |||
ddeff7d523 | |||
7f6161cd25 | |||
4c532a59b2 | |||
3d5f7b3efd | |||
8d8d62da9e | |||
5bf85d06d8 | |||
59bc8ff062 | |||
ae5a434f76 | |||
e533523275 | |||
a376475c2b | |||
bc56804a49 | |||
eee26d4ef7 | |||
be6f6993db | |||
a5bfa91217 | |||
96eccb52a5 |
|
@ -33,8 +33,15 @@ variables:
|
|||
APPLY_BOT_FILTER_SCRIPT: "$CI_PROJECT_DIR/tools/ci/apply_bot_filter.py"
|
||||
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
|
||||
|
||||
# Docker images
|
||||
# Docker images
|
||||
BOT_DOCKER_IMAGE_TAG: ":latest"
|
||||
# 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"
|
||||
CI_AUTO_TEST_SCRIPT_REPO_URL: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/auto_test_script.git"
|
||||
CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v3.1"
|
||||
|
||||
# Versioned esp-idf-doc env image to use for all document building jobs
|
||||
ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v5"
|
||||
|
||||
# When 'fetch' strategy is used, Gitlab removes untracked files before checking out
|
||||
# new revision. However if the new revision doesn't include some of the submodules
|
||||
|
@ -363,7 +370,11 @@ build_docker:
|
|||
DOCKER_TMP_IMAGE_NAME: "idf_tmp_image"
|
||||
before_script: []
|
||||
script:
|
||||
- export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
|
||||
- export LOCAL_CI_REPOSITORY_URL=$CI_REPOSITORY_URL
|
||||
- if [ -n "$LOCAL_GITLAB_HTTPS_HOST" ]; then export LOCAL_CI_REPOSITORY_URL="https://gitlab-ci-token:${CI_JOB_TOKEN}@${LOCAL_GITLAB_HTTPS_HOST}/${CI_PROJECT_PATH}"; fi
|
||||
- echo "Using repository at $LOCAL_CI_REPOSITORY_URL"
|
||||
- export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${LOCAL_CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
|
||||
|
||||
# Build
|
||||
- docker build --tag ${DOCKER_TMP_IMAGE_NAME} ${DOCKER_BUILD_ARGS} tools/docker/
|
||||
# We can't mount $PWD/examples/get-started/blink into the container, see https://gitlab.com/gitlab-org/gitlab-ce/issues/41227.
|
||||
|
@ -792,6 +803,18 @@ check_pipeline_triggered_by_label:
|
|||
# We want to make sure some jobs are always executed to detect regression.
|
||||
- test "$BOT_LABEL_REGULAR_TEST" = "true" || exit -1
|
||||
|
||||
# For release tag pipelines only, make sure the tag was created with 'git tag -a' so it will update
|
||||
# the version returned by 'git describe'
|
||||
check_version_tag:
|
||||
extends: .check_job_template
|
||||
only:
|
||||
refs:
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
script:
|
||||
- (git cat-file -t $CI_COMMIT_REF_NAME | grep tag) || echo "ESP-IDF versions must be annotated tags." && exit 1
|
||||
|
||||
assign_test:
|
||||
tags:
|
||||
- assign_test
|
||||
|
@ -806,6 +829,11 @@ assign_test:
|
|||
variables:
|
||||
TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw"
|
||||
EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs"
|
||||
INTEGRATION_CONFIG_OUTPUT_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
|
||||
TEST_CASE_FILE_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"
|
||||
PYTHON_VER: 3.7.7
|
||||
artifacts:
|
||||
paths:
|
||||
- components/idf_test/*/CIConfigs
|
||||
|
@ -824,11 +852,11 @@ assign_test:
|
|||
# assign unit test cases
|
||||
- python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $IDF_PATH/.gitlab-ci.yml $IDF_PATH/components/idf_test/unit_test/CIConfigs
|
||||
# clone test script to assign tests
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- ./tools/ci/retry_failed.sh git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
|
||||
- ./tools/ci/retry_failed.sh git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
# assgin integration test cases
|
||||
- python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
|
||||
- python ${ASSIGN_TEST_CASE_SCRIPT} -t $TEST_CASE_FILE_PATH -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin -o $INTEGRATION_CONFIG_OUTPUT_PATH
|
||||
|
||||
.define_config_file_name: &define_config_file_name |
|
||||
JOB_NAME_PREFIX=$(echo ${CI_JOB_NAME} | awk '{print $1}')
|
||||
|
@ -870,7 +898,7 @@ assign_test:
|
|||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
# clone test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- ./tools/ci/retry_failed.sh git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd $TEST_FW_PATH
|
||||
# run test
|
||||
|
@ -924,24 +952,28 @@ assign_test:
|
|||
variables:
|
||||
LOCAL_ENV_CONFIG_PATH: "$CI_PROJECT_DIR/ci-test-runner-configs/$CI_RUNNER_DESCRIPTION/ESP32_IDF"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/$CI_COMMIT_SHA"
|
||||
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/components/idf_test/integration_test"
|
||||
TEST_CASE_FILE_PATH: "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
|
||||
MODULE_UPDATE_FILE: "$CI_PROJECT_DIR/components/idf_test/ModuleDefinition.yml"
|
||||
CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/integration_test/CIConfigs"
|
||||
KNOWN_ISSUE_FILE: "${CI_PROJECT_DIR}/components/idf_test/integration_test/KnownIssues"
|
||||
PYTHONPATH: "${CI_PROJECT_DIR}/auto_test_script/packages"
|
||||
CI_RUNNER_SCRIPT: "${CI_PROJECT_DIR}/auto_test_script/bin/CIRunner.py"
|
||||
PYTHON_VER: 3.7.7
|
||||
before_script: *add_gitlab_key_before
|
||||
script:
|
||||
- *define_config_file_name
|
||||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
# clone local test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- ./tools/ci/retry_failed.sh git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd ci-test-runner-configs
|
||||
# clone test bench
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- ./tools/ci/retry_failed.sh git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
|
||||
- ./tools/ci/retry_failed.sh git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- cat ${KNOWN_ISSUE_FILE} >> ${TEST_CASE_FILE_PATH}/KnownIssues
|
||||
# run test
|
||||
- python CIRunner.py -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
|
||||
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
|
||||
|
||||
nvs_compatible_test:
|
||||
<<: *test_template
|
||||
|
@ -959,17 +991,17 @@ nvs_compatible_test:
|
|||
# first test if config file exists, if not exist, exit 0
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
# clone local test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- ./tools/ci/retry_failed.sh git clone $TEST_ENV_CONFIG_REPO
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd ci-test-runner-configs
|
||||
# clone test bench
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- ./tools/ci/retry_failed.sh git clone ${CI_AUTO_TEST_SCRIPT_REPO_URL} -b empty_branch
|
||||
- ./tools/ci/retry_failed.sh git -C auto_test_script checkout -f ${CI_AUTO_TEST_SCRIPT_REPO_BRANCH}
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script "$CI_PROJECT_DIR/auto_test_script/TestCaseFiles"
|
||||
# prepare nvs bins
|
||||
- ./Tools/prepare_nvs_bin.sh
|
||||
- cd auto_test_script
|
||||
- ./tools/prepare_nvs_bin.sh
|
||||
# run test
|
||||
- python CIRunner.py -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
|
||||
- python ${CI_RUNNER_SCRIPT} -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
|
||||
|
||||
example_test_001:
|
||||
<<: *example_test_template
|
||||
|
@ -1324,7 +1356,7 @@ IT_002:
|
|||
|
||||
IT_003:
|
||||
<<: *test_template
|
||||
parallel: 13
|
||||
parallel: 14
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T2_5
|
||||
|
@ -1344,7 +1376,7 @@ IT_005:
|
|||
|
||||
IT_006:
|
||||
<<: *test_template
|
||||
parallel: 8
|
||||
parallel: 13
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_6
|
||||
|
@ -1368,13 +1400,6 @@ IT_009:
|
|||
- ESP32_IDF
|
||||
- SSC_T1_3
|
||||
|
||||
IT_010:
|
||||
<<: *test_template
|
||||
parallel: 4
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T5_1
|
||||
|
||||
IT_011:
|
||||
<<: *test_template
|
||||
tags:
|
||||
|
@ -1414,6 +1439,7 @@ IT_015:
|
|||
|
||||
IT_016:
|
||||
<<: *test_template
|
||||
allow_failure: true
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T50_MESH1
|
||||
|
@ -1426,7 +1452,6 @@ IT_017:
|
|||
|
||||
IT_018:
|
||||
<<: *test_template
|
||||
parallel: 2
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- SSC_T1_9
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#define FLASH_SECTOR_SIZE 0x1000
|
||||
#define FLASH_BLOCK_SIZE 0x10000
|
||||
#define MMAP_ALIGNED_MASK 0x0000FFFF
|
||||
|
||||
/* Provide a Flash API for bootloader_support code,
|
||||
that can be used from bootloader or app code.
|
||||
|
@ -35,7 +36,7 @@
|
|||
*
|
||||
* @return Number of free pages
|
||||
*/
|
||||
uint32_t bootloader_mmap_get_free_pages();
|
||||
uint32_t bootloader_mmap_get_free_pages(void);
|
||||
|
||||
/**
|
||||
* @brief Map a region of flash to data memory
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
typedef void *bootloader_sha256_handle_t;
|
||||
|
||||
bootloader_sha256_handle_t bootloader_sha256_start();
|
||||
bootloader_sha256_handle_t bootloader_sha256_start(void);
|
||||
|
||||
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len);
|
||||
|
||||
|
|
|
@ -62,3 +62,17 @@ __attribute__((noreturn)) void bootloader_utility_load_boot_image(const bootload
|
|||
* It is not recommended to call this function from an app (if called, the app will abort).
|
||||
*/
|
||||
__attribute__((noreturn)) void bootloader_reset(void);
|
||||
|
||||
/** @brief Generates the digest of the data between offset & offset+length.
|
||||
*
|
||||
* This function should be used when the size of the data is larger than 3.2MB.
|
||||
* The MMU capacity is 3.2MB (50 pages - 64KB each). This function generates the SHA-256
|
||||
* of the data in chunks of 3.2MB, considering the MMU capacity.
|
||||
*
|
||||
* @param[in] flash_offset Offset of the data in flash.
|
||||
* @param[in] len Length of data in bytes.
|
||||
* @param[out] digest Pointer to buffer where the digest is written, if ESP_OK is returned.
|
||||
*
|
||||
* @return ESP_OK if secure boot digest is generated successfully.
|
||||
*/
|
||||
esp_err_t bootloader_sha256_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest);
|
|
@ -26,6 +26,8 @@
|
|||
#include "esp_flash_partitions.h"
|
||||
#include "bootloader_flash.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "bootloader_config.h"
|
||||
#include "bootloader_utility.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "soc/rtc.h"
|
||||
|
@ -186,22 +188,7 @@ esp_err_t bootloader_common_get_sha256_of_partition (uint32_t address, uint32_t
|
|||
size = data.image_len;
|
||||
}
|
||||
// If image is type by data then hash is calculated for entire image.
|
||||
const void *partition_bin = bootloader_mmap(address, size);
|
||||
if (partition_bin == NULL) {
|
||||
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", address, size);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
bootloader_sha256_handle_t sha_handle = bootloader_sha256_start();
|
||||
if (sha_handle == NULL) {
|
||||
bootloader_munmap(partition_bin);
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
bootloader_sha256_data(sha_handle, partition_bin, size);
|
||||
bootloader_sha256_finish(sha_handle, out_sha_256);
|
||||
|
||||
bootloader_munmap(partition_bin);
|
||||
|
||||
return ESP_OK;
|
||||
return bootloader_sha256_flash_contents(address, size, out_sha_256);
|
||||
}
|
||||
|
||||
int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata, bool *valid_two_otadata, bool max)
|
||||
|
@ -247,13 +234,15 @@ esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t
|
|||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const uint8_t *image = bootloader_mmap(partition->offset, partition->size);
|
||||
const uint32_t app_desc_offset = sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t);
|
||||
const uint32_t mmap_size = app_desc_offset + sizeof(esp_app_desc_t);
|
||||
const uint8_t *image = bootloader_mmap(partition->offset, mmap_size);
|
||||
if (image == NULL) {
|
||||
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", partition->offset, partition->size);
|
||||
ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", partition->offset, mmap_size);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
memcpy(app_desc, image + sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t), sizeof(esp_app_desc_t));
|
||||
memcpy(app_desc, image + app_desc_offset, sizeof(esp_app_desc_t));
|
||||
bootloader_munmap(image);
|
||||
|
||||
if (app_desc->magic_word != ESP_APP_DESC_MAGIC_WORD) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
// App version is a wrapper around mbedTLS SHA API
|
||||
#include <mbedtls/sha256.h>
|
||||
|
||||
bootloader_sha256_handle_t bootloader_sha256_start()
|
||||
bootloader_sha256_handle_t bootloader_sha256_start(void)
|
||||
{
|
||||
mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)malloc(sizeof(mbedtls_sha256_context));
|
||||
if (!ctx) {
|
||||
|
@ -53,6 +53,7 @@ void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest
|
|||
}
|
||||
mbedtls_sha256_free(ctx);
|
||||
free(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
#else // Bootloader version
|
||||
|
@ -70,7 +71,7 @@ static const size_t BLOCK_WORDS = (64/sizeof(uint32_t));
|
|||
// Words in final SHA256 digest
|
||||
static const size_t DIGEST_WORDS = (32/sizeof(uint32_t));
|
||||
|
||||
bootloader_sha256_handle_t bootloader_sha256_start()
|
||||
bootloader_sha256_handle_t bootloader_sha256_start(void)
|
||||
{
|
||||
// Enable SHA hardware
|
||||
ets_sha_enable();
|
||||
|
|
|
@ -703,3 +703,39 @@ void bootloader_reset(void)
|
|||
abort(); /* This function should really not be called from application code */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
esp_err_t bootloader_sha256_flash_contents(uint32_t flash_offset, uint32_t len, uint8_t *digest)
|
||||
{
|
||||
|
||||
if (digest == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* Handling firmware images larger than MMU capacity */
|
||||
uint32_t mmu_free_pages_count = bootloader_mmap_get_free_pages();
|
||||
bootloader_sha256_handle_t sha_handle = NULL;
|
||||
|
||||
sha_handle = bootloader_sha256_start();
|
||||
if (sha_handle == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
while (len > 0) {
|
||||
uint32_t mmu_page_offset = ((flash_offset & MMAP_ALIGNED_MASK) != 0) ? 1 : 0; /* Skip 1st MMU Page if it is already populated */
|
||||
uint32_t partial_image_len = MIN(len, ((mmu_free_pages_count - mmu_page_offset) * SPI_FLASH_MMU_PAGE_SIZE)); /* Read the image that fits in the free MMU pages */
|
||||
|
||||
const void * image = bootloader_mmap(flash_offset, partial_image_len);
|
||||
if (image == NULL) {
|
||||
bootloader_sha256_finish(sha_handle, NULL);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
bootloader_sha256_data(sha_handle, image, partial_image_len);
|
||||
bootloader_munmap(image);
|
||||
|
||||
flash_offset += partial_image_len;
|
||||
len -= partial_image_len;
|
||||
}
|
||||
bootloader_sha256_finish(sha_handle, digest);
|
||||
return ESP_OK;
|
||||
}
|
|
@ -371,12 +371,12 @@ if(CONFIG_BT_ENABLED)
|
|||
"esp_ble_mesh/mesh_core/settings.c"
|
||||
"esp_ble_mesh/mesh_core/test.c"
|
||||
"esp_ble_mesh/mesh_core/transport.c"
|
||||
"esp_ble_mesh/mesh_models/common/device_property.c"
|
||||
"esp_ble_mesh/mesh_models/client/client_common.c"
|
||||
"esp_ble_mesh/mesh_models/client/generic_client.c"
|
||||
"esp_ble_mesh/mesh_models/client/lighting_client.c"
|
||||
"esp_ble_mesh/mesh_models/client/sensor_client.c"
|
||||
"esp_ble_mesh/mesh_models/client/time_scene_client.c"
|
||||
"esp_ble_mesh/mesh_models/server/device_property.c"
|
||||
"esp_ble_mesh/mesh_models/server/generic_server.c"
|
||||
"esp_ble_mesh/mesh_models/server/lighting_server.c"
|
||||
"esp_ble_mesh/mesh_models/server/sensor_server.c"
|
||||
|
|
|
@ -1738,12 +1738,65 @@ if BLE_MESH
|
|||
option in the Bluetooth Controller section in menuconfig, which is
|
||||
"Scan Duplicate By Device Address and Advertising Data".
|
||||
|
||||
config BLE_MESH_ALLOC_FROM_PSRAM_FIRST
|
||||
bool "BLE Mesh will first allocate memory from PSRAM"
|
||||
choice BLE_MESH_MEM_ALLOC_MODE
|
||||
prompt "Memory allocation strategy"
|
||||
default BLE_MESH_MEM_ALLOC_MODE_INTERNAL
|
||||
help
|
||||
Allocation strategy for BLE Mesh stack, essentially provides ability to
|
||||
allocate all required dynamic allocations from,
|
||||
|
||||
- Internal DRAM memory only
|
||||
- External SPIRAM memory only
|
||||
- Either internal or external memory based on default malloc()
|
||||
behavior in ESP-IDF
|
||||
|
||||
Recommended mode here is always internal, since that is most preferred
|
||||
from security perspective. But if application requirement does not allow
|
||||
sufficient free internal memory then alternate mode can be selected.
|
||||
|
||||
config BLE_MESH_MEM_ALLOC_MODE_INTERNAL
|
||||
bool "Internal DRAM"
|
||||
|
||||
config BLE_MESH_ALLOC_FROM_PSRAM_FIRST
|
||||
bool "External SPIRAM"
|
||||
depends on SPIRAM_SUPPORT
|
||||
|
||||
config BLE_MESH_MEM_ALLOC_MODE_DEFAULT
|
||||
bool "Default alloc mode"
|
||||
depends on SPIRAM_SUPPORT
|
||||
help
|
||||
Enable this option to use the default memory allocation strategy when
|
||||
external SPIRAM is enabled. See the SPIRAM options for more details.
|
||||
|
||||
endchoice # BLE_MESH_MEM_ALLOC_MODE
|
||||
|
||||
config BLE_MESH_FREERTOS_STATIC_ALLOC
|
||||
bool "Enable FreeRTOS static allocation"
|
||||
depends on SUPPORT_STATIC_ALLOCATION && SPIRAM_SUPPORT
|
||||
default n
|
||||
help
|
||||
When this option is enabled, BLE Mesh stack will try to allocate memory
|
||||
from PSRAM firstly. This will save the internal RAM if PSRAM exists.
|
||||
Enable this option to use FreeRTOS static allocation APIs for BLE Mesh,
|
||||
which provides the ability to use different dynamic memory (i.e. SPIRAM)
|
||||
for FreeRTOS objects.
|
||||
If this option is disabled, the FreeRTOS static allocation APIs will not
|
||||
be used, and internal DRAM will be allocated for FreeRTOS objects.
|
||||
|
||||
choice BLE_MESH_FREERTOS_STATIC_ALLOC_MODE
|
||||
prompt "Memory allocation for FreeRTOS objects"
|
||||
depends on BLE_MESH_FREERTOS_STATIC_ALLOC
|
||||
help
|
||||
Choose the memory to be used for FreeRTOS objects.
|
||||
|
||||
config BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
|
||||
bool "External SPIRAM"
|
||||
depends on SPIRAM_SUPPORT
|
||||
help
|
||||
If enabled, BLE Mesh allocates dynamic memory from external SPIRAM for
|
||||
FreeRTOS objects, i.e. mutex, queue, and task stack. External SPIRAM
|
||||
can only be used for task stack when SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
|
||||
is enabled. See the SPIRAM options for more details.
|
||||
|
||||
endchoice # BLE_MESH_FREERTOS_STATIC_ALLOC_MODE
|
||||
|
||||
config BLE_MESH_FAST_PROV
|
||||
bool "Enable BLE Mesh Fast Provisioning"
|
||||
|
@ -1919,7 +1972,7 @@ if BLE_MESH
|
|||
advertising bearer.
|
||||
|
||||
config BLE_MESH_NET_BUF_POOL_USAGE
|
||||
bool "BLE Mesh net buffer pool usage tracking"
|
||||
bool
|
||||
default y
|
||||
help
|
||||
Enable BLE Mesh net buffer pool tracking. This option is used to introduce another
|
||||
|
@ -1977,7 +2030,7 @@ if BLE_MESH
|
|||
config BLE_MESH_SEQ_STORE_RATE
|
||||
int "How often the sequence number gets updated in storage"
|
||||
range 0 1000000
|
||||
default 6
|
||||
default 0
|
||||
help
|
||||
This value defines how often the local sequence number gets updated in
|
||||
persistent storage (i.e. flash). e.g. a value of 100 means that the
|
||||
|
@ -1992,7 +2045,7 @@ if BLE_MESH
|
|||
config BLE_MESH_RPL_STORE_TIMEOUT
|
||||
int "Minimum frequency that the RPL gets updated in storage"
|
||||
range 0 1000000
|
||||
default 5
|
||||
default 0
|
||||
help
|
||||
This value defines in seconds how soon the RPL (Replay Protection List)
|
||||
gets written to persistent storage after a change occurs. If the node
|
||||
|
|
|
@ -213,7 +213,7 @@ esp_err_t esp_bt_gap_remove_bond_device(esp_bd_addr_t bd_addr)
|
|||
int esp_bt_gap_get_bond_device_num(void)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_FAIL;
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
return btc_storage_get_num_bt_bond_devices();
|
||||
}
|
||||
|
@ -221,7 +221,6 @@ int esp_bt_gap_get_bond_device_num(void)
|
|||
esp_err_t esp_bt_gap_get_bond_device_list(int *dev_num, esp_bd_addr_t *dev_list)
|
||||
{
|
||||
int ret;
|
||||
int dev_num_total;
|
||||
|
||||
if (dev_num == NULL || dev_list == NULL) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
|
@ -231,12 +230,7 @@ esp_err_t esp_bt_gap_get_bond_device_list(int *dev_num, esp_bd_addr_t *dev_list)
|
|||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
dev_num_total = btc_storage_get_num_bt_bond_devices();
|
||||
if (*dev_num > dev_num_total) {
|
||||
*dev_num = dev_num_total;
|
||||
}
|
||||
|
||||
ret = btc_storage_get_bonded_bt_devices_list((bt_bdaddr_t *)dev_list, *dev_num);
|
||||
ret = btc_storage_get_bonded_bt_devices_list((bt_bdaddr_t *)dev_list, dev_num);
|
||||
|
||||
return (ret == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
|
|
@ -50,9 +50,33 @@ esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu)
|
|||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern uint16_t L2CA_GetFreePktBufferNum_LE(void);
|
||||
/**
|
||||
* @brief This function is called to get currently sendable packets number on controller,
|
||||
* the function is called only in BLE running core and single connection now.
|
||||
*
|
||||
* @return
|
||||
* sendable packets number on controller
|
||||
*
|
||||
*/
|
||||
|
||||
uint16_t esp_ble_get_sendable_packets_num ()
|
||||
uint16_t esp_ble_get_sendable_packets_num (void)
|
||||
{
|
||||
return L2CA_GetFreePktBufferNum_LE();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function is used to query the number of available buffers for the current connection.
|
||||
* When you need to query the current available buffer number, it is recommended to use this API.
|
||||
* @param[in] conn_id: current connection id.
|
||||
*
|
||||
* @return
|
||||
* Number of available buffers for the current connection
|
||||
*
|
||||
*/
|
||||
extern UINT16 L2CA_GetCurFreePktBufferNum_LE(UINT16 conn_id);
|
||||
uint16_t esp_ble_get_cur_sendable_packets_num (uint16_t connid)
|
||||
{
|
||||
return L2CA_GetCurFreePktBufferNum_LE(connid);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -431,6 +431,9 @@ esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t gattc_if,
|
|||
arg.write_char.value = value;
|
||||
arg.write_char.write_type = write_type;
|
||||
arg.write_char.auth_req = auth_req;
|
||||
if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){
|
||||
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
@ -462,6 +465,10 @@ esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
|
|||
arg.write_descr.write_type = write_type;
|
||||
arg.write_descr.auth_req = auth_req;
|
||||
|
||||
if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){
|
||||
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
|
||||
}
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
|
|
|
@ -274,6 +274,9 @@ esp_err_t esp_ble_gatts_send_indicate(esp_gatt_if_t gatts_if, uint16_t conn_id,
|
|||
arg.send_ind.value_len = value_len;
|
||||
arg.send_ind.value = value;
|
||||
|
||||
if(need_confirm == false){
|
||||
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
|
||||
}
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatts_args_t),
|
||||
btc_gatts_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
|
|
@ -154,6 +154,17 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
|
|||
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_spp_stop_srv(void)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_SPP;
|
||||
msg.act = BTC_SPP_ACT_STOP_SRV;
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ typedef enum {
|
|||
|
||||
/// A2DP media control commands
|
||||
typedef enum {
|
||||
ESP_A2D_MEDIA_CTRL_NONE = 0, /*!< dummy command */
|
||||
ESP_A2D_MEDIA_CTRL_NONE = 0, /*!< Not for application use, use inside stack only. */
|
||||
ESP_A2D_MEDIA_CTRL_CHECK_SRC_RDY, /*!< check whether AVDTP is connected, only used in A2DP source */
|
||||
ESP_A2D_MEDIA_CTRL_START, /*!< command to set up media transmission channel */
|
||||
ESP_A2D_MEDIA_CTRL_STOP, /*!< command to stop media transmission */
|
||||
|
|
|
@ -174,6 +174,7 @@ typedef enum {
|
|||
ESP_BT_GAP_KEY_NOTIF_EVT, /*!< Simple Pairing Passkey Notification */
|
||||
ESP_BT_GAP_KEY_REQ_EVT, /*!< Simple Pairing Passkey request */
|
||||
ESP_BT_GAP_READ_RSSI_DELTA_EVT, /*!< read rssi event */
|
||||
ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< remove bond device complete event */
|
||||
ESP_BT_GAP_EVT_MAX,
|
||||
} esp_bt_gap_cb_event_t;
|
||||
|
||||
|
@ -271,6 +272,14 @@ typedef union {
|
|||
struct key_req_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
} key_req; /*!< passkey request parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT
|
||||
*/
|
||||
struct bt_remove_bond_dev_cmpl_evt_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_status_t status; /*!< Indicate the remove bond device operation success status */
|
||||
}remove_bond_dev_cmpl; /*!< Event parameter of ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT */
|
||||
} esp_bt_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,6 +46,7 @@ extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu);
|
|||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern uint16_t esp_ble_get_sendable_packets_num (void);
|
||||
extern uint16_t esp_ble_get_cur_sendable_packets_num (uint16_t connid);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef enum {
|
|||
*/
|
||||
typedef enum {
|
||||
ESP_SPP_INIT_EVT = 0, /*!< When SPP is inited, the event comes */
|
||||
ESP_SPP_UNINIT_EVT = 1, /*!< When SPP is uninited, the event comes */
|
||||
ESP_SPP_DISCOVERY_COMP_EVT = 8, /*!< When SDP discovery complete, the event comes */
|
||||
ESP_SPP_OPEN_EVT = 26, /*!< When SPP Client connection open, the event comes */
|
||||
ESP_SPP_CLOSE_EVT = 27, /*!< When SPP connection closed, the event comes */
|
||||
|
@ -66,6 +67,7 @@ typedef enum {
|
|||
ESP_SPP_CONG_EVT = 31, /*!< When SPP connection congestion status changed, the event comes, only for ESP_SPP_MODE_CB */
|
||||
ESP_SPP_WRITE_EVT = 33, /*!< When SPP write operation completes, the event comes, only for ESP_SPP_MODE_CB */
|
||||
ESP_SPP_SRV_OPEN_EVT = 34, /*!< When SPP Server connection open, the event comes */
|
||||
ESP_SPP_SRV_STOP_EVT = 35, /*!< When SPP server stopped, the event comes */
|
||||
} esp_spp_cb_event_t;
|
||||
|
||||
|
||||
|
@ -80,6 +82,13 @@ typedef union {
|
|||
esp_spp_status_t status; /*!< status */
|
||||
} init; /*!< SPP callback param of SPP_INIT_EVT */
|
||||
|
||||
/**
|
||||
* @brief SPP_UNINIT_EVT
|
||||
*/
|
||||
struct spp_uninit_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
} uninit; /*!< SPP callback param of SPP_UNINIT_EVT */
|
||||
|
||||
/**
|
||||
* @brief SPP_DISCOVERY_COMP_EVT
|
||||
*/
|
||||
|
@ -128,6 +137,14 @@ typedef union {
|
|||
uint8_t sec_id; /*!< security ID used by this server */
|
||||
bool use_co; /*!< TRUE to use co_rfc_data */
|
||||
} start; /*!< SPP callback param of ESP_SPP_START_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_SRV_STOP_EVT
|
||||
*/
|
||||
struct spp_srv_stop_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
} srv_stop; /*!< SPP callback param of ESP_SPP_SRV_STOP_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_SPP_CL_INIT_EVT
|
||||
*/
|
||||
|
@ -273,6 +290,16 @@ esp_err_t esp_spp_disconnect(uint32_t handle);
|
|||
esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
|
||||
esp_spp_role_t role, uint8_t local_scn, const char *name);
|
||||
|
||||
/**
|
||||
* @brief This function stops a SPP server
|
||||
* When the server is stopped successfully, the callback is called
|
||||
* with ESP_SPP_SRV_STOP_EVT.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_stop_srv(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to write data, only for ESP_SPP_MODE_CB.
|
||||
|
|
|
@ -610,7 +610,7 @@ void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data)
|
|||
}
|
||||
}
|
||||
|
||||
void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data)
|
||||
void bta_dm_read_rssi(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
if (p_data->rssi.read_rssi_cb != NULL) {
|
||||
BTM_ReadRSSI(p_data->rssi.remote_addr, p_data->rssi.transport, p_data->rssi.read_rssi_cb);
|
||||
|
@ -756,11 +756,13 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
|
|||
/* Take the link down first, and mark the device for removal when disconnected */
|
||||
for (int i = 0; i < bta_dm_cb.device_list.count; i++) {
|
||||
if (!bdcmp(bta_dm_cb.device_list.peer_device[i].peer_bdaddr, p_dev->bd_addr)
|
||||
&& bta_dm_cb.device_list.peer_device[i].transport == transport) {
|
||||
#if BLE_INCLUDED == TRUE
|
||||
&& bta_dm_cb.device_list.peer_device[i].transport == transport
|
||||
#endif
|
||||
) {
|
||||
bta_dm_cb.device_list.peer_device[i].conn_state = BTA_DM_UNPAIRING;
|
||||
btm_remove_acl( p_dev->bd_addr, bta_dm_cb.device_list.peer_device[i].transport);
|
||||
APPL_TRACE_DEBUG("%s:transport = %d", __func__,
|
||||
bta_dm_cb.device_list.peer_device[i].transport);
|
||||
btm_remove_acl( p_dev->bd_addr, transport);
|
||||
APPL_TRACE_DEBUG("%s:transport = %d", __func__, transport);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,11 +206,11 @@ void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb)
|
|||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb)
|
||||
void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb)
|
||||
{
|
||||
tBTA_DM_API_READ_RSSI *p_msg;
|
||||
if ((p_msg = (tBTA_DM_API_READ_RSSI *)osi_malloc(sizeof(tBTA_DM_API_READ_RSSI))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_BLE_READ_RSSI_EVT;
|
||||
p_msg->hdr.event = BTA_DM_API_READ_RSSI_EVT;
|
||||
memcpy(p_msg->remote_addr, remote_addr, sizeof(BD_ADDR));
|
||||
p_msg->transport = transport;
|
||||
p_msg->read_rssi_cb = cmpl_cb;
|
||||
|
|
|
@ -159,7 +159,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
|||
bta_dm_remove_device, /* BTA_DM_API_REMOVE_DEVICE_EVT */
|
||||
bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */
|
||||
bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */
|
||||
bta_dm_ble_read_rssi, /* BTA_DM_API_BLE_READ_RSSI_EVT */
|
||||
bta_dm_read_rssi, /* BTA_DM_API_READ_RSSI_EVT */
|
||||
bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */
|
||||
};
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ enum {
|
|||
BTA_DM_API_REMOVE_DEVICE_EVT,
|
||||
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
|
||||
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
|
||||
BTA_DM_API_BLE_READ_RSSI_EVT,
|
||||
BTA_DM_API_READ_RSSI_EVT,
|
||||
BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
|
@ -1226,7 +1226,7 @@ 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_update_white_list(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_read_rssi(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_set_visibility (tBTA_DM_MSG *p_data);
|
||||
|
||||
extern void bta_dm_set_scan_config(tBTA_DM_MSG *p_data);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "bta/bta_sys.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
#include "bta_gattc_int.h"
|
||||
|
||||
#include "stack/l2c_api.h"
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
@ -603,6 +603,10 @@ void BTA_GATTC_WriteCharValue ( UINT16 conn_id,
|
|||
memcpy(p_buf->p_value, p_value, len);
|
||||
}
|
||||
|
||||
if(write_type == BTA_GATTC_TYPE_WRITE_NO_RSP){
|
||||
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTC_NUM, NULL);
|
||||
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTU_NUM, NULL);
|
||||
}
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
return;
|
||||
|
@ -650,6 +654,10 @@ void BTA_GATTC_WriteCharDescr (UINT16 conn_id,
|
|||
memcpy(p_buf->p_value, p_data->p_value, p_data->len);
|
||||
}
|
||||
|
||||
if(write_type == BTA_GATTC_TYPE_WRITE_NO_RSP){
|
||||
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTC_NUM, NULL);
|
||||
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTU_NUM, NULL);
|
||||
}
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "stack/btm_ble_api.h"
|
||||
#include <string.h>
|
||||
#include "osi/allocator.h"
|
||||
#include "stack/l2c_api.h"
|
||||
|
||||
static void bta_gatts_nv_save_cback(BOOLEAN is_saved, tGATTS_HNDL_RANGE *p_hndl_range);
|
||||
static BOOLEAN bta_gatts_nv_srv_chg_cback(tGATTS_SRV_CHG_CMD cmd, tGATTS_SRV_CHG_REQ *p_req,
|
||||
|
@ -672,6 +673,7 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
|||
p_msg->api_indicate.len,
|
||||
p_msg->api_indicate.value);
|
||||
} else {
|
||||
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTU_NUM, NULL);
|
||||
status = GATTS_HandleValueNotification (p_msg->api_indicate.hdr.layer_specific,
|
||||
p_msg->api_indicate.attr_id,
|
||||
p_msg->api_indicate.len,
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "bta/bta_gatt_api.h"
|
||||
#include "bta_gatts_int.h"
|
||||
#include "osi/allocator.h"
|
||||
|
||||
#include "stack/l2c_api.h"
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
@ -426,6 +426,11 @@ void BTA_GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_id, UINT16 dat
|
|||
memcpy(p_buf->value, p_data, data_len);
|
||||
|
||||
}
|
||||
|
||||
if(need_confirm == false){
|
||||
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTC_NUM, NULL);
|
||||
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTU_NUM, NULL);
|
||||
}
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -926,7 +926,7 @@ typedef union {
|
|||
tBTA_DM_PIN_REQ pin_req; /* PIN request. */
|
||||
tBTA_DM_AUTH_CMPL auth_cmpl; /* Authentication complete indication. */
|
||||
tBTA_DM_AUTHORIZE authorize; /* Authorization request. */
|
||||
tBTA_DM_LINK_UP link_up; /* ACL connection down event */
|
||||
tBTA_DM_LINK_UP link_up; /* ACL connection up event */
|
||||
tBTA_DM_LINK_DOWN link_down; /* ACL connection down event */
|
||||
tBTA_DM_BUSY_LEVEL busy_level; /* System busy level */
|
||||
tBTA_DM_SP_CFM_REQ cfm_req; /* user confirm request */
|
||||
|
@ -1457,7 +1457,7 @@ extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA
|
|||
|
||||
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
|
||||
|
||||
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb);
|
||||
extern void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -2296,8 +2296,8 @@ extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_l
|
|||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
||||
BD_ADDR device_info,
|
||||
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
||||
BD_ADDR device_info,
|
||||
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -129,11 +129,13 @@ typedef UINT8 tBTA_JV_CONN_STATE;
|
|||
/* Java I/F callback events */
|
||||
/* events received by tBTA_JV_DM_CBACK */
|
||||
#define BTA_JV_ENABLE_EVT 0 /* JV enabled */
|
||||
#define BTA_JV_DISABLE_EVT 1 /* JV disabled */
|
||||
#define BTA_JV_GET_SCN_EVT 6 /* Reserved an SCN */
|
||||
#define BTA_JV_GET_PSM_EVT 7 /* Reserved a PSM */
|
||||
#define BTA_JV_DISCOVERY_COMP_EVT 8 /* SDP discovery complete */
|
||||
#define BTA_JV_CREATE_RECORD_EVT 11 /* the result for BTA_JvCreateRecord */
|
||||
/* events received by tBTA_JV_L2CAP_CBACK */
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
#define BTA_JV_L2CAP_OPEN_EVT 16 /* open status of L2CAP connection */
|
||||
#define BTA_JV_L2CAP_CLOSE_EVT 17 /* L2CAP connection closed */
|
||||
#define BTA_JV_L2CAP_START_EVT 18 /* L2CAP server started */
|
||||
|
@ -144,6 +146,7 @@ typedef UINT8 tBTA_JV_CONN_STATE;
|
|||
#define BTA_JV_L2CAP_RECEIVE_EVT 23 /* the result for BTA_JvL2capReceive*/
|
||||
#define BTA_JV_L2CAP_WRITE_EVT 24 /* the result for BTA_JvL2capWrite*/
|
||||
#define BTA_JV_L2CAP_WRITE_FIXED_EVT 25 /* the result for BTA_JvL2capWriteFixed */
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/* events received by tBTA_JV_RFCOMM_CBACK */
|
||||
#define BTA_JV_RFCOMM_OPEN_EVT 26 /* open status of RFCOMM Client connection */
|
||||
|
@ -155,7 +158,8 @@ typedef UINT8 tBTA_JV_CONN_STATE;
|
|||
#define BTA_JV_RFCOMM_READ_EVT 32 /* the result for BTA_JvRfcommRead */
|
||||
#define BTA_JV_RFCOMM_WRITE_EVT 33 /* the result for BTA_JvRfcommWrite*/
|
||||
#define BTA_JV_RFCOMM_SRV_OPEN_EVT 34 /* open status of Server RFCOMM connection */
|
||||
#define BTA_JV_MAX_EVT 35 /* max number of JV events */
|
||||
#define BTA_JV_FREE_SCN_EVT 35 /* FREE an SCN */
|
||||
#define BTA_JV_MAX_EVT 36 /* max number of JV events */
|
||||
|
||||
typedef UINT16 tBTA_JV_EVT;
|
||||
|
||||
|
@ -178,6 +182,7 @@ typedef struct {
|
|||
UINT32 handle; /* The SDP handle */
|
||||
} tBTA_JV_CREATE_RECORD;
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/* data associated with BTA_JV_L2CAP_OPEN_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
|
@ -186,18 +191,6 @@ typedef struct {
|
|||
INT32 tx_mtu; /* The transmit MTU */
|
||||
} tBTA_JV_L2CAP_OPEN;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BD_ADDR rem_bda; /* The peer address */
|
||||
INT32 tx_mtu; /* The transmit MTU */
|
||||
void **p_p_cback; /* set them for new socket */
|
||||
void **p_user_data;/* set them for new socket */
|
||||
|
||||
} tBTA_JV_L2CAP_LE_OPEN;
|
||||
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_CLOSE_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
|
@ -255,6 +248,22 @@ typedef struct {
|
|||
BOOLEAN cong; /* congestion status */
|
||||
} tBTA_JV_L2CAP_WRITE;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
UINT32 handle; /* The connection handle */
|
||||
BD_ADDR rem_bda; /* The peer address */
|
||||
INT32 tx_mtu; /* The transmit MTU */
|
||||
void **p_p_cback; /* set them for new socket */
|
||||
void **p_user_data;/* set them for new socket */
|
||||
|
||||
} tBTA_JV_L2CAP_LE_OPEN;
|
||||
|
||||
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT if used for LE */
|
||||
typedef struct {
|
||||
UINT32 handle; /* The connection handle */
|
||||
BT_HDR *p_buf; /* The incoming data */
|
||||
} tBTA_JV_LE_DATA_IND;
|
||||
|
||||
/* data associated with BTA_JV_L2CAP_WRITE_FIXED_EVT */
|
||||
typedef struct {
|
||||
|
@ -265,6 +274,7 @@ typedef struct {
|
|||
UINT16 len; /* The length of the data written. */
|
||||
BOOLEAN cong; /* congestion status */
|
||||
} tBTA_JV_L2CAP_WRITE_FIXED;
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_OPEN_EVT */
|
||||
typedef struct {
|
||||
|
@ -272,6 +282,7 @@ typedef struct {
|
|||
UINT32 handle; /* The connection handle */
|
||||
BD_ADDR rem_bda; /* The peer address */
|
||||
} tBTA_JV_RFCOMM_OPEN;
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_SRV_OPEN_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
|
@ -280,7 +291,6 @@ typedef struct {
|
|||
BD_ADDR rem_bda; /* The peer address */
|
||||
} tBTA_JV_RFCOMM_SRV_OPEN;
|
||||
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_CLOSE_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
|
@ -304,19 +314,13 @@ typedef struct {
|
|||
UINT8 sec_id; /* security ID used by this client */
|
||||
BOOLEAN use_co; /* TRUE to use co_rfc_data */
|
||||
} tBTA_JV_RFCOMM_CL_INIT;
|
||||
|
||||
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT & BTA_JV_RFCOMM_DATA_IND_EVT */
|
||||
typedef struct {
|
||||
UINT32 handle; /* The connection handle */
|
||||
BT_HDR *p_buf; /* The incoming data */
|
||||
} tBTA_JV_DATA_IND;
|
||||
|
||||
/*data associated with BTA_JV_L2CAP_DATA_IND_EVT if used for LE */
|
||||
typedef struct {
|
||||
UINT32 handle; /* The connection handle */
|
||||
BT_HDR *p_buf; /* The incoming data */
|
||||
} tBTA_JV_LE_DATA_IND;
|
||||
|
||||
|
||||
/* data associated with BTA_JV_RFCOMM_CONG_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Whether the operation succeeded or failed. */
|
||||
|
@ -356,6 +360,23 @@ typedef struct {
|
|||
tBTA_JV_CONN_STATE state; /* JV connection stata */
|
||||
} tBTA_JV_NOTIFY_PM_STATE_CHANGE;
|
||||
|
||||
/* indicate server at which status */
|
||||
typedef enum {
|
||||
BTA_JV_SERVER_START_FAILED,
|
||||
BTA_JV_SERVER_RUNNING,
|
||||
BTA_JV_SERVER_STATUS_MAX,
|
||||
} tBTA_JV_SERVER_STATUS;
|
||||
|
||||
typedef struct {
|
||||
tBTA_JV_SERVER_STATUS server_status;
|
||||
UINT32 slot_id;
|
||||
}tBTA_JV_FREE_SCN_USER_DATA;
|
||||
|
||||
/* data associated with BTA_JV_FREE_SCN_EVT */
|
||||
typedef struct {
|
||||
tBTA_JV_STATUS status; /* Status of the operation */
|
||||
tBTA_JV_SERVER_STATUS server_status;
|
||||
} tBTA_JV_FREE_SCN;
|
||||
|
||||
/* union of data associated with JV callback */
|
||||
typedef union {
|
||||
|
@ -365,6 +386,7 @@ typedef union {
|
|||
UINT8 scn; /* BTA_JV_GET_SCN_EVT */
|
||||
UINT16 psm; /* BTA_JV_GET_PSM_EVT */
|
||||
tBTA_JV_CREATE_RECORD create_rec; /* BTA_JV_CREATE_RECORD_EVT */
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
tBTA_JV_L2CAP_OPEN l2c_open; /* BTA_JV_L2CAP_OPEN_EVT */
|
||||
tBTA_JV_L2CAP_CLOSE l2c_close; /* BTA_JV_L2CAP_CLOSE_EVT */
|
||||
tBTA_JV_L2CAP_START l2c_start; /* BTA_JV_L2CAP_START_EVT */
|
||||
|
@ -372,6 +394,7 @@ typedef union {
|
|||
tBTA_JV_L2CAP_CONG l2c_cong; /* BTA_JV_L2CAP_CONG_EVT */
|
||||
tBTA_JV_L2CAP_READ l2c_read; /* BTA_JV_L2CAP_READ_EVT */
|
||||
tBTA_JV_L2CAP_WRITE l2c_write; /* BTA_JV_L2CAP_WRITE_EVT */
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
tBTA_JV_RFCOMM_OPEN rfc_open; /* BTA_JV_RFCOMM_OPEN_EVT */
|
||||
tBTA_JV_RFCOMM_SRV_OPEN rfc_srv_open; /* BTA_JV_RFCOMM_SRV_OPEN_EVT */
|
||||
tBTA_JV_RFCOMM_CLOSE rfc_close; /* BTA_JV_RFCOMM_CLOSE_EVT */
|
||||
|
@ -382,9 +405,12 @@ typedef union {
|
|||
tBTA_JV_RFCOMM_WRITE rfc_write; /* BTA_JV_RFCOMM_WRITE_EVT */
|
||||
tBTA_JV_DATA_IND data_ind; /* BTA_JV_L2CAP_DATA_IND_EVT
|
||||
BTA_JV_RFCOMM_DATA_IND_EVT */
|
||||
tBTA_JV_LE_DATA_IND le_data_ind; /* BTA_JV_L2CAP_LE_DATA_IND_EVT */
|
||||
tBTA_JV_FREE_SCN free_scn; /* BTA_JV_FREE_SCN_EVT */
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
tBTA_JV_L2CAP_LE_OPEN l2c_le_open; /* BTA_JV_L2CAP_OPEN_EVT */
|
||||
tBTA_JV_LE_DATA_IND le_data_ind; /* BTA_JV_L2CAP_LE_DATA_IND_EVT */
|
||||
tBTA_JV_L2CAP_WRITE_FIXED l2c_write_fixed; /* BTA_JV_L2CAP_WRITE_FIXED_EVT */
|
||||
#endif
|
||||
} tBTA_JV;
|
||||
|
||||
/* JAVA DM Interface callback */
|
||||
|
@ -393,8 +419,10 @@ typedef void (tBTA_JV_DM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d
|
|||
/* JAVA RFCOMM interface callback */
|
||||
typedef void *(tBTA_JV_RFCOMM_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data);
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/* JAVA L2CAP interface callback */
|
||||
typedef void (tBTA_JV_L2CAP_CBACK)(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_Data);
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/* JV configuration structure */
|
||||
typedef struct {
|
||||
|
@ -424,12 +452,25 @@ extern tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback);
|
|||
**
|
||||
** Function BTA_JvDisable
|
||||
**
|
||||
** Description Disable the Java I/F
|
||||
** Description Disable the Java I/F. When the enable
|
||||
** operation is complete the callback function will be
|
||||
** called with a BTA_JV_DISABLE_EVT.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_JvDisable(void);
|
||||
extern void BTA_JvDisable(tBTA_JV_RFCOMM_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvFree
|
||||
**
|
||||
** Description Free JV configuration
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_JvFree(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -484,12 +525,17 @@ extern tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, void *user_data,
|
|||
**
|
||||
** Description This function frees a SCN/PSM that was used
|
||||
** by an application running over RFCOMM or L2CAP.
|
||||
** Parameters
|
||||
** channel The channel to free
|
||||
** conn_type one of BTA_JV_CONN_TYPE_
|
||||
** p_cback tBTA_JV_RFCOMM_CBACK is called with BTA_JV_FREE_SCN_EVT when server frees a SCN/PSM
|
||||
** user_data indicate the RFCOMM server status
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type);
|
||||
extern tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -532,6 +578,7 @@ extern tBTA_JV_STATUS BTA_JvCreateRecordByUser(const char *name, UINT32 channel,
|
|||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle);
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capConnectLE
|
||||
|
@ -739,6 +786,7 @@ extern tBTA_JV_STATUS BTA_JvL2capWrite(UINT32 handle, UINT32 req_id,
|
|||
extern tBTA_JV_STATUS BTA_JvL2capWriteFixed(UINT16 channel, BD_ADDR *addr, UINT32 req_id,
|
||||
tBTA_JV_L2CAP_CBACK *p_cback,
|
||||
UINT8 *p_data, UINT16 len, void *user_data);
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -769,7 +817,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
|
|||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -786,9 +834,9 @@ extern tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data);
|
|||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask,
|
||||
tBTA_JV_ROLE role, UINT8 local_scn, UINT8 max_session,
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommStartServer(tBTA_SEC sec_mask, tBTA_JV_ROLE role,
|
||||
UINT8 local_scn, UINT8 max_session,
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -815,8 +863,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommStopServer(UINT32 handle, void *user_data);
|
|||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommRead(UINT32 handle, UINT32 req_id,
|
||||
UINT8 *p_data, UINT16 len);
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommRead(UINT32 handle, UINT32 req_id, UINT8 *p_data, UINT16 len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -843,7 +890,6 @@ extern tBTA_JV_STATUS BTA_JvRfcommReady(UINT32 handle, UINT32 *p_data_size);
|
|||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
// extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id);
|
||||
extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, UINT8 *p_data);
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -865,8 +911,7 @@ extern tBTA_JV_STATUS BTA_JvRfcommWrite(UINT32 handle, UINT32 req_id, int len, U
|
|||
** BTA_JV_CONN_CLOSE to remove in case of connection close!
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_JV_STATUS BTA_JvSetPmProfile(UINT32 handle, tBTA_JV_PM_ID app_id,
|
||||
tBTA_JV_CONN_STATE init_st);
|
||||
extern tBTA_JV_STATUS BTA_JvSetPmProfile(UINT32 handle, tBTA_JV_PM_ID app_id, tBTA_JV_CONN_STATE init_st);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
|
||||
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/* one of these exists for each client */
|
||||
struct fc_client {
|
||||
struct fc_client *next_all_list;
|
||||
|
@ -92,11 +93,10 @@ static void __attribute__((unused)) fc_init(void)
|
|||
pthread_once(&fc_init_once, fc_init_work);
|
||||
}
|
||||
|
||||
|
||||
static void fcchan_conn_chng_cbk(UINT16 chan, BD_ADDR bd_addr, BOOLEAN connected,
|
||||
UINT16 reason, tBT_TRANSPORT );
|
||||
static void fcchan_data_cbk(UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf);
|
||||
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
extern void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
|
||||
static inline void logu(const char *title, const uint8_t *p_uuid)
|
||||
|
@ -114,6 +114,10 @@ static void bta_jv_pm_conn_idle(tBTA_JV_PM_CB *p_cb);
|
|||
static void bta_jv_pm_state_change(tBTA_JV_PM_CB *p_cb, const tBTA_JV_CONN_STATE state);
|
||||
tBTA_JV_STATUS bta_jv_set_pm_conn_state(tBTA_JV_PM_CB *p_cb, const tBTA_JV_CONN_STATE
|
||||
new_st);
|
||||
static int find_rfc_pcb(void *user_data, tBTA_JV_RFC_CB **cb, tBTA_JV_PCB **pcb);
|
||||
static void bta_jv_port_mgmt_sr_cback(UINT32 code, UINT16 port_handle);
|
||||
static void bta_jv_port_event_sr_cback(UINT32 code, UINT16 port_handle);
|
||||
static int bta_jv_port_data_co_cback(UINT16 port_handle, UINT8 *buf, UINT16 len, int type);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -288,6 +292,12 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pc
|
|||
BOOLEAN remove_server = FALSE;
|
||||
int close_pending = 0;
|
||||
|
||||
UINT8 used = 0, i, listen = 0;
|
||||
tPORT_STATE port_state;
|
||||
UINT32 event_mask = BTA_JV_RFC_EV_MASK;
|
||||
UINT32 scn_num = (UINT32)p_cb->scn;
|
||||
tBTA_JV evt_data;
|
||||
|
||||
if (!p_cb || !p_pcb) {
|
||||
APPL_TRACE_ERROR("bta_jv_free_sr_rfc_cb, p_cb or p_pcb cannot be null");
|
||||
return BTA_JV_FAILURE;
|
||||
|
@ -363,6 +373,57 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pc
|
|||
}
|
||||
p_pcb->handle = 0;
|
||||
p_cb->curr_sess--;
|
||||
|
||||
if ((p_cb->max_sess > 1) &&
|
||||
(p_cb->scn != 0) &&
|
||||
(p_cb->curr_sess == p_cb->max_sess - 1)) {
|
||||
|
||||
for (i = 0; i < p_cb->max_sess; i++) {
|
||||
if (p_cb->rfc_hdl[i] != 0) {
|
||||
p_pcb = &bta_jv_cb.port_cb[p_cb->rfc_hdl[i] - 1];
|
||||
if (p_pcb->state == BTA_JV_ST_SR_LISTEN) {
|
||||
listen++;
|
||||
}
|
||||
used++;
|
||||
}
|
||||
}
|
||||
APPL_TRACE_DEBUG("%s max_sess=%d used:%d curr_sess:%d, listen:%d si:%d",
|
||||
__func__, p_cb->max_sess, used, p_cb->curr_sess, listen, si);
|
||||
if (used < p_cb->max_sess &&
|
||||
listen == 0 &&
|
||||
0 <= si &&
|
||||
si < BTA_JV_MAX_RFC_SR_SESSION) {
|
||||
/* make sure the server has a listen port */
|
||||
if ((RFCOMM_CreateConnection(p_cb->sec_id, p_cb->scn, TRUE,
|
||||
BTA_JV_DEF_RFC_MTU, (UINT8 *)bd_addr_any, &(p_cb->rfc_hdl[si]), bta_jv_port_mgmt_sr_cback) == PORT_SUCCESS) &&
|
||||
(p_cb->rfc_hdl[si] != 0)) {
|
||||
p_cb->curr_sess++;
|
||||
p_pcb = &bta_jv_cb.port_cb[p_cb->rfc_hdl[si] - 1];
|
||||
p_pcb->state = BTA_JV_ST_SR_LISTEN;
|
||||
p_pcb->port_handle = p_cb->rfc_hdl[si];
|
||||
// p_pcb->user_data = p_pcb_open->user_data;
|
||||
|
||||
PORT_ClearKeepHandleFlag(p_pcb->port_handle);
|
||||
PORT_SetEventCallback(p_pcb->port_handle, bta_jv_port_event_sr_cback);
|
||||
PORT_SetDataCOCallback(p_pcb->port_handle, bta_jv_port_data_co_cback);
|
||||
PORT_SetEventMask(p_pcb->port_handle, event_mask);
|
||||
PORT_GetState(p_pcb->port_handle, &port_state);
|
||||
|
||||
port_state.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT);
|
||||
|
||||
PORT_SetState(p_pcb->port_handle, &port_state);
|
||||
p_pcb->handle = BTA_JV_RFC_H_S_TO_HDL(p_cb->handle, si);
|
||||
APPL_TRACE_DEBUG("%s: p_pcb->handle:0x%x, curr_sess:%d", __func__,
|
||||
p_pcb->handle, p_cb->curr_sess);
|
||||
|
||||
evt_data.rfc_srv_open.handle = 0;
|
||||
evt_data.rfc_srv_open.new_listen_handle = p_pcb->handle;
|
||||
evt_data.rfc_srv_open.status = BTA_JV_SUCCESS;
|
||||
p_pcb->user_data = p_cb->p_cback(BTA_JV_RFCOMM_SRV_OPEN_EVT, &evt_data, (void *)scn_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p_cb->curr_sess == 0) {
|
||||
p_cb->scn = 0;
|
||||
bta_jv_free_sec_id(&p_cb->sec_id);
|
||||
|
@ -377,6 +438,7 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pc
|
|||
return status;
|
||||
}
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_jv_free_l2c_cb
|
||||
|
@ -402,6 +464,7 @@ tBTA_JV_STATUS bta_jv_free_l2c_cb(tBTA_JV_L2C_CB *p_cb)
|
|||
p_cb->p_cback = NULL;
|
||||
return status;
|
||||
}
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -456,10 +519,9 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
|
|||
}
|
||||
}
|
||||
|
||||
APPL_TRACE_API("%s(jv_handle: 0x%2x), idx: %d, "
|
||||
"app_id: 0x%x", __func__, jv_handle, i, bta_jv_cb.pm_cb[i].app_id);
|
||||
APPL_TRACE_API("%s, bd_counter = %d, "
|
||||
"appid_counter = %d", __func__, bd_counter, appid_counter);
|
||||
APPL_TRACE_API("%s(jv_handle: 0x%2x), idx: %d, app_id: 0x%x", __func__, jv_handle, i, bta_jv_cb.pm_cb[i].app_id);
|
||||
APPL_TRACE_API("%s, bd_counter = %d, appid_counter = %d", __func__, bd_counter, appid_counter);
|
||||
|
||||
if (bd_counter > 1) {
|
||||
bta_jv_pm_conn_idle(&bta_jv_cb.pm_cb[i]);
|
||||
}
|
||||
|
@ -478,14 +540,15 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
|
|||
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(bta_jv_cb.rfc_cb[hi].rfc_hdl[si]);
|
||||
if (p_pcb) {
|
||||
if (NULL == p_pcb->p_pm_cb) {
|
||||
APPL_TRACE_WARNING("%s(jv_handle:"
|
||||
" 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to "
|
||||
"pm_cb?", __func__, jv_handle, p_pcb->port_handle, i);
|
||||
APPL_TRACE_WARNING("%s(jv_handle: 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to pm_cb?",
|
||||
__func__, jv_handle, p_pcb->port_handle, i);
|
||||
}
|
||||
p_cb = &p_pcb->p_pm_cb;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
else {
|
||||
if (jv_handle < BTA_JV_MAX_L2C_CONN) {
|
||||
tBTA_JV_L2C_CB *p_l2c_cb = &bta_jv_cb.l2c_cb[jv_handle];
|
||||
if (NULL == p_l2c_cb->p_pm_cb) {
|
||||
|
@ -495,6 +558,8 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
|
|||
p_cb = &p_l2c_cb->p_pm_cb;
|
||||
}
|
||||
}
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
if (p_cb) {
|
||||
*p_cb = NULL;
|
||||
status = BTA_JV_SUCCESS;
|
||||
|
@ -537,7 +602,9 @@ static tBTA_JV_PM_CB *bta_jv_alloc_set_pm_profile_cb(UINT32 jv_handle, tBTA_JV_P
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
else {
|
||||
/* use jv handle for l2cap bd address retrieval */
|
||||
for (j = 0; j < BTA_JV_MAX_L2C_CONN; j++) {
|
||||
if (jv_handle == bta_jv_cb.l2c_cb[j].handle) {
|
||||
|
@ -552,6 +619,7 @@ static tBTA_JV_PM_CB *bta_jv_alloc_set_pm_profile_cb(UINT32 jv_handle, tBTA_JV_P
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
APPL_TRACE_API("bta_jv_alloc_set_pm_profile_cb(handle 0x%2x, app_id %d): "
|
||||
"idx: %d, (BTA_JV_PM_MAX_NUM: %d), pp_cb: %p", jv_handle, app_id,
|
||||
i, BTA_JV_PM_MAX_NUM, (void *)pp_cb);
|
||||
|
@ -634,7 +702,6 @@ BOOLEAN bta_jv_check_psm(UINT16 psm)
|
|||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -673,7 +740,12 @@ void bta_jv_enable(tBTA_JV_MSG *p_data)
|
|||
*******************************************************************************/
|
||||
void bta_jv_disable (tBTA_JV_MSG *p_data)
|
||||
{
|
||||
UNUSED(p_data);
|
||||
tBTA_JV_STATUS evt_data;
|
||||
evt_data = BTA_JV_SUCCESS;
|
||||
// UNUSED(p_data);
|
||||
if (p_data->disable.p_cback) {
|
||||
p_data->disable.p_cback(BTA_JV_DISABLE_EVT, (tBTA_JV *)&evt_data, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -782,7 +854,16 @@ void bta_jv_get_channel_id(tBTA_JV_MSG *p_data)
|
|||
*******************************************************************************/
|
||||
void bta_jv_free_scn(tBTA_JV_MSG *p_data)
|
||||
{
|
||||
UINT16 scn = p_data->free_channel.scn;
|
||||
tBTA_JV_API_FREE_CHANNEL *fc = &(p_data->free_channel);
|
||||
UINT16 scn = fc->scn;
|
||||
tBTA_JV_FREE_SCN evt_data = {
|
||||
.status = BTA_JV_SUCCESS,
|
||||
.server_status = BTA_JV_SERVER_STATUS_MAX,
|
||||
};
|
||||
|
||||
tBTA_JV_FREE_SCN_USER_DATA *user_data = NULL;
|
||||
tBTA_JV_RFC_CB *p_cb = NULL;
|
||||
tBTA_JV_PCB *p_pcb = NULL;
|
||||
|
||||
switch (p_data->free_channel.type) {
|
||||
case BTA_JV_CONN_TYPE_RFCOMM: {
|
||||
|
@ -802,6 +883,19 @@ void bta_jv_free_scn(tBTA_JV_MSG *p_data)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (fc->user_data) {
|
||||
user_data = (tBTA_JV_FREE_SCN_USER_DATA *)fc->user_data;
|
||||
evt_data.server_status = user_data->server_status;
|
||||
if (user_data->server_status == BTA_JV_SERVER_RUNNING && find_rfc_pcb((void *)user_data->slot_id, &p_cb, &p_pcb)) {
|
||||
/* if call bta_jv_rfcomm_stop_server successfully, find_rfc_pcb shall return false */
|
||||
evt_data.status = BTA_JV_FAILURE;
|
||||
}
|
||||
|
||||
if (fc->p_cback) {
|
||||
fc->p_cback(BTA_JV_FREE_SCN_EVT, (tBTA_JV *)&evt_data, (void *)user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
static inline tBT_UUID shorten_sdp_uuid(const tBT_UUID *u)
|
||||
{
|
||||
|
@ -1092,6 +1186,7 @@ void bta_jv_delete_record(tBTA_JV_MSG *p_data)
|
|||
}
|
||||
}
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_jv_l2cap_client_cback
|
||||
|
@ -1517,6 +1612,7 @@ void bta_jv_l2cap_write_fixed(tBTA_JV_MSG *p_data)
|
|||
|
||||
ls->p_cback(BTA_JV_L2CAP_WRITE_FIXED_EVT, (tBTA_JV *)&evt_data, ls->user_data);
|
||||
}
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -1596,6 +1692,7 @@ static void bta_jv_port_mgmt_cl_cback(UINT32 code, UINT16 port_handle)
|
|||
evt_data.rfc_close.async = TRUE;
|
||||
if (p_pcb->state == BTA_JV_ST_CL_CLOSING) {
|
||||
evt_data.rfc_close.async = FALSE;
|
||||
evt_data.rfc_close.status = BTA_JV_SUCCESS;
|
||||
}
|
||||
//p_pcb->state = BTA_JV_ST_NONE;
|
||||
//p_pcb->cong = FALSE;
|
||||
|
@ -1760,9 +1857,10 @@ void bta_jv_rfcomm_close(tBTA_JV_MSG *p_data)
|
|||
tBTA_JV_API_RFCOMM_CLOSE *cc = &(p_data->rfcomm_close);
|
||||
tBTA_JV_RFC_CB *p_cb = NULL;
|
||||
tBTA_JV_PCB *p_pcb = NULL;
|
||||
APPL_TRACE_DEBUG("bta_jv_rfcomm_close, rfc handle:%d", cc->handle);
|
||||
tBTA_JV evt_data;
|
||||
APPL_TRACE_DEBUG("%s, rfc handle:%d",__func__, cc->handle);
|
||||
if (!cc->handle) {
|
||||
APPL_TRACE_ERROR("bta_jv_rfcomm_close, rfc handle is null");
|
||||
APPL_TRACE_ERROR("%s, rfc handle is null", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1770,9 +1868,21 @@ void bta_jv_rfcomm_close(tBTA_JV_MSG *p_data)
|
|||
if (!find_rfc_pcb(user_data, &p_cb, &p_pcb)) {
|
||||
return;
|
||||
}
|
||||
if(cc->p_cback) {
|
||||
evt_data.rfc_close.status = BTA_JV_SUCCESS;
|
||||
evt_data.rfc_close.port_status = PORT_LOCAL_CLOSED;
|
||||
evt_data.rfc_close.handle = cc->handle;
|
||||
evt_data.rfc_close.async = TRUE;
|
||||
if (p_pcb && (p_pcb->state == BTA_JV_ST_SR_LISTEN ||
|
||||
p_pcb->state == BTA_JV_ST_SR_OPEN ||
|
||||
p_pcb->state == BTA_JV_ST_CL_OPEN ||
|
||||
p_pcb->state == BTA_JV_ST_CL_OPENING)) {
|
||||
evt_data.rfc_close.async = FALSE;
|
||||
}
|
||||
cc->p_cback(BTA_JV_RFCOMM_CLOSE_EVT, (tBTA_JV *)&evt_data, user_data);
|
||||
}
|
||||
bta_jv_free_rfc_cb(p_cb, p_pcb);
|
||||
APPL_TRACE_DEBUG("bta_jv_rfcomm_close: sec id in use:%d, rfc_cb in use:%d",
|
||||
get_sec_id_used(), get_rfc_cb_used());
|
||||
APPL_TRACE_DEBUG("%s: sec id in use:%d, rfc_cb in use:%d", __func__, get_sec_id_used(), get_rfc_cb_used());
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1976,6 +2086,8 @@ static tBTA_JV_PCB *bta_jv_add_rfc_port(tBTA_JV_RFC_CB *p_cb, tBTA_JV_PCB *p_pcb
|
|||
p_pcb->handle, p_cb->curr_sess);
|
||||
}
|
||||
} else {
|
||||
/* avoid p_pcb always points to the last element of rfc_hdl */
|
||||
p_pcb = p_pcb_open;
|
||||
APPL_TRACE_ERROR("bta_jv_add_rfc_port, cannot create new rfc listen port");
|
||||
}
|
||||
}
|
||||
|
@ -2351,7 +2463,7 @@ static void bta_jv_pm_state_change(tBTA_JV_PM_CB *p_cb, const tBTA_JV_CONN_STATE
|
|||
}
|
||||
/**********************************************************************************************/
|
||||
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
static struct fc_channel *fcchan_get(uint16_t chan, char create)
|
||||
{
|
||||
struct fc_channel *t = fc_channels;
|
||||
|
@ -2791,6 +2903,6 @@ extern void bta_jv_l2cap_close_fixed (tBTA_JV_MSG *p_data)
|
|||
fcclient_free(t);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
|
||||
|
|
|
@ -69,6 +69,16 @@ tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback)
|
|||
int i;
|
||||
|
||||
APPL_TRACE_API( "BTA_JvEnable");
|
||||
|
||||
#if BTA_DYNAMIC_MEMORY == TRUE
|
||||
/* Malloc buffer for JV configuration structure */
|
||||
p_bta_jv_cfg->p_sdp_raw_data = (UINT8 *)osi_malloc(p_bta_jv_cfg->sdp_raw_size);
|
||||
p_bta_jv_cfg->p_sdp_db = (tSDP_DISCOVERY_DB *)osi_malloc(p_bta_jv_cfg->sdp_db_size);
|
||||
if (p_bta_jv_cfg->p_sdp_raw_data == NULL || p_bta_jv_cfg->p_sdp_db == NULL) {
|
||||
return BTA_JV_NO_DATA;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p_cback && FALSE == bta_sys_is_register(BTA_ID_JV)) {
|
||||
memset(&bta_jv_cb, 0, sizeof(tBTA_JV_CB));
|
||||
/* set handle to invalid value by default */
|
||||
|
@ -100,18 +110,39 @@ tBTA_JV_STATUS BTA_JvEnable(tBTA_JV_DM_CBACK *p_cback)
|
|||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_JvDisable(void)
|
||||
void BTA_JvDisable(tBTA_JV_RFCOMM_CBACK *p_cback)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
tBTA_JV_API_DISABLE *p_buf;
|
||||
|
||||
APPL_TRACE_API( "BTA_JvDisable");
|
||||
bta_sys_deregister(BTA_ID_JV);
|
||||
if ((p_buf = (BT_HDR *) osi_malloc(sizeof(BT_HDR))) != NULL) {
|
||||
p_buf->event = BTA_JV_API_DISABLE_EVT;
|
||||
if ((p_buf = (tBTA_JV_API_DISABLE *) osi_malloc(sizeof(tBTA_JV_API_DISABLE))) != NULL) {
|
||||
p_buf->hdr.event = BTA_JV_API_DISABLE_EVT;
|
||||
p_buf->p_cback = p_cback;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvFree
|
||||
**
|
||||
** Description Free JV configuration
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_JvFree(void)
|
||||
{
|
||||
#if BTA_DYNAMIC_MEMORY == TRUE
|
||||
/* Free buffer for JV configuration structure */
|
||||
osi_free(p_bta_jv_cfg->p_sdp_raw_data);
|
||||
osi_free(p_bta_jv_cfg->p_sdp_db);
|
||||
p_bta_jv_cfg->p_sdp_raw_data = NULL;
|
||||
p_bta_jv_cfg->p_sdp_db = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvIsEnable
|
||||
|
@ -199,12 +230,14 @@ tBTA_JV_STATUS BTA_JvGetChannelId(int conn_type, void *user_data, INT32 channel)
|
|||
** Parameters
|
||||
** channel The channel to free
|
||||
** conn_type one of BTA_JV_CONN_TYPE_
|
||||
** p_cback tBTA_JV_RFCOMM_CBACK is called with when server
|
||||
** user_data indicate the RFCOMM server status
|
||||
**
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type)
|
||||
tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data)
|
||||
{
|
||||
tBTA_JV_STATUS status = BTA_JV_FAILURE;
|
||||
tBTA_JV_API_FREE_CHANNEL *p_msg;
|
||||
|
@ -214,6 +247,8 @@ tBTA_JV_STATUS BTA_JvFreeChannel(UINT16 channel, int conn_type)
|
|||
p_msg->hdr.event = BTA_JV_API_FREE_SCN_EVT;
|
||||
p_msg->scn = channel;
|
||||
p_msg->type = conn_type;
|
||||
p_msg->p_cback = p_cback;
|
||||
p_msg->user_data = user_data;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
status = BTA_JV_SUCCESS;
|
||||
}
|
||||
|
@ -310,6 +345,7 @@ tBTA_JV_STATUS BTA_JvDeleteRecord(UINT32 handle)
|
|||
return (status);
|
||||
}
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_JvL2capConnectLE
|
||||
|
@ -823,6 +859,7 @@ tBTA_JV_STATUS BTA_JvL2capWriteFixed(UINT16 channel, BD_ADDR *addr, UINT32 req_i
|
|||
|
||||
return (status);
|
||||
}
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -868,19 +905,20 @@ tBTA_JV_STATUS BTA_JvRfcommConnect(tBTA_SEC sec_mask,
|
|||
** Function BTA_JvRfcommClose
|
||||
**
|
||||
** Description This function closes an RFCOMM connection
|
||||
**
|
||||
** When the connection is established or failed,
|
||||
** tBTA_JV_RFCOMM_CBACK is called with BTA_JV_RFCOMM_CLOSE_EVT
|
||||
** Returns BTA_JV_SUCCESS, if the request is being processed.
|
||||
** BTA_JV_FAILURE, otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data)
|
||||
tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, tBTA_JV_RFCOMM_CBACK *p_cback, void *user_data)
|
||||
{
|
||||
tBTA_JV_STATUS status = BTA_JV_FAILURE;
|
||||
tBTA_JV_API_RFCOMM_CLOSE *p_msg;
|
||||
UINT32 hi = ((handle & BTA_JV_RFC_HDL_MASK) & ~BTA_JV_RFCOMM_MASK) - 1;
|
||||
UINT32 si = BTA_JV_RFC_HDL_TO_SIDX(handle);
|
||||
|
||||
APPL_TRACE_API( "BTA_JvRfcommClose");
|
||||
APPL_TRACE_API( "%s", __func__);
|
||||
if (hi < BTA_JV_MAX_RFC_CONN && bta_jv_cb.rfc_cb[hi].p_cback &&
|
||||
si < BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si] &&
|
||||
(p_msg = (tBTA_JV_API_RFCOMM_CLOSE *)osi_malloc(sizeof(tBTA_JV_API_RFCOMM_CLOSE))) != NULL) {
|
||||
|
@ -888,6 +926,7 @@ tBTA_JV_STATUS BTA_JvRfcommClose(UINT32 handle, void *user_data)
|
|||
p_msg->handle = handle;
|
||||
p_msg->p_cb = &bta_jv_cb.rfc_cb[hi];
|
||||
p_msg->p_pcb = &bta_jv_cb.port_cb[p_msg->p_cb->rfc_hdl[si] - 1];
|
||||
p_msg->p_cback = p_cback;
|
||||
p_msg->user_data = user_data;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
status = BTA_JV_SUCCESS;
|
||||
|
|
|
@ -52,12 +52,14 @@ const tBTA_JV_ACTION bta_jv_action[] = {
|
|||
bta_jv_start_discovery, /* BTA_JV_API_START_DISCOVERY_EVT */
|
||||
bta_jv_create_record, /* BTA_JV_API_CREATE_RECORD_EVT */
|
||||
bta_jv_delete_record, /* BTA_JV_API_DELETE_RECORD_EVT */
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
bta_jv_l2cap_connect, /* BTA_JV_API_L2CAP_CONNECT_EVT */
|
||||
bta_jv_l2cap_close, /* BTA_JV_API_L2CAP_CLOSE_EVT */
|
||||
bta_jv_l2cap_start_server, /* BTA_JV_API_L2CAP_START_SERVER_EVT */
|
||||
bta_jv_l2cap_stop_server, /* BTA_JV_API_L2CAP_STOP_SERVER_EVT */
|
||||
bta_jv_l2cap_read, /* BTA_JV_API_L2CAP_READ_EVT */
|
||||
bta_jv_l2cap_write, /* BTA_JV_API_L2CAP_WRITE_EVT */
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
bta_jv_rfcomm_connect, /* BTA_JV_API_RFCOMM_CONNECT_EVT */
|
||||
bta_jv_rfcomm_close, /* BTA_JV_API_RFCOMM_CLOSE_EVT */
|
||||
bta_jv_rfcomm_start_server, /* BTA_JV_API_RFCOMM_START_SERVER_EVT */
|
||||
|
@ -66,11 +68,13 @@ const tBTA_JV_ACTION bta_jv_action[] = {
|
|||
bta_jv_rfcomm_write, /* BTA_JV_API_RFCOMM_WRITE_EVT */
|
||||
bta_jv_set_pm_profile, /* BTA_JV_API_SET_PM_PROFILE_EVT */
|
||||
bta_jv_change_pm_state, /* BTA_JV_API_PM_STATE_CHANGE_EVT */
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
bta_jv_l2cap_connect_le, /* BTA_JV_API_L2CAP_CONNECT_LE_EVT */
|
||||
bta_jv_l2cap_start_server_le, /* BTA_JV_API_L2CAP_START_SERVER_LE_EVT */
|
||||
bta_jv_l2cap_stop_server_le, /* BTA_JV_API_L2CAP_STOP_SERVER_LE_EVT */
|
||||
bta_jv_l2cap_write_fixed, /* BTA_JV_API_L2CAP_WRITE_FIXED_EVT */
|
||||
bta_jv_l2cap_close_fixed, /* BTA_JV_API_L2CAP_CLOSE_FIXED_EVT */
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -48,12 +48,14 @@ enum {
|
|||
BTA_JV_API_START_DISCOVERY_EVT,
|
||||
BTA_JV_API_CREATE_RECORD_EVT,
|
||||
BTA_JV_API_DELETE_RECORD_EVT,
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
BTA_JV_API_L2CAP_CONNECT_EVT,
|
||||
BTA_JV_API_L2CAP_CLOSE_EVT,
|
||||
BTA_JV_API_L2CAP_START_SERVER_EVT,
|
||||
BTA_JV_API_L2CAP_STOP_SERVER_EVT,
|
||||
BTA_JV_API_L2CAP_READ_EVT,
|
||||
BTA_JV_API_L2CAP_WRITE_EVT,
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
BTA_JV_API_RFCOMM_CONNECT_EVT,
|
||||
BTA_JV_API_RFCOMM_CLOSE_EVT,
|
||||
BTA_JV_API_RFCOMM_START_SERVER_EVT,
|
||||
|
@ -62,11 +64,13 @@ enum {
|
|||
BTA_JV_API_RFCOMM_WRITE_EVT,
|
||||
BTA_JV_API_SET_PM_PROFILE_EVT,
|
||||
BTA_JV_API_PM_STATE_CHANGE_EVT,
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
BTA_JV_API_L2CAP_CONNECT_LE_EVT,
|
||||
BTA_JV_API_L2CAP_START_SERVER_LE_EVT,
|
||||
BTA_JV_API_L2CAP_STOP_SERVER_LE_EVT,
|
||||
BTA_JV_API_L2CAP_WRITE_FIXED_EVT,
|
||||
BTA_JV_API_L2CAP_CLOSE_FIXED_EVT,
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
BTA_JV_MAX_INT_EVT
|
||||
};
|
||||
|
||||
|
@ -80,6 +84,12 @@ typedef struct {
|
|||
tBTA_JV_DM_CBACK *p_cback;
|
||||
} tBTA_JV_API_ENABLE;
|
||||
|
||||
/* data type for BTA_JV_API_DISABLE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback;
|
||||
} tBTA_JV_API_DISABLE;
|
||||
|
||||
/* data type for BTA_JV_API_START_DISCOVERY_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
|
@ -115,6 +125,8 @@ enum {
|
|||
BTA_JV_ST_SR_CLOSING
|
||||
} ;
|
||||
typedef UINT8 tBTA_JV_STATE;
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
#define BTA_JV_ST_CL_MAX BTA_JV_ST_CL_CLOSING
|
||||
/* JV L2CAP control block */
|
||||
typedef struct {
|
||||
|
@ -127,6 +139,7 @@ typedef struct {
|
|||
tBTA_JV_PM_CB *p_pm_cb; /* ptr to pm control block, NULL: unused */
|
||||
void *user_data; /* user data for callback from higher layers */
|
||||
} tBTA_JV_L2C_CB;
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
#define BTA_JV_RFC_HDL_MASK 0xFF
|
||||
#define BTA_JV_RFCOMM_MASK 0x80
|
||||
|
@ -156,6 +169,7 @@ typedef struct {
|
|||
int curr_sess; /* current sessions count*/
|
||||
} tBTA_JV_RFC_CB;
|
||||
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
/* data type for BTA_JV_API_L2CAP_CONNECT_EVT & BTA_JV_API_L2CAP_CONNECT_LE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
|
@ -233,6 +247,7 @@ typedef struct {
|
|||
UINT16 len;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_L2CAP_WRITE_FIXED;
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
|
||||
/* data type for BTA_JV_API_RFCOMM_CONNECT_EVT */
|
||||
typedef struct {
|
||||
|
@ -300,6 +315,7 @@ typedef struct {
|
|||
UINT32 handle;
|
||||
tBTA_JV_RFC_CB *p_cb;
|
||||
tBTA_JV_PCB *p_pcb;
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_RFCOMM_CLOSE;
|
||||
|
||||
|
@ -326,6 +342,8 @@ typedef struct {
|
|||
BT_HDR hdr;
|
||||
INT32 type; /* One of BTA_JV_CONN_TYPE_ */
|
||||
UINT16 scn;
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_FREE_CHANNEL;
|
||||
|
||||
/* data type for BTA_JV_API_ALLOC_CHANNEL_EVT */
|
||||
|
@ -340,16 +358,20 @@ typedef union {
|
|||
/* GKI event buffer header */
|
||||
BT_HDR hdr;
|
||||
tBTA_JV_API_ENABLE enable;
|
||||
tBTA_JV_API_DISABLE disable;
|
||||
tBTA_JV_API_START_DISCOVERY start_discovery;
|
||||
tBTA_JV_API_ALLOC_CHANNEL alloc_channel;
|
||||
tBTA_JV_API_FREE_CHANNEL free_channel;
|
||||
tBTA_JV_API_CREATE_RECORD create_record;
|
||||
tBTA_JV_API_ADD_ATTRIBUTE add_attr;
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
tBTA_JV_API_L2CAP_CONNECT l2cap_connect;
|
||||
tBTA_JV_API_L2CAP_READ l2cap_read;
|
||||
tBTA_JV_API_L2CAP_WRITE l2cap_write;
|
||||
tBTA_JV_API_L2CAP_CLOSE l2cap_close;
|
||||
tBTA_JV_API_L2CAP_SERVER l2cap_server;
|
||||
tBTA_JV_API_L2CAP_WRITE_FIXED l2cap_write_fixed;
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
tBTA_JV_API_RFCOMM_CONNECT rfcomm_connect;
|
||||
tBTA_JV_API_RFCOMM_READ rfcomm_read;
|
||||
tBTA_JV_API_RFCOMM_WRITE rfcomm_write;
|
||||
|
@ -357,7 +379,6 @@ typedef union {
|
|||
tBTA_JV_API_PM_STATE_CHANGE change_pm_state;
|
||||
tBTA_JV_API_RFCOMM_CLOSE rfcomm_close;
|
||||
tBTA_JV_API_RFCOMM_SERVER rfcomm_server;
|
||||
tBTA_JV_API_L2CAP_WRITE_FIXED l2cap_write_fixed;
|
||||
} tBTA_JV_MSG;
|
||||
|
||||
/* JV control block */
|
||||
|
@ -368,7 +389,9 @@ typedef struct {
|
|||
UINT32 sdp_handle[BTA_JV_MAX_SDP_REC]; /* SDP records created */
|
||||
UINT8 *p_sel_raw_data;/* the raw data of last service select */
|
||||
tBTA_JV_DM_CBACK *p_dm_cback;
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
tBTA_JV_L2C_CB l2c_cb[BTA_JV_MAX_L2C_CONN]; /* index is GAP handle (index) */
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
tBTA_JV_RFC_CB rfc_cb[BTA_JV_MAX_RFC_CONN];
|
||||
tBTA_JV_PCB port_cb[MAX_RFC_PORTS]; /* index of this array is
|
||||
the port_handle, */
|
||||
|
@ -407,12 +430,14 @@ extern void bta_jv_free_scn (tBTA_JV_MSG *p_data);
|
|||
extern void bta_jv_start_discovery (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_create_record (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_delete_record (tBTA_JV_MSG *p_data);
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
extern void bta_jv_l2cap_connect (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_close (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_start_server (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_stop_server (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_read (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_write (tBTA_JV_MSG *p_data);
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
extern void bta_jv_rfcomm_connect (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_close (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_start_server (tBTA_JV_MSG *p_data);
|
||||
|
@ -421,11 +446,12 @@ extern void bta_jv_rfcomm_read (tBTA_JV_MSG *p_data);
|
|||
extern void bta_jv_rfcomm_write (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_set_pm_profile (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_change_pm_state(tBTA_JV_MSG *p_data);
|
||||
#if BTA_JV_L2CAP_INCLUDED
|
||||
extern void bta_jv_l2cap_connect_le (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_start_server_le (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_stop_server_le (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_write_fixed (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_close_fixed (tBTA_JV_MSG *p_data);
|
||||
|
||||
#endif /* BTA_JV_L2CAP_INCLUDED */
|
||||
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
|
||||
#endif /* BTA_JV_INT_H */
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "common/bt_target.h"
|
||||
#include "btc/btc_storage.h"
|
||||
#include "btc/btc_ble_storage.h"
|
||||
#include "esp_gap_ble_api.h"
|
||||
#include "btc_gap_ble.h"
|
||||
#include "btm_int.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
|
@ -304,11 +304,11 @@ static void btc_dm_link_up_evt(tBTA_DM_LINK_UP *p_link_up)
|
|||
BD_ADDR bd_addr;
|
||||
bt_bdaddr_t bt_bdaddr;
|
||||
|
||||
memcpy(bd_addr, p_link_up->bd_addr, sizeof(BD_ADDR));
|
||||
memcpy(bt_bdaddr.address, p_link_up->bd_addr, sizeof(BD_ADDR));
|
||||
|
||||
if (p_link_up->sc_downgrade == 1) {
|
||||
memcpy(bt_bdaddr.address, p_link_up->bd_addr, sizeof(BD_ADDR));
|
||||
if (btc_storage_remove_bonded_device(&bt_bdaddr) == BT_STATUS_SUCCESS) {
|
||||
memcpy(bd_addr, p_link_up->bd_addr, sizeof(BD_ADDR));
|
||||
if (BTA_DmRemoveDevice(bd_addr, BT_TRANSPORT_BR_EDR) == BTA_SUCCESS) {
|
||||
BTC_TRACE_EVENT(" %s() Bonding information removed.", __FUNCTION__);
|
||||
} else {
|
||||
|
@ -404,11 +404,10 @@ static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
|
|||
memcpy(param.auth_cmpl.bda, p_auth_cmpl->bd_addr, ESP_BD_ADDR_LEN);
|
||||
memcpy(param.auth_cmpl.device_name, p_auth_cmpl->bd_name, ESP_BT_GAP_MAX_BDNAME_LEN + 1);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
sizeof(esp_bt_gap_cb_param_t), NULL);
|
||||
ret = btc_inter_profile_call(&msg, ¶m);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
|
||||
}
|
||||
|
||||
#endif /// BTC_GAP_BT_INCLUDED == TRUE
|
||||
|
@ -427,11 +426,10 @@ static void btc_dm_pin_req_evt(tBTA_DM_PIN_REQ *p_pin_req)
|
|||
param.pin_req.min_16_digit = p_pin_req->min_16_digit;
|
||||
memcpy(param.pin_req.bda, p_pin_req->bd_addr, ESP_BD_ADDR_LEN);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
sizeof(esp_bt_gap_cb_param_t), NULL);
|
||||
ret = btc_inter_profile_call(&msg, ¶m);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
|
||||
}
|
||||
#endif /// BTC_GAP_BT_INCLUDED == TRUE
|
||||
}
|
||||
|
@ -455,11 +453,10 @@ static void btc_dm_sp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_cfm_req)
|
|||
param.cfm_req.num_val = p_cfm_req->num_val;
|
||||
memcpy(param.cfm_req.bda, p_cfm_req->bd_addr, ESP_BD_ADDR_LEN);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
sizeof(esp_bt_gap_cb_param_t), NULL);
|
||||
ret = btc_inter_profile_call(&msg, ¶m);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
|
||||
}
|
||||
#endif /// BTC_GAP_BT_INCLUDED == TRUE
|
||||
}
|
||||
|
@ -476,11 +473,10 @@ static void btc_dm_sp_key_notif_evt(tBTA_DM_SP_KEY_NOTIF *p_key_notif)
|
|||
param.key_notif.passkey = p_key_notif->passkey;
|
||||
memcpy(param.key_notif.bda, p_key_notif->bd_addr, ESP_BD_ADDR_LEN);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
sizeof(esp_bt_gap_cb_param_t), NULL);
|
||||
ret = btc_inter_profile_call(&msg, ¶m);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
|
||||
}
|
||||
#endif /// BTC_GAP_BT_INCLUDED == TRUE
|
||||
}
|
||||
|
@ -496,16 +492,43 @@ static void btc_dm_sp_key_req_evt(tBTA_DM_SP_KEY_REQ *p_key_req)
|
|||
msg.act = BTC_GAP_BT_KEY_REQ_EVT;
|
||||
memcpy(param.key_req.bda, p_key_req->bd_addr, ESP_BD_ADDR_LEN);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
sizeof(esp_bt_gap_cb_param_t), NULL);
|
||||
ret = btc_inter_profile_call(&msg, ¶m);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
|
||||
}
|
||||
#endif /// BTC_GAP_BT_INCLUDED == TRUE
|
||||
}
|
||||
#endif /// BT_SSP_INCLUDED == TRUE
|
||||
|
||||
static void btc_dm_dev_unpaired_evt(tBTA_DM_LINK_DOWN *p_link_down)
|
||||
{
|
||||
esp_bt_gap_cb_param_t param;
|
||||
BTC_TRACE_DEBUG("%s",__func__);
|
||||
memcpy(param.remove_bond_dev_cmpl.bda, p_link_down->bd_addr, ESP_BD_ADDR_LEN);
|
||||
btm_set_bond_type_dev(p_link_down->bd_addr, BOND_TYPE_UNKNOWN);
|
||||
if (p_link_down->status == HCI_SUCCESS) {
|
||||
//remove the bonded key in the config and nvs flash.
|
||||
param.remove_bond_dev_cmpl.status = btc_storage_remove_bonded_device((bt_bdaddr_t *)param.remove_bond_dev_cmpl.bda);
|
||||
} else {
|
||||
param.remove_bond_dev_cmpl.status = ESP_BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BT;
|
||||
msg.act = BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT;
|
||||
|
||||
ret = btc_inter_profile_call(&msg, ¶m);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
|
||||
}
|
||||
#endif /// BTC_GAP_BT_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
tBTA_SERVICE_MASK btc_get_enabled_services_mask(void)
|
||||
{
|
||||
return btc_enabled_services;
|
||||
|
@ -643,16 +666,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
|||
#endif ///BT_SSP_INCLUDED == TRUE
|
||||
|
||||
case BTA_DM_DEV_UNPAIRED_EVT: {
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
bt_bdaddr_t bd_addr;
|
||||
BTC_TRACE_DEBUG("BTA_DM_DEV_UNPAIRED_EVT");
|
||||
memcpy(bd_addr.address, p_data->link_down.bd_addr, sizeof(BD_ADDR));
|
||||
btm_set_bond_type_dev(p_data->link_down.bd_addr, BOND_TYPE_UNKNOWN);
|
||||
if (p_data->link_down.status == HCI_SUCCESS) {
|
||||
//remove the bonded key in the config and nvs flash.
|
||||
btc_storage_remove_bonded_device(&bd_addr);
|
||||
}
|
||||
#endif /* #if (SMP_INCLUDED == TRUE) */
|
||||
btc_dm_dev_unpaired_evt(&p_data->link_down);
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_DEV_UNPAIRED_EVT: {
|
||||
|
@ -685,13 +699,14 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
|||
break;
|
||||
}
|
||||
#endif /* BTC_GAP_BT_INCLUDED == TRUE */
|
||||
case BTA_DM_LINK_UP_EVT:
|
||||
btc_dm_link_up_evt(&p_data->link_up);
|
||||
case BTA_DM_LINK_DOWN_EVT:
|
||||
case BTA_DM_HW_ERROR_EVT:
|
||||
BTC_TRACE_DEBUG( "btc_dm_sec_cback : unhandled event (%d)\n", msg->act );
|
||||
break;
|
||||
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
|
||||
case BTA_DM_LINK_UP_EVT:
|
||||
btc_dm_link_up_evt(&p_data->link_up);
|
||||
break;
|
||||
#if ((BLE_INCLUDED == TRUE) && (SMP_INCLUDED == TRUE))
|
||||
case BTA_DM_BLE_AUTH_CMPL_EVT: {
|
||||
rsp_app = true;
|
||||
ble_msg.act = ESP_GAP_BLE_AUTH_CMPL_EVT;
|
||||
|
@ -854,11 +869,10 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
|||
}
|
||||
|
||||
if (rsp_app) {
|
||||
ret = btc_transfer_context(&ble_msg, ¶m,
|
||||
sizeof(esp_ble_gap_cb_param_t), NULL);
|
||||
ret = btc_inter_profile_call(&ble_msg, ¶m);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
BTC_TRACE_ERROR("%s btc_inter_profile_call failed\n", __func__);
|
||||
}
|
||||
}
|
||||
btc_dm_sec_arg_deep_free(msg);
|
||||
|
|
|
@ -201,7 +201,6 @@ int btc_storage_get_num_bt_bond_devices(void)
|
|||
}
|
||||
}
|
||||
btc_config_unlock();
|
||||
|
||||
return num_dev;
|
||||
}
|
||||
|
||||
|
@ -215,15 +214,17 @@ int btc_storage_get_num_bt_bond_devices(void)
|
|||
** BT_STATUS_FAIL otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int dev_num)
|
||||
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int *dev_num)
|
||||
{
|
||||
bt_bdaddr_t bd_addr;
|
||||
int in_dev_num = *dev_num; /* buffer size */
|
||||
int out_dev_num = 0; /* bond_dev size */
|
||||
|
||||
btc_config_lock();
|
||||
for (const btc_config_section_iter_t *iter = btc_config_section_begin(); iter != btc_config_section_end();
|
||||
iter = btc_config_section_next(iter)) {
|
||||
|
||||
if (dev_num-- <= 0) {
|
||||
if (in_dev_num <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -236,9 +237,12 @@ bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int de
|
|||
btc_config_exist(name, BTC_STORAGE_LINK_KEY_STR)) {
|
||||
string_to_bdaddr(name, &bd_addr);
|
||||
memcpy(bond_dev, &bd_addr, sizeof(bt_bdaddr_t));
|
||||
in_dev_num--;
|
||||
out_dev_num++;
|
||||
bond_dev++;
|
||||
}
|
||||
}
|
||||
*dev_num = out_dev_num; /* out_dev_num <= in_dev_num */
|
||||
btc_config_unlock();
|
||||
|
||||
return BT_STATUS_SUCCESS;
|
||||
|
|
|
@ -89,6 +89,6 @@ int btc_storage_get_num_bt_bond_devices(void);
|
|||
** BT_STATUS_FAIL otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int dev_num);
|
||||
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int *dev_num);
|
||||
|
||||
#endif /* BTC_STORAGE_H */
|
||||
|
|
|
@ -127,12 +127,16 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
|
|||
switch (ctrl) {
|
||||
case ESP_A2D_MEDIA_CTRL_CHECK_SRC_RDY:
|
||||
#if BTC_AV_SRC_INCLUDED
|
||||
if (btc_a2dp_source_is_task_shutting_down()) {
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
|
||||
} else if ((btc_av_stream_ready() == TRUE) ||
|
||||
(btc_av_stream_started_ready() == TRUE)) {
|
||||
/* check whether av is ready to setup a2dp datapath */
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
|
||||
if (btc_av_get_service_id() == BTA_A2DP_SOURCE_SERVICE_ID) {
|
||||
if (btc_a2dp_source_is_task_shutting_down()) {
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
|
||||
} else if ((btc_av_stream_ready() == TRUE) ||
|
||||
(btc_av_stream_started_ready() == TRUE)) {
|
||||
/* check whether av is ready to setup a2dp datapath */
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
|
||||
} else {
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
|
||||
}
|
||||
} else {
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
|
||||
}
|
||||
|
@ -159,6 +163,10 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
|
|||
}
|
||||
break;
|
||||
case ESP_A2D_MEDIA_CTRL_STOP:
|
||||
if (btc_av_is_connected() == FALSE) {
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
|
||||
break;
|
||||
}
|
||||
#if BTC_AV_SRC_INCLUDED
|
||||
if (btc_av_get_peer_sep() == AVDT_TSEP_SNK && !btc_a2dp_source_is_streaming() &&
|
||||
btc_av_get_service_id() == BTA_A2DP_SOURCE_SERVICE_ID) {
|
||||
|
@ -174,7 +182,6 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
|
|||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ESP_A2D_MEDIA_CTRL_SUSPEND:
|
||||
/* local suspend */
|
||||
if (btc_av_stream_started_ready()) {
|
||||
|
@ -184,14 +191,15 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
|
|||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
} else if (btc_av_is_connected() == TRUE) {
|
||||
/* we are not in started state; just ack back ok. This can happen if we are
|
||||
remotely suspended; clear REMOTE SUSPEND Flag */
|
||||
btc_av_clear_remote_suspend_flag();
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
|
||||
} else {
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
APPL_TRACE_ERROR("### A2DP-MEDIA EVENT %u NOT HANDLED ###", ctrl);
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_FAILURE);
|
||||
|
|
|
@ -1120,7 +1120,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
|||
BTA_DmUpdateWhiteList(arg->update_white_list.add_remove, arg->update_white_list.remote_bda, btc_add_whitelist_complete_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_ACT_READ_RSSI:
|
||||
BTA_DmBleReadRSSI(arg->read_rssi.remote_addr, BTA_TRANSPORT_LE, btc_read_ble_rssi_cmpl_callback);
|
||||
BTA_DmReadRSSI(arg->read_rssi.remote_addr, BTA_TRANSPORT_LE, btc_read_ble_rssi_cmpl_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_ACT_SET_CONN_PARAMS:
|
||||
BTA_DmSetBlePrefConnParams(arg->set_conn_params.bd_addr, arg->set_conn_params.min_conn_int,
|
||||
|
|
|
@ -633,7 +633,7 @@ static void btc_gap_bt_read_rssi_delta_cmpl_callback(void *p_data)
|
|||
|
||||
static void btc_gap_bt_read_rssi_delta(btc_gap_bt_args_t *arg)
|
||||
{
|
||||
BTA_DmBleReadRSSI(arg->read_rssi_delta.bda.address, BTA_TRANSPORT_BR_EDR, btc_gap_bt_read_rssi_delta_cmpl_callback);
|
||||
BTA_DmReadRSSI(arg->read_rssi_delta.bda.address, BTA_TRANSPORT_BR_EDR, btc_gap_bt_read_rssi_delta_cmpl_callback);
|
||||
}
|
||||
|
||||
static esp_err_t btc_gap_bt_remove_bond_device(btc_gap_bt_args_t *arg)
|
||||
|
@ -852,6 +852,7 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg)
|
|||
case BTC_GAP_BT_READ_RSSI_DELTA_EVT:
|
||||
case BTC_GAP_BT_AUTH_CMPL_EVT:
|
||||
case BTC_GAP_BT_PIN_REQ_EVT:
|
||||
case BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT:
|
||||
#if (BT_SSP_INCLUDED == TRUE)
|
||||
case BTC_GAP_BT_CFM_REQ_EVT:
|
||||
case BTC_GAP_BT_KEY_NOTIF_EVT:
|
||||
|
@ -905,6 +906,10 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
|
|||
break;
|
||||
}
|
||||
#endif ///BT_SSP_INCLUDED == TRUE
|
||||
case BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT:{
|
||||
btc_gap_bt_cb_to_app(ESP_BT_GAP_REMOVE_BOND_DEV_COMPLETE_EVT,(esp_bt_gap_cb_param_t *)msg->arg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
|
||||
break;
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef enum {
|
|||
BTC_GAP_BT_KEY_NOTIF_EVT,
|
||||
BTC_GAP_BT_KEY_REQ_EVT,
|
||||
BTC_GAP_BT_READ_RSSI_DELTA_EVT,
|
||||
BTC_GAP_BT_REMOVE_BOND_DEV_COMPLETE_EVT,
|
||||
}btc_gap_bt_evt_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -35,6 +35,7 @@ typedef enum {
|
|||
BTC_SPP_ACT_CONNECT,
|
||||
BTC_SPP_ACT_DISCONNECT,
|
||||
BTC_SPP_ACT_START_SRV,
|
||||
BTC_SPP_ACT_STOP_SRV,
|
||||
BTC_SPP_ACT_WRITE,
|
||||
} btc_spp_act_t;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <sys/fcntl.h>
|
||||
#include "esp_vfs.h"
|
||||
#include "esp_vfs_dev.h"
|
||||
#include "stack/port_api.h"
|
||||
|
||||
#if (defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE)
|
||||
|
||||
|
@ -55,13 +56,20 @@ typedef struct {
|
|||
char service_name[ESP_SPP_SERVER_NAME_MAX + 1];
|
||||
} spp_slot_t;
|
||||
|
||||
static struct spp_local_param_t {
|
||||
spp_slot_t *spp_slots[BTA_JV_MAX_RFC_SR_SESSION + 1];
|
||||
typedef struct {
|
||||
spp_slot_t *spp_slots[MAX_RFC_PORTS + 1];
|
||||
uint32_t spp_slot_id;
|
||||
esp_spp_mode_t spp_mode;
|
||||
osi_mutex_t spp_slot_mutex;
|
||||
esp_vfs_id_t spp_vfs_id;
|
||||
} spp_local_param;
|
||||
} spp_local_param_t;
|
||||
|
||||
#if SPP_DYNAMIC_MEMORY == FALSE
|
||||
static spp_local_param_t spp_local_param;
|
||||
#else
|
||||
static spp_local_param_t *spp_local_param_ptr;
|
||||
#define spp_local_param (*spp_local_param_ptr)
|
||||
#endif
|
||||
|
||||
static void spp_osi_free(void *p)
|
||||
{
|
||||
|
@ -73,7 +81,7 @@ static spp_slot_t *spp_malloc_slot(void)
|
|||
if (++spp_local_param.spp_slot_id == 0) {
|
||||
spp_local_param.spp_slot_id = 1;
|
||||
}
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] == NULL) {
|
||||
spp_local_param.spp_slots[i] = (spp_slot_t *)osi_malloc(sizeof(spp_slot_t));
|
||||
if (!spp_local_param.spp_slots[i]) {
|
||||
|
@ -81,6 +89,9 @@ static spp_slot_t *spp_malloc_slot(void)
|
|||
}
|
||||
spp_local_param.spp_slots[i]->id = spp_local_param.spp_slot_id;
|
||||
spp_local_param.spp_slots[i]->serial = i;
|
||||
spp_local_param.spp_slots[i]->sdp_handle = 0;
|
||||
spp_local_param.spp_slots[i]->rfc_handle = 0;
|
||||
spp_local_param.spp_slots[i]->rfc_port_handle = 0;
|
||||
spp_local_param.spp_slots[i]->connected = FALSE;
|
||||
spp_local_param.spp_slots[i]->write_data = NULL;
|
||||
spp_local_param.spp_slots[i]->list = list_new(spp_osi_free);
|
||||
|
@ -101,7 +112,7 @@ static spp_slot_t *spp_malloc_slot(void)
|
|||
|
||||
static spp_slot_t *spp_find_slot_by_id(uint32_t id)
|
||||
{
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->id == id) {
|
||||
return spp_local_param.spp_slots[i];
|
||||
}
|
||||
|
@ -111,7 +122,7 @@ static spp_slot_t *spp_find_slot_by_id(uint32_t id)
|
|||
|
||||
static spp_slot_t *spp_find_slot_by_handle(uint32_t handle)
|
||||
{
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->rfc_handle == handle) {
|
||||
return spp_local_param.spp_slots[i];
|
||||
}
|
||||
|
@ -121,7 +132,7 @@ static spp_slot_t *spp_find_slot_by_handle(uint32_t handle)
|
|||
|
||||
static spp_slot_t *spp_find_slot_by_fd(int fd)
|
||||
{
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->fd == fd) {
|
||||
return spp_local_param.spp_slots[i];
|
||||
}
|
||||
|
@ -129,6 +140,16 @@ static spp_slot_t *spp_find_slot_by_fd(int fd)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static spp_slot_t *spp_find_slot_by_scn(uint32_t scn)
|
||||
{
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->scn == (uint8_t)scn) {
|
||||
return spp_local_param.spp_slots[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void spp_free_slot(spp_slot_t *slot)
|
||||
{
|
||||
if (!slot) {
|
||||
|
@ -160,15 +181,6 @@ static void btc_create_server_fail_cb(void)
|
|||
btc_spp_cb_to_app(ESP_SPP_START_EVT, ¶m);
|
||||
}
|
||||
|
||||
static void btc_disconnect_cb(uint32_t handle)
|
||||
{
|
||||
esp_spp_cb_param_t param;
|
||||
param.close.status = ESP_SPP_SUCCESS;
|
||||
param.close.handle = handle;
|
||||
param.close.async = FALSE;
|
||||
btc_spp_cb_to_app(ESP_SPP_CLOSE_EVT, ¶m);
|
||||
}
|
||||
|
||||
static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data)
|
||||
{
|
||||
bt_status_t status;
|
||||
|
@ -177,34 +189,53 @@ static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *u
|
|||
|
||||
uint32_t id = (uintptr_t)user_data;
|
||||
spp_slot_t *slot, *slot_new;
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_WARNING("%s SPP have been deinit, incoming events ignore!\n", __func__);
|
||||
return new_user_data;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
switch (event) {
|
||||
case BTA_JV_RFCOMM_SRV_OPEN_EVT:
|
||||
case BTA_JV_RFCOMM_START_EVT:
|
||||
slot = spp_find_slot_by_id(id);
|
||||
if (!slot) {
|
||||
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
|
||||
break;
|
||||
}
|
||||
slot_new = spp_malloc_slot();
|
||||
if (!slot_new) {
|
||||
BTC_TRACE_ERROR("%s unable to malloc RFCOMM slot!", __func__);
|
||||
slot->rfc_handle = p_data->rfc_start.handle;
|
||||
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_start.handle);
|
||||
break;
|
||||
case BTA_JV_RFCOMM_SRV_OPEN_EVT:
|
||||
slot = p_data->rfc_srv_open.handle ? spp_find_slot_by_id(id) : spp_find_slot_by_scn((uint32_t)user_data);
|
||||
if (!slot) {
|
||||
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
|
||||
break;
|
||||
}
|
||||
new_user_data = (void *)(uintptr_t)slot_new->id;
|
||||
slot_new->security = slot->security;
|
||||
slot_new->role = slot->role;
|
||||
slot_new->scn = slot->scn;;
|
||||
slot_new->max_session = slot->max_session;
|
||||
strcpy(slot_new->service_name, slot->service_name);
|
||||
slot_new->sdp_handle = slot->sdp_handle;
|
||||
slot_new->rfc_handle = p_data->rfc_srv_open.new_listen_handle;
|
||||
slot_new->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.new_listen_handle);
|
||||
|
||||
memcpy(slot->addr, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
|
||||
slot->connected = TRUE;
|
||||
slot->rfc_handle = p_data->rfc_srv_open.handle;
|
||||
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.handle);
|
||||
BTA_JvSetPmProfile(p_data->rfc_srv_open.handle, BTA_JV_PM_ALL, BTA_JV_CONN_OPEN);
|
||||
if (p_data->rfc_srv_open.handle) {
|
||||
new_user_data = (void *)(uintptr_t)slot->id;
|
||||
memcpy(slot->addr, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
|
||||
slot->connected = TRUE;
|
||||
slot->rfc_handle = p_data->rfc_srv_open.handle;
|
||||
slot->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.handle);
|
||||
BTA_JvSetPmProfile(p_data->rfc_srv_open.handle, BTA_JV_PM_ALL, BTA_JV_CONN_OPEN);
|
||||
}
|
||||
|
||||
if (p_data->rfc_srv_open.handle != p_data->rfc_srv_open.new_listen_handle) {
|
||||
slot_new = spp_malloc_slot();
|
||||
if (!slot_new) {
|
||||
BTC_TRACE_ERROR("%s unable to malloc RFCOMM slot!", __func__);
|
||||
break;
|
||||
}
|
||||
new_user_data = (void *)(uintptr_t)slot_new->id;
|
||||
slot_new->security = slot->security;
|
||||
slot_new->role = slot->role;
|
||||
slot_new->scn = slot->scn;
|
||||
slot_new->max_session = slot->max_session;
|
||||
strcpy(slot_new->service_name, slot->service_name);
|
||||
slot_new->sdp_handle = slot->sdp_handle;
|
||||
slot_new->rfc_handle = p_data->rfc_srv_open.new_listen_handle;
|
||||
slot_new->rfc_port_handle = BTA_JvRfcommGetPortHdl(p_data->rfc_srv_open.new_listen_handle);
|
||||
}
|
||||
break;
|
||||
case BTA_JV_RFCOMM_OPEN_EVT:
|
||||
slot = spp_find_slot_by_id(id);
|
||||
|
@ -223,14 +254,26 @@ static void *btc_spp_rfcomm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *u
|
|||
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
|
||||
break;
|
||||
}
|
||||
if (slot->connected) {
|
||||
BTA_JvRfcommClose(slot->rfc_handle, (void *)slot->id);
|
||||
if (slot->connected && p_data->rfc_close.port_status != PORT_LOCAL_CLOSED) {
|
||||
BTA_JvRfcommClose(slot->rfc_handle, NULL, (void *)slot->id);
|
||||
}
|
||||
spp_free_slot(slot);
|
||||
p_data->rfc_close.status = BTA_JV_SUCCESS;
|
||||
break;
|
||||
case BTA_JV_RFCOMM_DATA_IND_EVT:
|
||||
break;
|
||||
case BTA_JV_FREE_SCN_EVT:
|
||||
if (user_data) {
|
||||
id = ((tBTA_JV_FREE_SCN_USER_DATA *)user_data)->slot_id;
|
||||
slot = spp_find_slot_by_id(id);
|
||||
if (slot) {
|
||||
spp_free_slot(slot);
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
|
||||
}
|
||||
osi_free(user_data);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -292,8 +335,15 @@ static void btc_spp_dm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d
|
|||
} else {
|
||||
BTC_TRACE_ERROR("%s unable to create record, start server fail!", __func__);
|
||||
btc_create_server_fail_cb();
|
||||
BTA_JvFreeChannel(slot->scn, BTA_JV_CONN_TYPE_RFCOMM);
|
||||
spp_free_slot(slot);
|
||||
tBTA_JV_FREE_SCN_USER_DATA *user_data = osi_malloc(sizeof(tBTA_JV_FREE_SCN_USER_DATA));
|
||||
if (user_data) {
|
||||
user_data->server_status = BTA_JV_SERVER_START_FAILED;
|
||||
user_data->slot_id = slot->id;
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s unable to malloc user data!", __func__);
|
||||
}
|
||||
BTA_JvFreeChannel(slot->scn, BTA_JV_CONN_TYPE_RFCOMM,
|
||||
(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)user_data);
|
||||
}
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
break;
|
||||
|
@ -313,6 +363,22 @@ static void btc_spp_dm_inter_cb(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_d
|
|||
|
||||
static void btc_spp_init(btc_spp_args_t *arg)
|
||||
{
|
||||
if (spp_local_param.spp_slot_mutex) {
|
||||
esp_spp_cb_param_t param;
|
||||
param.init.status = ESP_SPP_FAILURE;
|
||||
btc_spp_cb_to_app(ESP_SPP_INIT_EVT, ¶m);
|
||||
BTC_TRACE_ERROR("%s SPP has been initiated, shall uninit first!", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
#if SPP_DYNAMIC_MEMORY == TRUE
|
||||
if ((spp_local_param_ptr = (spp_local_param_t *)osi_malloc(sizeof(spp_local_param_t))) == NULL) {
|
||||
BTC_TRACE_ERROR("%s malloc failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
memset((void *)spp_local_param_ptr, 0, sizeof(spp_local_param_t));
|
||||
#endif
|
||||
|
||||
if (osi_mutex_new(&spp_local_param.spp_slot_mutex) != 0) {
|
||||
BTC_TRACE_ERROR("%s osi_mutex_new failed\n", __func__);
|
||||
return;
|
||||
|
@ -324,40 +390,65 @@ static void btc_spp_init(btc_spp_args_t *arg)
|
|||
|
||||
static void btc_spp_uninit(void)
|
||||
{
|
||||
esp_spp_cb_param_t param;
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
param.uninit.status = ESP_SPP_FAILURE;
|
||||
btc_spp_cb_to_app(ESP_SPP_UNINIT_EVT, ¶m);
|
||||
BTC_TRACE_ERROR("%s SPP has not been initiated, shall init first!", __func__);
|
||||
return;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||
// first, remove all connection
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
|
||||
BTA_JvRfcommClose(spp_local_param.spp_slots[i]->rfc_handle, (void *)spp_local_param.spp_slots[i]->id);
|
||||
spp_free_slot(spp_local_param.spp_slots[i]);
|
||||
spp_local_param.spp_slots[i] = NULL;
|
||||
}
|
||||
}
|
||||
for (size_t i = 1; i <= BTA_JV_MAX_RFC_SR_SESSION; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && !(spp_local_param.spp_slots[i]->connected)) {
|
||||
BTA_JvRfcommStopServer(spp_local_param.spp_slots[i]->sdp_handle, (void *)spp_local_param.spp_slots[i]->id);
|
||||
BTA_JvDeleteRecord(spp_local_param.spp_slots[i]->sdp_handle);
|
||||
BTA_JvFreeChannel(spp_local_param.spp_slots[i]->scn, BTA_JV_CONN_TYPE_RFCOMM);
|
||||
spp_free_slot(spp_local_param.spp_slots[i]);
|
||||
spp_local_param.spp_slots[i] = NULL;
|
||||
BTA_JvRfcommClose(spp_local_param.spp_slots[i]->rfc_handle,(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb,
|
||||
(void *)spp_local_param.spp_slots[i]->id);
|
||||
}
|
||||
}
|
||||
// second, remove all server
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && !spp_local_param.spp_slots[i]->connected) {
|
||||
if (spp_local_param.spp_slots[i]->sdp_handle > 0) {
|
||||
BTA_JvDeleteRecord(spp_local_param.spp_slots[i]->sdp_handle);
|
||||
}
|
||||
|
||||
BTA_JvDisable();
|
||||
if (spp_local_param.spp_slots[i]->rfc_handle > 0) {
|
||||
BTA_JvRfcommStopServer(spp_local_param.spp_slots[i]->rfc_handle,
|
||||
(void *)spp_local_param.spp_slots[i]->id);
|
||||
}
|
||||
|
||||
tBTA_JV_FREE_SCN_USER_DATA *user_data = osi_malloc(sizeof(tBTA_JV_FREE_SCN_USER_DATA));
|
||||
if (user_data) {
|
||||
user_data->server_status = BTA_JV_SERVER_RUNNING;
|
||||
user_data->slot_id = spp_local_param.spp_slots[i]->id;
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s unable to malloc user data!", __func__);
|
||||
param.srv_stop.status = ESP_SPP_NO_RESOURCE;
|
||||
btc_spp_cb_to_app(ESP_SPP_SRV_STOP_EVT, ¶m);
|
||||
}
|
||||
BTA_JvFreeChannel(spp_local_param.spp_slots[i]->scn, BTA_JV_CONN_TYPE_RFCOMM,
|
||||
(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)user_data);
|
||||
}
|
||||
}
|
||||
BTA_JvDisable((tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb);
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
osi_mutex_free(&spp_local_param.spp_slot_mutex);
|
||||
}
|
||||
|
||||
static void btc_spp_start_discovery(btc_spp_args_t *arg)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return;
|
||||
}
|
||||
BTA_JvStartDiscovery(arg->start_discovery.bd_addr, arg->start_discovery.num_uuid, arg->start_discovery.p_uuid_list, NULL);
|
||||
}
|
||||
|
||||
static void btc_spp_connect(btc_spp_args_t *arg)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_malloc_slot();
|
||||
if (!slot) {
|
||||
|
@ -376,6 +467,10 @@ static void btc_spp_connect(btc_spp_args_t *arg)
|
|||
|
||||
static void btc_spp_disconnect(btc_spp_args_t *arg)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_find_slot_by_handle(arg->disconnect.handle);
|
||||
if (!slot) {
|
||||
|
@ -383,14 +478,16 @@ static void btc_spp_disconnect(btc_spp_args_t *arg)
|
|||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
return;
|
||||
}
|
||||
BTA_JvRfcommClose(arg->disconnect.handle, (void *)slot->id);
|
||||
btc_disconnect_cb(slot->rfc_handle);
|
||||
spp_free_slot(slot);
|
||||
BTA_JvRfcommClose(arg->disconnect.handle, (tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)slot->id);
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
}
|
||||
|
||||
static void btc_spp_start_srv(btc_spp_args_t *arg)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_malloc_slot();
|
||||
if (!slot) {
|
||||
|
@ -408,8 +505,54 @@ static void btc_spp_start_srv(btc_spp_args_t *arg)
|
|||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
}
|
||||
|
||||
static void btc_spp_stop_srv(void) {
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return;
|
||||
}
|
||||
esp_spp_cb_param_t param;
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
// first, remove all connection
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && spp_local_param.spp_slots[i]->connected) {
|
||||
BTA_JvRfcommClose(spp_local_param.spp_slots[i]->rfc_handle,(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb,
|
||||
(void *)spp_local_param.spp_slots[i]->id);
|
||||
}
|
||||
}
|
||||
// second, remove all server
|
||||
for (size_t i = 1; i <= MAX_RFC_PORTS; i++) {
|
||||
if (spp_local_param.spp_slots[i] != NULL && !spp_local_param.spp_slots[i]->connected) {
|
||||
if (spp_local_param.spp_slots[i]->sdp_handle > 0) {
|
||||
BTA_JvDeleteRecord(spp_local_param.spp_slots[i]->sdp_handle);
|
||||
}
|
||||
|
||||
if (spp_local_param.spp_slots[i]->rfc_handle > 0) {
|
||||
BTA_JvRfcommStopServer(spp_local_param.spp_slots[i]->rfc_handle,
|
||||
(void *)spp_local_param.spp_slots[i]->id);
|
||||
}
|
||||
|
||||
tBTA_JV_FREE_SCN_USER_DATA *user_data = osi_malloc(sizeof(tBTA_JV_FREE_SCN_USER_DATA));
|
||||
if (user_data) {
|
||||
user_data->server_status = BTA_JV_SERVER_RUNNING;
|
||||
user_data->slot_id = spp_local_param.spp_slots[i]->id;
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s unable to malloc user data!", __func__);
|
||||
param.srv_stop.status = ESP_SPP_NO_RESOURCE;
|
||||
btc_spp_cb_to_app(ESP_SPP_SRV_STOP_EVT, ¶m);
|
||||
}
|
||||
BTA_JvFreeChannel(spp_local_param.spp_slots[i]->scn, BTA_JV_CONN_TYPE_RFCOMM,
|
||||
(tBTA_JV_RFCOMM_CBACK *)btc_spp_rfcomm_inter_cb, (void *)user_data);
|
||||
}
|
||||
}
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
}
|
||||
|
||||
static void btc_spp_write(btc_spp_args_t *arg)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_find_slot_by_handle(arg->write.handle);
|
||||
if (!slot) {
|
||||
|
@ -423,7 +566,7 @@ static void btc_spp_write(btc_spp_args_t *arg)
|
|||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
return;
|
||||
}
|
||||
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0,990);
|
||||
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0, BTA_JV_DEF_RFC_MTU);
|
||||
if (item_size != 0){
|
||||
slot->write_data = data;
|
||||
BTA_JvRfcommWrite(arg->write.handle, slot->id, item_size, data);
|
||||
|
@ -504,6 +647,9 @@ void btc_spp_call_handler(btc_msg_t *msg)
|
|||
case BTC_SPP_ACT_START_SRV:
|
||||
btc_spp_start_srv(arg);
|
||||
break;
|
||||
case BTC_SPP_ACT_STOP_SRV:
|
||||
btc_spp_stop_srv();
|
||||
break;
|
||||
case BTC_SPP_ACT_WRITE:
|
||||
btc_spp_write(arg);
|
||||
break;
|
||||
|
@ -562,22 +708,24 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
|||
btc_spp_cb_to_app(ESP_SPP_START_EVT, ¶m);
|
||||
break;
|
||||
case BTA_JV_RFCOMM_SRV_OPEN_EVT:
|
||||
if (spp_local_param.spp_mode == ESP_SPP_MODE_VFS) {
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
slot = spp_find_slot_by_handle(p_data->rfc_srv_open.handle);
|
||||
if (!slot) {
|
||||
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
|
||||
if (p_data->rfc_srv_open.handle) {
|
||||
if (spp_local_param.spp_mode == ESP_SPP_MODE_VFS) {
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
slot = spp_find_slot_by_handle(p_data->rfc_srv_open.handle);
|
||||
if (!slot) {
|
||||
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
break;
|
||||
}
|
||||
param.srv_open.fd = slot->fd;
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
break;
|
||||
}
|
||||
param.srv_open.fd = slot->fd;
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
param.srv_open.status = p_data->rfc_srv_open.status;
|
||||
param.srv_open.handle = p_data->rfc_srv_open.handle;
|
||||
param.srv_open.new_listen_handle = p_data->rfc_srv_open.new_listen_handle;
|
||||
memcpy(param.srv_open.rem_bda, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
|
||||
btc_spp_cb_to_app(ESP_SPP_SRV_OPEN_EVT, ¶m);
|
||||
}
|
||||
param.srv_open.status = p_data->rfc_srv_open.status;
|
||||
param.srv_open.handle = p_data->rfc_srv_open.handle;
|
||||
param.srv_open.new_listen_handle = p_data->rfc_srv_open.new_listen_handle;
|
||||
memcpy(param.srv_open.rem_bda, p_data->rfc_srv_open.rem_bda, ESP_BD_ADDR_LEN);
|
||||
btc_spp_cb_to_app(ESP_SPP_SRV_OPEN_EVT, ¶m);
|
||||
break;
|
||||
case BTA_JV_RFCOMM_WRITE_EVT:
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
|
@ -609,7 +757,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
|||
slot->write_data = NULL;
|
||||
}
|
||||
size_t item_size = 0;
|
||||
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0,990);
|
||||
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0, BTA_JV_DEF_RFC_MTU);
|
||||
if (item_size != 0){
|
||||
slot->write_data = data;
|
||||
BTA_JvRfcommWrite(slot->rfc_handle, slot->id, item_size, data);
|
||||
|
@ -645,7 +793,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
|||
slot->write_data = NULL;
|
||||
}
|
||||
size_t item_size = 0;
|
||||
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0,990);
|
||||
uint8_t *data = xRingbufferReceiveUpTo(slot->ringbuf_write, &item_size, 0, BTA_JV_DEF_RFC_MTU);
|
||||
if (item_size != 0){
|
||||
slot->write_data = data;
|
||||
BTA_JvRfcommWrite(slot->rfc_handle, slot->id, item_size, data);
|
||||
|
@ -668,6 +816,22 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
|||
btc_spp_cb_to_app(ESP_SPP_DATA_IND_EVT, ¶m);
|
||||
osi_free (p_data->data_ind.p_buf);
|
||||
break;
|
||||
case BTA_JV_FREE_SCN_EVT:
|
||||
if (p_data->free_scn.server_status == BTA_JV_SERVER_RUNNING) {
|
||||
param.srv_stop.status = p_data->free_scn.status;
|
||||
btc_spp_cb_to_app(ESP_SPP_SRV_STOP_EVT, ¶m);
|
||||
}
|
||||
break;
|
||||
case BTA_JV_DISABLE_EVT:
|
||||
param.uninit.status = ESP_SPP_SUCCESS;
|
||||
BTA_JvFree();
|
||||
osi_mutex_free(&spp_local_param.spp_slot_mutex);
|
||||
#if SPP_DYNAMIC_MEMORY == TRUE
|
||||
osi_free(spp_local_param_ptr);
|
||||
spp_local_param_ptr = NULL;
|
||||
#endif
|
||||
btc_spp_cb_to_app(ESP_SPP_UNINIT_EVT, ¶m);
|
||||
break;
|
||||
default:
|
||||
BTC_TRACE_DEBUG("%s: Unhandled event (%d)!", __FUNCTION__, msg->act);
|
||||
break;
|
||||
|
@ -705,12 +869,16 @@ int bta_co_rfc_data_incoming(void *user_data, BT_HDR *p_buf)
|
|||
msg.act = BTA_JV_RFCOMM_DATA_IND_EVT;
|
||||
|
||||
uint32_t id = (uintptr_t)user_data;
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_find_slot_by_id(id);
|
||||
if (!slot) {
|
||||
BTC_TRACE_ERROR("%s unable to find RFCOMM slot!", __func__);
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
p_data.data_ind.handle = slot->rfc_handle;
|
||||
|
||||
|
@ -751,6 +919,10 @@ int bta_co_rfc_data_outgoing(void *user_data, uint8_t *buf, uint16_t size)
|
|||
|
||||
static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_find_slot_by_fd(fd);
|
||||
if (!slot) {
|
||||
|
@ -770,6 +942,10 @@ static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
|
|||
}
|
||||
static int spp_vfs_close(int fd)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_find_slot_by_fd(fd);
|
||||
if (!slot) {
|
||||
|
@ -798,6 +974,10 @@ static bool incoming_list_2_ringbuf_read(spp_slot_t *slot)
|
|||
|
||||
static ssize_t spp_vfs_read(int fd, void * dst, size_t size)
|
||||
{
|
||||
if (!spp_local_param.spp_slot_mutex) {
|
||||
BTC_TRACE_ERROR("%s SPP have not been init\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||
spp_slot_t *slot = spp_find_slot_by_fd(fd);
|
||||
if (!slot) {
|
||||
|
|
|
@ -96,6 +96,12 @@
|
|||
|
||||
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||
|
||||
/* This is set to enable use of GAP L2CAP connections. */
|
||||
#if (VND_BT_JV_BTA_L2CAP == TRUE)
|
||||
#define BTA_JV_L2CAP_INCLUDED TRUE
|
||||
#define GAP_CONN_INCLUDED TRUE
|
||||
#endif /* VND_BT_JV_BTA_L2CAP */
|
||||
|
||||
#ifndef CLASSIC_BT_INCLUDED
|
||||
#define CLASSIC_BT_INCLUDED FALSE
|
||||
#endif /* CLASSIC_BT_INCLUDED */
|
||||
|
@ -293,6 +299,19 @@
|
|||
#define BTA_SDP_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* This is set to enable use of GAP L2CAP connections. */
|
||||
#ifndef VND_BT_JV_BTA_L2CAP
|
||||
#define VND_BT_JV_BTA_L2CAP FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTA_JV_L2CAP_INCLUDED
|
||||
#define BTA_JV_L2CAP_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
#ifndef GAP_CONN_INCLUDED
|
||||
#define GAP_CONN_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Stack-layer components
|
||||
|
@ -1341,7 +1360,7 @@
|
|||
|
||||
/* The maximum number of ports supported. */
|
||||
#ifndef MAX_RFC_PORTS
|
||||
#define MAX_RFC_PORTS 16 /*max is 30*/
|
||||
#define MAX_RFC_PORTS 8 /*max is 30*/
|
||||
#endif
|
||||
|
||||
/* The maximum simultaneous links to different devices. */
|
||||
|
@ -1710,15 +1729,6 @@ Range: 2 octets
|
|||
#define GAP_INCLUDED TRUE
|
||||
#endif
|
||||
|
||||
/* This is set to enable use of GAP L2CAP connections. */
|
||||
#ifndef GAP_CONN_INCLUDED
|
||||
#if (GAP_INCLUDED == TRUE && CLASSIC_BT_INCLUDED == TRUE)
|
||||
#define GAP_CONN_INCLUDED TRUE
|
||||
#else
|
||||
#define GAP_CONN_INCLUDED FALSE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This is set to enable posting event for data write */
|
||||
#ifndef GAP_CONN_POST_EVT_INCLUDED
|
||||
#define GAP_CONN_POST_EVT_INCLUDED FALSE
|
||||
|
|
|
@ -794,7 +794,7 @@ void btm_acl_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
|
|||
BTM_TRACE_WARNING("btm_acl_encrypt_change -> Issuing delayed HCI_Disconnect!!!\n");
|
||||
btsnd_hcic_disconnect(p_dev_rec->hci_handle, HCI_ERR_PEER_USER);
|
||||
}
|
||||
BTM_TRACE_ERROR("btm_acl_encrypt_change: tBTM_SEC_DEV:0x%x rs_disc_pending=%d\n",
|
||||
BTM_TRACE_WARNING("btm_acl_encrypt_change: tBTM_SEC_DEV:0x%x rs_disc_pending=%d\n",
|
||||
(UINT32)p_dev_rec, p_dev_rec->rs_disc_pending);
|
||||
p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
|
||||
}
|
||||
|
@ -1140,7 +1140,6 @@ void btm_read_remote_ext_features_complete (UINT8 *p)
|
|||
|
||||
if (max_page > HCI_EXT_FEATURES_PAGE_MAX) {
|
||||
BTM_TRACE_ERROR("btm_read_remote_ext_features_complete page=%d unknown", max_page);
|
||||
return;
|
||||
}
|
||||
|
||||
p_acl_cb = &btm_cb.acl_db[acl_idx];
|
||||
|
|
|
@ -2257,7 +2257,7 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle
|
|||
}
|
||||
} else if (!(BTM_SM4_KNOWN & p_dev_rec->sm4)) {
|
||||
/* the remote features are not known yet */
|
||||
BTM_TRACE_DEBUG("%s: (%s) remote features unknown!!sec_flags:0x%02x\n", __FUNCTION__,
|
||||
BTM_TRACE_ERROR("%s: (%s) remote features unknown!!sec_flags:0x%02x\n", __FUNCTION__,
|
||||
(is_originator) ? "initiator" : "acceptor", p_dev_rec->sec_flags);
|
||||
|
||||
p_dev_rec->sm4 |= BTM_SM4_REQ_PEND;
|
||||
|
|
|
@ -219,6 +219,7 @@ void gatt_act_write (tGATT_CLCB *p_clcb, UINT8 sec_act)
|
|||
if (p_attr) {
|
||||
switch (p_clcb->op_subtype) {
|
||||
case GATT_WRITE_NO_RSP:
|
||||
l2ble_update_att_acl_pkt_num(L2CA_DECREASE_BTU_NUM, NULL);
|
||||
p_clcb->s_handle = p_attr->handle;
|
||||
op_code = (sec_act == GATT_SEC_SIGN_DATA) ? GATT_SIGN_CMD_WRITE : GATT_CMD_WRITE;
|
||||
rt = gatt_send_write_msg(p_tcb,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "common/bt_target.h"
|
||||
#include "stack/l2cdefs.h"
|
||||
#include "stack/hcidefs.h"
|
||||
#include "osi/fixed_queue.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
|
@ -1227,6 +1228,21 @@ extern UINT16 L2CA_GetDisconnectReason (BD_ADDR remote_bda, tBT_TRANSPORT transp
|
|||
|
||||
extern BOOLEAN L2CA_CheckIsCongest(UINT16 fixed_cid, UINT16 handle);
|
||||
|
||||
#define L2CA_GET_ATT_NUM 0
|
||||
#define L2CA_ADD_BTC_NUM 1
|
||||
#define L2CA_DECREASE_BTC_NUM 2
|
||||
#define L2CA_ADD_BTU_NUM 3
|
||||
#define L2CA_DECREASE_BTU_NUM 4
|
||||
#define L2CA_BUFF_INI 5
|
||||
#define L2CA_BUFF_DEINIT 6
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
UINT16 * get_num;
|
||||
} tl2c_buff_param_t;
|
||||
|
||||
|
||||
extern void l2ble_update_att_acl_pkt_num(UINT8 type, tl2c_buff_param_t *param);
|
||||
|
||||
#endif /* (BLE_INCLUDED == TRUE) */
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
#define L2CAP_DEFAULT_RETRANS_TOUT 2000 /* 2000 milliseconds */
|
||||
#define L2CAP_DEFAULT_MONITOR_TOUT 12000 /* 12000 milliseconds */
|
||||
#define L2CAP_FCR_ACK_TOUT 200 /* 200 milliseconds */
|
||||
|
||||
#define L2CAP_CACHE_ATT_ACL_NUM 10
|
||||
/* Define the possible L2CAP channel states. The names of
|
||||
** the states may seem a bit strange, but they are taken from
|
||||
** the Bluetooth specification.
|
||||
|
@ -165,6 +165,10 @@ typedef enum {
|
|||
|
||||
#define L2CAP_MAX_FCR_CFG_TRIES 2 /* Config attempts before disconnecting */
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
typedef uint8_t tL2C_BLE_FIXED_CHNLS_MASK;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include "stack/btu.h"
|
||||
#include "stack/btm_api.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "gatt_int.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
|
@ -1877,6 +1879,16 @@ UINT16 L2CA_GetFreePktBufferNum_LE(void)
|
|||
{
|
||||
return l2cb.controller_le_xmit_window;
|
||||
}
|
||||
UINT16 L2CA_GetCurFreePktBufferNum_LE(UINT16 conn_id)
|
||||
{
|
||||
uint16_t num = 0;
|
||||
tl2c_buff_param_t param;
|
||||
param.conn_id = conn_id;
|
||||
param.get_num = #
|
||||
l2ble_update_att_acl_pkt_num(L2CA_GET_ATT_NUM, ¶m);
|
||||
return num;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -2265,3 +2277,111 @@ UINT16 L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush)
|
|||
return (num_left);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function update_acl_pkt_num
|
||||
**
|
||||
** Description Update the number of att acl packets to be sent in xmit_hold_q.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
void l2ble_update_att_acl_pkt_num(UINT8 type, tl2c_buff_param_t *param)
|
||||
{
|
||||
static SemaphoreHandle_t buff_semaphore = NULL ;
|
||||
static INT16 btc_buf;
|
||||
static INT16 btu_buf;
|
||||
|
||||
if(buff_semaphore == NULL && type != L2CA_BUFF_INI){
|
||||
L2CAP_TRACE_ERROR("%s buff_semaphore not init", __func__);
|
||||
return;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case L2CA_ADD_BTC_NUM:{
|
||||
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
|
||||
btc_buf ++;
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
case L2CA_DECREASE_BTC_NUM:{
|
||||
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
|
||||
btc_buf --;
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
case L2CA_ADD_BTU_NUM:{
|
||||
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
|
||||
btu_buf ++;
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
case L2CA_DECREASE_BTU_NUM:{
|
||||
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
|
||||
btu_buf --;
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
case L2CA_GET_ATT_NUM:{
|
||||
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
|
||||
INT16 att_acl_pkt_num = 0;
|
||||
INT16 att_max_num = 0;
|
||||
*(param->get_num) = 0;
|
||||
UINT8 tcb_idx = param->conn_id;
|
||||
tGATT_TCB * p_tcb = gatt_get_tcb_by_idx(tcb_idx);
|
||||
if (p_tcb == NULL){
|
||||
L2CAP_TRACE_ERROR("%s not found p_tcb", __func__);
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
tL2C_LCB * p_lcb = l2cu_find_lcb_by_bd_addr (p_tcb->peer_bda, BT_TRANSPORT_LE);
|
||||
if (p_lcb == NULL){
|
||||
L2CAP_TRACE_ERROR("%s not found p_lcb", __func__);
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
fixed_queue_t * queue = p_lcb->p_fixed_ccbs[L2CAP_ATT_CID - L2CAP_FIRST_FIXED_CHNL]->xmit_hold_q;
|
||||
att_max_num = MIN(p_lcb->link_xmit_quota, L2CAP_CACHE_ATT_ACL_NUM);
|
||||
if (queue == NULL){
|
||||
L2CAP_TRACE_ERROR("%s not found queue", __func__);
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
att_acl_pkt_num = fixed_queue_length(queue);
|
||||
if(att_acl_pkt_num < att_max_num){
|
||||
if(btc_buf + btu_buf < att_max_num - att_acl_pkt_num){
|
||||
*(param->get_num) = att_max_num - att_acl_pkt_num - (btc_buf + btu_buf);
|
||||
}
|
||||
}
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
case L2CA_BUFF_INI:{
|
||||
btc_buf = 0;
|
||||
btu_buf = 0;
|
||||
buff_semaphore = xSemaphoreCreateBinary();
|
||||
if (buff_semaphore == NULL) {
|
||||
L2CAP_TRACE_ERROR("%s NO MEMORY", __func__);
|
||||
break;
|
||||
}
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
case L2CA_BUFF_DEINIT:{
|
||||
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
|
||||
btc_buf = 0;
|
||||
btu_buf = 0;
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
vSemaphoreDelete(buff_semaphore);
|
||||
buff_semaphore = NULL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1127,6 +1127,12 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
|||
while ((l2cb.controller_xmit_window != 0) && (p_lcb->sent_not_acked < p_lcb->link_xmit_quota))
|
||||
#endif
|
||||
{
|
||||
//need check flag: partial_segment_being_sent.
|
||||
if ( (p_lcb->partial_segment_being_sent)
|
||||
|| (p_lcb->link_state != LST_CONNECTED)
|
||||
|| (L2C_LINK_CHECK_POWER_MODE (p_lcb)) ) {
|
||||
break;
|
||||
}
|
||||
//L2CAP_TRACE_DEBUG("l2cu_get_next_buffer_to_send = %p",l2cu_get_next_buffer_to_send(p_lcb));
|
||||
if ((p_buf = l2cu_get_next_buffer_to_send (p_lcb)) == NULL) {
|
||||
break;
|
||||
|
|
|
@ -880,6 +880,10 @@ void l2c_init (void)
|
|||
if (l2cb.rcv_pending_q == NULL) {
|
||||
L2CAP_TRACE_ERROR("%s unable to allocate memory for link layer control block", __func__);
|
||||
}
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
l2ble_update_att_acl_pkt_num(L2CA_BUFF_INI, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void l2c_free(void)
|
||||
|
@ -889,6 +893,9 @@ void l2c_free(void)
|
|||
#if L2C_DYNAMIC_MEMORY
|
||||
FREE_AND_RESET(l2c_cb_ptr);
|
||||
#endif
|
||||
#if BLE_INCLUDED == TRUE
|
||||
l2ble_update_att_acl_pkt_num(L2CA_BUFF_DEINIT, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -3657,7 +3657,7 @@ void l2cu_check_channel_congestion (tL2C_CCB *p_ccb)
|
|||
} else {
|
||||
tL2C_LCB *p_lcb = p_ccb->p_lcb;
|
||||
/* If this channel was not congested but it is congested now, tell the app */
|
||||
if ((q_count > p_ccb->buff_quota) || (p_lcb && (p_ccb->local_cid == L2CAP_ATT_CID) && (p_lcb->link_xmit_quota > 0) && (p_lcb->link_xmit_quota <= p_lcb->sent_not_acked))) {
|
||||
if (q_count > p_ccb->buff_quota || (p_lcb && (p_lcb->link_xmit_data_q) && (list_length(p_lcb->link_xmit_data_q) + q_count) > p_ccb->buff_quota)) {
|
||||
p_ccb->cong_sent = TRUE;
|
||||
if (p_ccb->p_rcb && p_ccb->p_rcb->api.pL2CA_CongestionStatus_Cb) {
|
||||
L2CAP_TRACE_DEBUG ("L2CAP - Calling CongestionStatus_Cb (TRUE),CID:0x%04x,XmitQ:%u,Quota:%u",
|
||||
|
|
|
@ -164,6 +164,15 @@ static bt_status_t btc_task_post(btc_msg_t *msg, task_post_t timeout)
|
|||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* transfer an message to another module in the different task.
|
||||
* @param msg message
|
||||
* @param arg paramter
|
||||
* @param arg_len length of paramter
|
||||
* @param copy_func deep copy function
|
||||
* @return BT_STATUS_SUCCESS: success
|
||||
* others: fail
|
||||
*/
|
||||
bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg_deep_copy_t copy_func)
|
||||
{
|
||||
btc_msg_t lmsg;
|
||||
|
@ -192,6 +201,32 @@ bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg
|
|||
return btc_task_post(&lmsg, TASK_POST_BLOCKING);
|
||||
}
|
||||
|
||||
/**
|
||||
* transfer an message to another module in tha same task.
|
||||
* @param msg message
|
||||
* @param arg paramter
|
||||
* @return BT_STATUS_SUCCESS: success
|
||||
* others: fail
|
||||
*/
|
||||
bt_status_t btc_inter_profile_call(btc_msg_t *msg, void *arg)
|
||||
{
|
||||
if (msg == NULL) {
|
||||
return BT_STATUS_PARM_INVALID;
|
||||
}
|
||||
|
||||
msg->arg = arg;
|
||||
switch (msg->sig) {
|
||||
case BTC_SIG_API_CALL:
|
||||
profile_tab[msg->pid].btc_call(msg);
|
||||
break;
|
||||
case BTC_SIG_API_CB:
|
||||
profile_tab[msg->pid].btc_cb(msg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int btc_init(void)
|
||||
{
|
||||
|
|
|
@ -92,8 +92,26 @@ typedef struct {
|
|||
|
||||
typedef void (* btc_arg_deep_copy_t)(btc_msg_t *msg, void *dst, void *src);
|
||||
|
||||
/**
|
||||
* transfer an message to another module in the different task.
|
||||
* @param msg message
|
||||
* @param arg paramter
|
||||
* @param arg_len length of paramter
|
||||
* @param copy_func deep copy function
|
||||
* @return BT_STATUS_SUCCESS: success
|
||||
* others: fail
|
||||
*/
|
||||
bt_status_t btc_transfer_context(btc_msg_t *msg, void *arg, int arg_len, btc_arg_deep_copy_t copy_func);
|
||||
|
||||
/**
|
||||
* transfer an message to another module in tha same task.
|
||||
* @param msg message
|
||||
* @param arg paramter
|
||||
* @return BT_STATUS_SUCCESS: success
|
||||
* others: fail
|
||||
*/
|
||||
bt_status_t btc_inter_profile_call(btc_msg_t *msg, void *arg);
|
||||
|
||||
int btc_init(void);
|
||||
void btc_deinit(void);
|
||||
bool btc_check_queue_is_congest(void);
|
||||
|
|
|
@ -267,6 +267,7 @@ bool config_remove_key(config_t *config, const char *section, const char *key)
|
|||
assert(config != NULL);
|
||||
assert(section != NULL);
|
||||
assert(key != NULL);
|
||||
bool ret;
|
||||
|
||||
section_t *sec = section_find(config, section);
|
||||
entry_t *entry = entry_find(config, section, key);
|
||||
|
@ -274,7 +275,12 @@ bool config_remove_key(config_t *config, const char *section, const char *key)
|
|||
return false;
|
||||
}
|
||||
|
||||
return list_remove(sec->entries, entry);
|
||||
ret = list_remove(sec->entries, entry);
|
||||
if (list_length(sec->entries) == 0) {
|
||||
OSI_TRACE_DEBUG("%s remove section name:%s",__func__, section);
|
||||
ret &= config_remove_section(config, section);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const config_section_node_t *config_section_begin(const config_t *config)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#ifndef __THREAD_H__
|
||||
#define __THREAD_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "freertos/xtensa_api.h"
|
||||
#include "freertos/FreeRTOSConfig.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
|
|
@ -156,6 +156,7 @@ COMPONENT_SRCDIRS += esp_ble_mesh/mesh_common \
|
|||
esp_ble_mesh/mesh_core \
|
||||
esp_ble_mesh/mesh_core/storage \
|
||||
esp_ble_mesh/btc \
|
||||
esp_ble_mesh/mesh_models/common \
|
||||
esp_ble_mesh/mesh_models/client \
|
||||
esp_ble_mesh/mesh_models/server \
|
||||
esp_ble_mesh/api/core \
|
||||
|
|
|
@ -42,7 +42,7 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp
|
|||
|
||||
// Create a semaphore
|
||||
if ((semaphore = xSemaphoreCreateCounting(1, 0)) == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory for the semaphore", __func__);
|
||||
BT_ERR("Failed to create semaphore");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp
|
|||
|
||||
if (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL) != BT_STATUS_SUCCESS) {
|
||||
vSemaphoreDelete(semaphore);
|
||||
BT_ERR("%s, BLE Mesh initialise failed", __func__);
|
||||
BT_ERR("Failed to start mesh init");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ uint16_t esp_ble_mesh_get_primary_element_address(void)
|
|||
return btc_ble_mesh_get_primary_addr();
|
||||
}
|
||||
|
||||
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model, uint16_t group_addr)
|
||||
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model,
|
||||
uint16_t group_addr)
|
||||
{
|
||||
if (model == NULL) {
|
||||
return NULL;
|
||||
|
@ -54,7 +55,7 @@ uint8_t esp_ble_mesh_get_element_count(void)
|
|||
}
|
||||
|
||||
esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *element,
|
||||
uint16_t company_id, uint16_t model_id)
|
||||
uint16_t company_id, uint16_t model_id)
|
||||
{
|
||||
if (element == NULL) {
|
||||
return NULL;
|
||||
|
@ -62,7 +63,8 @@ esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *
|
|||
return btc_ble_mesh_model_find_vnd(element, company_id, model_id);
|
||||
}
|
||||
|
||||
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element, uint16_t model_id)
|
||||
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element,
|
||||
uint16_t model_id)
|
||||
{
|
||||
if (element == NULL) {
|
||||
return NULL;
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
#define ESP_BLE_MESH_TX_SDU_MAX ((CONFIG_BLE_MESH_ADV_BUF_COUNT - 3) * 12)
|
||||
|
||||
static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
|
||||
esp_ble_mesh_msg_ctx_t *ctx,
|
||||
uint32_t opcode,
|
||||
btc_ble_mesh_model_act_t act,
|
||||
uint16_t length, uint8_t *data,
|
||||
int32_t msg_timeout, bool need_rsp,
|
||||
esp_ble_mesh_dev_role_t device_role)
|
||||
esp_ble_mesh_msg_ctx_t *ctx,
|
||||
uint32_t opcode,
|
||||
btc_ble_mesh_model_act_t act,
|
||||
uint16_t length, uint8_t *data,
|
||||
int32_t msg_timeout, bool need_rsp,
|
||||
esp_ble_mesh_dev_role_t device_role)
|
||||
{
|
||||
btc_ble_mesh_model_args_t arg = {0};
|
||||
uint8_t op_len = 0, mic_len = 0;
|
||||
|
@ -39,12 +39,12 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
|
|||
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
|
||||
|
||||
if (ctx && ctx->addr == ESP_BLE_MESH_ADDR_UNASSIGNED) {
|
||||
BT_ERR("%s, Invalid destination address 0x0000", __func__);
|
||||
BT_ERR("Invalid destination address 0x0000");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (device_role > ROLE_FAST_PROV) {
|
||||
BT_ERR("%s, Invalid device role 0x%02x", __func__, device_role);
|
||||
BT_ERR("Invalid device role 0x%02x", device_role);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
|
|||
|
||||
if (act == BTC_BLE_MESH_ACT_MODEL_PUBLISH) {
|
||||
if (op_len + length > model->pub->msg->size) {
|
||||
BT_ERR("%s, Model publication msg size %d is too small", __func__, model->pub->msg->size);
|
||||
BT_ERR("Too small publication msg size %d", model->pub->msg->size);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ static esp_err_t ble_mesh_model_send_msg(esp_ble_mesh_model_t *model,
|
|||
}
|
||||
|
||||
if (op_len + length + mic_len > MIN(ESP_BLE_MESH_SDU_MAX_LEN, ESP_BLE_MESH_TX_SDU_MAX)) {
|
||||
BT_ERR("%s, Data length %d is too large", __func__, length);
|
||||
BT_ERR("Too large data length %d", length);
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
@ -176,8 +176,9 @@ esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model)
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
|
||||
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
|
||||
uint16_t length, uint8_t *data)
|
||||
esp_ble_mesh_msg_ctx_t *ctx,
|
||||
uint32_t opcode,
|
||||
uint16_t length, uint8_t *data)
|
||||
{
|
||||
if (model == NULL || ctx == NULL ||
|
||||
ctx->net_idx == ESP_BLE_MESH_KEY_UNUSED ||
|
||||
|
@ -190,9 +191,11 @@ esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model,
|
||||
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
|
||||
uint16_t length, uint8_t *data, int32_t msg_timeout,
|
||||
bool need_rsp, esp_ble_mesh_dev_role_t device_role)
|
||||
esp_ble_mesh_msg_ctx_t *ctx,
|
||||
uint32_t opcode,
|
||||
uint16_t length, uint8_t *data,
|
||||
int32_t msg_timeout, bool need_rsp,
|
||||
esp_ble_mesh_dev_role_t device_role)
|
||||
{
|
||||
if (model == NULL || ctx == NULL ||
|
||||
ctx->net_idx == ESP_BLE_MESH_KEY_UNUSED ||
|
||||
|
@ -218,8 +221,8 @@ esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcod
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model,
|
||||
esp_ble_mesh_server_state_type_t type,
|
||||
esp_ble_mesh_server_state_value_t *value)
|
||||
esp_ble_mesh_server_state_type_t type,
|
||||
esp_ble_mesh_server_state_value_t *value)
|
||||
{
|
||||
btc_ble_mesh_model_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -294,7 +297,8 @@ uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name)
|
|||
return bt_mesh_provisioner_get_node_index(name);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr, uint8_t *data, uint16_t length)
|
||||
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr,
|
||||
uint8_t *data, uint16_t length)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -396,7 +400,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr)
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
|
||||
uint16_t net_idx, uint16_t app_idx)
|
||||
uint16_t net_idx, uint16_t app_idx)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -419,7 +423,7 @@ esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16],
|
||||
uint16_t net_idx, uint16_t app_idx)
|
||||
uint16_t net_idx, uint16_t app_idx)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -447,7 +451,7 @@ const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx,
|
||||
uint16_t model_id, uint16_t company_id)
|
||||
uint16_t model_id, uint16_t company_id)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -35,11 +35,29 @@ bool esp_ble_mesh_node_is_provisioned(void)
|
|||
return bt_mesh_is_provisioned();
|
||||
}
|
||||
|
||||
static bool prov_bearers_valid(esp_ble_mesh_prov_bearer_t bearers)
|
||||
{
|
||||
if ((!(bearers & (ESP_BLE_MESH_PROV_ADV | ESP_BLE_MESH_PROV_GATT))) ||
|
||||
(IS_ENABLED(CONFIG_BLE_MESH_PB_ADV) &&
|
||||
!IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
|
||||
!(bearers & ESP_BLE_MESH_PROV_ADV)) ||
|
||||
(!IS_ENABLED(CONFIG_BLE_MESH_PB_ADV) &&
|
||||
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
|
||||
!(bearers & ESP_BLE_MESH_PROV_GATT))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_node_prov_enable(esp_ble_mesh_prov_bearer_t bearers)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
if (prov_bearers_valid(bearers) == false) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
|
@ -56,6 +74,10 @@ esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers)
|
|||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
if (prov_bearers_valid(bearers) == false) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
|
@ -68,7 +90,7 @@ esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers)
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_node_set_oob_pub_key(uint8_t pub_key_x[32], uint8_t pub_key_y[32],
|
||||
uint8_t private_key[32])
|
||||
uint8_t private_key[32])
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -157,7 +179,7 @@ esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name)
|
|||
|
||||
#if (CONFIG_BLE_MESH_PROVISIONER)
|
||||
esp_err_t esp_ble_mesh_provisioner_read_oob_pub_key(uint8_t link_idx, uint8_t pub_key_x[32],
|
||||
uint8_t pub_key_y[32])
|
||||
uint8_t pub_key_y[32])
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -232,6 +254,10 @@ esp_err_t esp_ble_mesh_provisioner_prov_enable(esp_ble_mesh_prov_bearer_t bearer
|
|||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
if (prov_bearers_valid(bearers) == false) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
|
@ -249,6 +275,10 @@ esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t beare
|
|||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
if (prov_bearers_valid(bearers) == false) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
ESP_BLE_HOST_STATUS_CHECK(ESP_BLE_HOST_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
|
@ -262,7 +292,7 @@ esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t beare
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t *add_dev,
|
||||
esp_ble_mesh_dev_add_flag_t flags)
|
||||
esp_ble_mesh_dev_add_flag_t flags)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -288,8 +318,10 @@ esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_provisioner_prov_device_with_addr(const uint8_t uuid[16],
|
||||
esp_ble_mesh_bd_addr_t addr, esp_ble_mesh_addr_type_t addr_type,
|
||||
esp_ble_mesh_prov_bearer_t bearer, uint16_t oob_info, uint16_t unicast_addr)
|
||||
esp_ble_mesh_bd_addr_t addr,
|
||||
esp_ble_mesh_addr_type_t addr_type,
|
||||
esp_ble_mesh_prov_bearer_t bearer,
|
||||
uint16_t oob_info, uint16_t unicast_addr)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -347,7 +379,7 @@ esp_err_t esp_ble_mesh_provisioner_delete_dev(esp_ble_mesh_device_delete_t *del_
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_provisioner_set_dev_uuid_match(const uint8_t *match_val, uint8_t match_len,
|
||||
uint8_t offset, bool prov_after_match)
|
||||
uint8_t offset, bool prov_after_match)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -60,7 +60,8 @@ esp_err_t esp_ble_mesh_proxy_gatt_disable(void)
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr,
|
||||
esp_ble_mesh_addr_type_t addr_type, uint16_t net_idx)
|
||||
esp_ble_mesh_addr_type_t addr_type,
|
||||
uint16_t net_idx)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -100,8 +101,8 @@ esp_err_t esp_ble_mesh_proxy_client_disconnect(uint8_t conn_handle)
|
|||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle,
|
||||
uint16_t net_idx, esp_ble_mesh_proxy_filter_type_t filter_type)
|
||||
esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle, uint16_t net_idx,
|
||||
esp_ble_mesh_proxy_filter_type_t filter_type)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -124,8 +125,8 @@ esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle,
|
|||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle,
|
||||
uint16_t net_idx, uint16_t *addr, uint16_t addr_num)
|
||||
esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle, uint16_t net_idx,
|
||||
uint16_t *addr, uint16_t addr_num)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -149,8 +150,8 @@ esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle,
|
|||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle,
|
||||
uint16_t net_idx, uint16_t *addr, uint16_t addr_num)
|
||||
esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle, uint16_t net_idx,
|
||||
uint16_t *addr, uint16_t addr_num)
|
||||
{
|
||||
btc_ble_mesh_prov_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -55,7 +55,8 @@ uint16_t esp_ble_mesh_get_primary_element_address(void);
|
|||
* to 0x0000 in order to unsubscribe the model from the group.
|
||||
*
|
||||
*/
|
||||
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model, uint16_t group_addr);
|
||||
uint16_t *esp_ble_mesh_is_model_subscribed_to_group(esp_ble_mesh_model_t *model,
|
||||
uint16_t group_addr);
|
||||
|
||||
/**
|
||||
* @brief Find the BLE Mesh element pointer via the element address.
|
||||
|
@ -87,7 +88,7 @@ uint8_t esp_ble_mesh_get_element_count(void);
|
|||
*
|
||||
*/
|
||||
esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *element,
|
||||
uint16_t company_id, uint16_t model_id);
|
||||
uint16_t company_id, uint16_t model_id);
|
||||
|
||||
/**
|
||||
* @brief Find the SIG model with the given element and Model id.
|
||||
|
@ -98,7 +99,8 @@ esp_ble_mesh_model_t *esp_ble_mesh_find_vendor_model(const esp_ble_mesh_elem_t *
|
|||
* @return Pointer to the SIG Model on success, or NULL on failure which means the SIG Model is not found.
|
||||
*
|
||||
*/
|
||||
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element, uint16_t model_id);
|
||||
esp_ble_mesh_model_t *esp_ble_mesh_find_sig_model(const esp_ble_mesh_elem_t *element,
|
||||
uint16_t model_id);
|
||||
|
||||
/**
|
||||
* @brief Get the Composition data which has been registered.
|
||||
|
|
|
@ -23,7 +23,7 @@ extern "C" {
|
|||
|
||||
/** @brief: event, event code of user-defined model events; param, parameters of user-defined model events */
|
||||
typedef void (* esp_ble_mesh_model_cb_t)(esp_ble_mesh_model_cb_event_t event,
|
||||
esp_ble_mesh_model_cb_param_t *param);
|
||||
esp_ble_mesh_model_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh callback for user-defined models' operations.
|
||||
|
@ -104,8 +104,9 @@ esp_err_t esp_ble_mesh_client_model_deinit(esp_ble_mesh_model_t *model);
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
|
||||
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
|
||||
uint16_t length, uint8_t *data);
|
||||
esp_ble_mesh_msg_ctx_t *ctx,
|
||||
uint32_t opcode,
|
||||
uint16_t length, uint8_t *data);
|
||||
|
||||
/**
|
||||
* @brief Send client model message (such as model get, set, etc).
|
||||
|
@ -123,9 +124,11 @@ esp_err_t esp_ble_mesh_server_model_send_msg(esp_ble_mesh_model_t *model,
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_client_model_send_msg(esp_ble_mesh_model_t *model,
|
||||
esp_ble_mesh_msg_ctx_t *ctx, uint32_t opcode,
|
||||
uint16_t length, uint8_t *data, int32_t msg_timeout,
|
||||
bool need_rsp, esp_ble_mesh_dev_role_t device_role);
|
||||
esp_ble_mesh_msg_ctx_t *ctx,
|
||||
uint32_t opcode,
|
||||
uint16_t length, uint8_t *data,
|
||||
int32_t msg_timeout, bool need_rsp,
|
||||
esp_ble_mesh_dev_role_t device_role);
|
||||
|
||||
/**
|
||||
* @brief Send a model publication message.
|
||||
|
@ -166,8 +169,8 @@ esp_err_t esp_ble_mesh_model_publish(esp_ble_mesh_model_t *model, uint32_t opcod
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_server_model_update_state(esp_ble_mesh_model_t *model,
|
||||
esp_ble_mesh_server_state_type_t type,
|
||||
esp_ble_mesh_server_state_value_t *value);
|
||||
esp_ble_mesh_server_state_type_t type,
|
||||
esp_ble_mesh_server_state_value_t *value);
|
||||
|
||||
/**
|
||||
* @brief Reset the provisioning procedure of the local BLE Mesh node.
|
||||
|
@ -226,7 +229,8 @@ uint16_t esp_ble_mesh_provisioner_get_node_index(const char *name);
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr, uint8_t *data, uint16_t length);
|
||||
esp_err_t esp_ble_mesh_provisioner_store_node_comp_data(uint16_t unicast_addr,
|
||||
uint8_t *data, uint16_t length);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get the provisioned node information
|
||||
|
@ -329,7 +333,8 @@ esp_err_t esp_ble_mesh_provisioner_delete_node_with_addr(uint16_t unicast_addr);
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16], uint16_t net_idx, uint16_t app_idx);
|
||||
esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
|
||||
uint16_t net_idx, uint16_t app_idx);
|
||||
|
||||
/**
|
||||
* @brief This function is used to update a local AppKey for Provisioner.
|
||||
|
@ -342,7 +347,7 @@ esp_err_t esp_ble_mesh_provisioner_add_local_app_key(const uint8_t app_key[16],
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_update_local_app_key(const uint8_t app_key[16],
|
||||
uint16_t net_idx, uint16_t app_idx);
|
||||
uint16_t net_idx, uint16_t app_idx);
|
||||
|
||||
/**
|
||||
* @brief This function is called by Provisioner to get the local app key value.
|
||||
|
@ -370,7 +375,7 @@ const uint8_t *esp_ble_mesh_provisioner_get_local_app_key(uint16_t net_idx, uint
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_bind_app_key_to_local_model(uint16_t element_addr, uint16_t app_idx,
|
||||
uint16_t model_id, uint16_t company_id);
|
||||
uint16_t model_id, uint16_t company_id);
|
||||
|
||||
/**
|
||||
* @brief This function is called by Provisioner to add local network key.
|
||||
|
|
|
@ -76,7 +76,7 @@ esp_err_t esp_ble_mesh_node_prov_disable(esp_ble_mesh_prov_bearer_t bearers);
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_node_set_oob_pub_key(uint8_t pub_key_x[32], uint8_t pub_key_y[32],
|
||||
uint8_t private_key[32]);
|
||||
uint8_t private_key[32]);
|
||||
|
||||
/**
|
||||
* @brief Provide provisioning input OOB number.
|
||||
|
@ -128,7 +128,7 @@ esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name);
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_read_oob_pub_key(uint8_t link_idx, uint8_t pub_key_x[32],
|
||||
uint8_t pub_key_y[32]);
|
||||
uint8_t pub_key_y[32]);
|
||||
|
||||
/**
|
||||
* @brief Provide provisioning input OOB string.
|
||||
|
@ -232,7 +232,7 @@ esp_err_t esp_ble_mesh_provisioner_prov_disable(esp_ble_mesh_prov_bearer_t beare
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t *add_dev,
|
||||
esp_ble_mesh_dev_add_flag_t flags);
|
||||
esp_ble_mesh_dev_add_flag_t flags);
|
||||
|
||||
/** @brief Provision an unprovisioned device with fixed unicast address.
|
||||
*
|
||||
|
@ -257,16 +257,17 @@ esp_err_t esp_ble_mesh_provisioner_add_unprov_dev(esp_ble_mesh_unprov_dev_add_t
|
|||
* and "esp_ble_mesh_provisioner_prov_device_with_addr" by a Provisioner.
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_prov_device_with_addr(const uint8_t uuid[16],
|
||||
esp_ble_mesh_bd_addr_t addr, esp_ble_mesh_addr_type_t addr_type,
|
||||
esp_ble_mesh_prov_bearer_t bearer, uint16_t oob_info, uint16_t unicast_addr);
|
||||
esp_ble_mesh_bd_addr_t addr,
|
||||
esp_ble_mesh_addr_type_t addr_type,
|
||||
esp_ble_mesh_prov_bearer_t bearer,
|
||||
uint16_t oob_info, uint16_t unicast_addr);
|
||||
|
||||
/**
|
||||
* @brief Delete device from queue, reset current provisioning link and reset the node.
|
||||
* @brief Delete device from queue, and reset current provisioning link with the device.
|
||||
*
|
||||
* @note If the device is in the queue, remove it from the queue; if the device is being
|
||||
* provisioned, terminate the provisioning procedure; if the device has already
|
||||
* been provisioned, reset the device. And either one of the addr or device UUID
|
||||
* can be input.
|
||||
* @note If the device is in the queue, remove it from the queue; if the device is
|
||||
* being provisioned, terminate the provisioning procedure. Either one of the
|
||||
* device address or device UUID can be used as input.
|
||||
*
|
||||
* @param[in] del_dev: Pointer to a struct containing the device information.
|
||||
*
|
||||
|
@ -290,8 +291,8 @@ esp_err_t esp_ble_mesh_provisioner_delete_dev(esp_ble_mesh_device_delete_t *del_
|
|||
*
|
||||
*/
|
||||
typedef void (*esp_ble_mesh_prov_adv_cb_t)(const esp_ble_mesh_bd_addr_t addr, const esp_ble_mesh_addr_type_t addr_type,
|
||||
const uint8_t adv_type, const uint8_t *dev_uuid,
|
||||
uint16_t oob_info, esp_ble_mesh_prov_bearer_t bearer);
|
||||
const uint8_t adv_type, const uint8_t *dev_uuid,
|
||||
uint16_t oob_info, esp_ble_mesh_prov_bearer_t bearer);
|
||||
|
||||
/**
|
||||
* @brief This function is called by Provisioner to set the part of the device UUID
|
||||
|
@ -307,7 +308,7 @@ typedef void (*esp_ble_mesh_prov_adv_cb_t)(const esp_ble_mesh_bd_addr_t addr, co
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_provisioner_set_dev_uuid_match(const uint8_t *match_val, uint8_t match_len,
|
||||
uint8_t offset, bool prov_after_match);
|
||||
uint8_t offset, bool prov_after_match);
|
||||
|
||||
/**
|
||||
* @brief This function is called by Provisioner to set provisioning data information
|
||||
|
|
|
@ -65,7 +65,8 @@ esp_err_t esp_ble_mesh_proxy_gatt_disable(void);
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_proxy_client_connect(esp_ble_mesh_bd_addr_t addr,
|
||||
esp_ble_mesh_addr_type_t addr_type, uint16_t net_idx);
|
||||
esp_ble_mesh_addr_type_t addr_type,
|
||||
uint16_t net_idx);
|
||||
|
||||
/**
|
||||
* @brief Proxy Client terminates a connection with the Proxy Server.
|
||||
|
@ -87,8 +88,8 @@ esp_err_t esp_ble_mesh_proxy_client_disconnect(uint8_t conn_handle);
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle,
|
||||
uint16_t net_idx, esp_ble_mesh_proxy_filter_type_t filter_type);
|
||||
esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle, uint16_t net_idx,
|
||||
esp_ble_mesh_proxy_filter_type_t filter_type);
|
||||
|
||||
/**
|
||||
* @brief Proxy Client adds address to the Proxy Server filter list.
|
||||
|
@ -101,8 +102,8 @@ esp_err_t esp_ble_mesh_proxy_client_set_filter_type(uint8_t conn_handle,
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle,
|
||||
uint16_t net_idx, uint16_t *addr, uint16_t addr_num);
|
||||
esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle, uint16_t net_idx,
|
||||
uint16_t *addr, uint16_t addr_num);
|
||||
|
||||
/**
|
||||
* @brief Proxy Client removes address from the Proxy Server filter list.
|
||||
|
@ -115,8 +116,8 @@ esp_err_t esp_ble_mesh_proxy_client_add_filter_addr(uint8_t conn_handle,
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle,
|
||||
uint16_t net_idx, uint16_t *addr, uint16_t addr_num);
|
||||
esp_err_t esp_ble_mesh_proxy_client_remove_filter_addr(uint8_t conn_handle, uint16_t net_idx,
|
||||
uint16_t *addr, uint16_t addr_num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -61,6 +61,12 @@ typedef uint8_t esp_ble_mesh_octet8_t[ESP_BLE_MESH_OCTET8_LEN];
|
|||
/*!< Invalid Company ID */
|
||||
#define ESP_BLE_MESH_CID_NVAL 0xFFFF
|
||||
|
||||
/*!< Special TTL value to request using configured default TTL */
|
||||
#define ESP_BLE_MESH_TTL_DEFAULT 0xFF
|
||||
|
||||
/*!< Maximum allowed TTL value */
|
||||
#define ESP_BLE_MESH_TTL_MAX 0x7F
|
||||
|
||||
#define ESP_BLE_MESH_ADDR_UNASSIGNED 0x0000
|
||||
#define ESP_BLE_MESH_ADDR_ALL_NODES 0xFFFF
|
||||
#define ESP_BLE_MESH_ADDR_PROXIES 0xFFFC
|
||||
|
@ -265,7 +271,7 @@ typedef enum {
|
|||
#define ESP_BLE_MESH_MODEL_OP_2(b0, b1) (((b0) << 8) | (b1))
|
||||
#define ESP_BLE_MESH_MODEL_OP_3(b0, cid) ((((b0) << 16) | 0xC00000) | (cid))
|
||||
|
||||
/*!< This macro is associated with BLE_MESH_MODEL in mesh_access.h */
|
||||
/*!< This macro is associated with BLE_MESH_MODEL_CB in mesh_access.h */
|
||||
#define ESP_BLE_MESH_SIG_MODEL(_id, _op, _pub, _user_data) \
|
||||
{ \
|
||||
.model_id = (_id), \
|
||||
|
@ -278,7 +284,7 @@ typedef enum {
|
|||
.user_data = _user_data, \
|
||||
}
|
||||
|
||||
/*!< This macro is associated with BLE_MESH_MODEL_VND in mesh_access.h */
|
||||
/*!< 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), \
|
||||
|
@ -455,6 +461,17 @@ typedef struct {
|
|||
*/
|
||||
#define ESP_BLE_MESH_MODEL_OP_END {0, 0, 0}
|
||||
|
||||
/** Abstraction that describes a model callback structure.
|
||||
* This structure is associated with struct bt_mesh_model_cb in mesh_access.h.
|
||||
*/
|
||||
typedef struct {
|
||||
/** Callback used during model initialization. Initialized by the stack. */
|
||||
esp_ble_mesh_cb_t init_cb;
|
||||
|
||||
/** Callback used during model deinitialization. Initialized by the stack. */
|
||||
esp_ble_mesh_cb_t deinit_cb;
|
||||
} esp_ble_mesh_model_cbs_t;
|
||||
|
||||
/** Abstraction that describes a Mesh Model instance.
|
||||
* This structure is associated with struct bt_mesh_model in mesh_access.h
|
||||
*/
|
||||
|
@ -488,6 +505,9 @@ struct esp_ble_mesh_model {
|
|||
/** Model operation context */
|
||||
esp_ble_mesh_model_op_t *op;
|
||||
|
||||
/** Model callback structure */
|
||||
esp_ble_mesh_model_cbs_t *cb;
|
||||
|
||||
/** Model-specific user data */
|
||||
void *user_data;
|
||||
};
|
||||
|
@ -522,7 +542,7 @@ typedef struct {
|
|||
/** Force sending reliably by using segment acknowledgement */
|
||||
uint8_t send_rel: 1;
|
||||
|
||||
/** TTL, or BLE_MESH_TTL_DEFAULT for default TTL. */
|
||||
/** TTL, or ESP_BLE_MESH_TTL_DEFAULT for default TTL. */
|
||||
uint8_t send_ttl;
|
||||
|
||||
/** Opcode of a received message. Not used for sending message. */
|
||||
|
@ -809,7 +829,7 @@ typedef enum {
|
|||
ESP_BLE_MESH_PROVISIONER_PROV_COMPLETE_EVT, /*!< Provisioner provisioning done event */
|
||||
ESP_BLE_MESH_PROVISIONER_ADD_UNPROV_DEV_COMP_EVT, /*!< Provisioner add a device to the list which contains devices that are waiting/going to be provisioned completion event */
|
||||
ESP_BLE_MESH_PROVISIONER_PROV_DEV_WITH_ADDR_COMP_EVT, /*!< Provisioner start to provision an unprovisioned device completion event */
|
||||
ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT, /*!< Provisioner delete a device from the list, close provisioning link with the device if it exists and remove the device from network completion event */
|
||||
ESP_BLE_MESH_PROVISIONER_DELETE_DEV_COMP_EVT, /*!< Provisioner delete a device from the list, close provisioning link with the device completion event */
|
||||
ESP_BLE_MESH_PROVISIONER_SET_DEV_UUID_MATCH_COMP_EVT, /*!< Provisioner set the value to be compared with part of the unprovisioned device UUID completion event */
|
||||
ESP_BLE_MESH_PROVISIONER_SET_PROV_DATA_INFO_COMP_EVT, /*!< Provisioner set net_idx/flags/iv_index used for provisioning completion event */
|
||||
ESP_BLE_MESH_PROVISIONER_SET_STATIC_OOB_VALUE_COMP_EVT, /*!< Provisioner set static oob value used for provisioning completion event */
|
||||
|
@ -1112,6 +1132,7 @@ typedef union {
|
|||
*/
|
||||
struct ble_mesh_provisioner_add_local_app_key_comp_param {
|
||||
int err_code; /*!< Indicate the result of adding local AppKey by the Provisioner */
|
||||
uint16_t net_idx; /*!< NetKey Index */
|
||||
uint16_t app_idx; /*!< AppKey Index */
|
||||
} provisioner_add_app_key_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_ADD_LOCAL_APP_KEY_COMP_EVT */
|
||||
/**
|
||||
|
@ -1156,14 +1177,14 @@ typedef union {
|
|||
/**
|
||||
* @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT
|
||||
*/
|
||||
struct ble_mesh_provisioner_delete_node_with_uuid_comp_data_comp_param {
|
||||
struct ble_mesh_provisioner_delete_node_with_uuid_comp_param {
|
||||
int err_code; /*!< Indicate the result of deleting node with uuid by the Provisioner */
|
||||
uint8_t uuid[16]; /*!< Node device uuid */
|
||||
} provisioner_delete_node_with_uuid_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_UUID_COMP_EVT */
|
||||
/**
|
||||
* @brief ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT
|
||||
*/
|
||||
struct ble_mesh_provisioner_delete_node_with_addr_comp_data_comp_param {
|
||||
struct ble_mesh_provisioner_delete_node_with_addr_comp_param {
|
||||
int err_code; /*!< Indicate the result of deleting node with unicast address by the Provisioner */
|
||||
uint16_t unicast_addr; /*!< Node unicast address */
|
||||
} provisioner_delete_node_with_addr_comp; /*!< Event parameter of ESP_BLE_MESH_PROVISIONER_DELETE_NODE_WITH_ADDR_COMP_EVT */
|
||||
|
@ -1954,8 +1975,8 @@ typedef struct {
|
|||
int64_t timestamp; /*!< Time when the last message is received */
|
||||
} esp_ble_mesh_last_msg_info_t;
|
||||
|
||||
#define ESP_BLE_MESH_SERVER_RSP_BY_APP 0 /*!< Response will be sent internally */
|
||||
#define ESP_BLE_MESH_SERVER_AUTO_RSP 1 /*!< Response need to be sent in the application */
|
||||
#define ESP_BLE_MESH_SERVER_RSP_BY_APP 0 /*!< Response need to be sent in the application */
|
||||
#define ESP_BLE_MESH_SERVER_AUTO_RSP 1 /*!< Response will be sent internally */
|
||||
|
||||
/** Parameters of the Server Model response control */
|
||||
typedef struct {
|
||||
|
|
|
@ -53,7 +53,7 @@ static bool config_client_get_need_param(esp_ble_mesh_opcode_t opcode)
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_cfg_client_get_state_t *get_state)
|
||||
esp_ble_mesh_cfg_client_get_state_t *get_state)
|
||||
{
|
||||
btc_ble_mesh_config_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -78,7 +78,7 @@ esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_cfg_client_set_state_t *set_state)
|
||||
esp_ble_mesh_cfg_client_set_state_t *set_state)
|
||||
{
|
||||
btc_ble_mesh_config_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -40,7 +40,7 @@ static bool generic_client_get_need_param(esp_ble_mesh_opcode_t opcode)
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_generic_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_generic_client_get_state_t *get_state)
|
||||
esp_ble_mesh_generic_client_get_state_t *get_state)
|
||||
{
|
||||
btc_ble_mesh_generic_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -66,7 +66,7 @@ esp_err_t esp_ble_mesh_generic_client_get_state(esp_ble_mesh_client_common_param
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_generic_client_set_state_t *set_state)
|
||||
esp_ble_mesh_generic_client_set_state_t *set_state)
|
||||
{
|
||||
btc_ble_mesh_generic_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -34,7 +34,7 @@ esp_err_t esp_ble_mesh_register_health_server_callback(esp_ble_mesh_health_serve
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_health_client_get_state_t *get_state)
|
||||
esp_ble_mesh_health_client_get_state_t *get_state)
|
||||
{
|
||||
btc_ble_mesh_health_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -60,7 +60,7 @@ esp_err_t esp_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_health_client_set_state_t *set_state)
|
||||
esp_ble_mesh_health_client_set_state_t *set_state)
|
||||
{
|
||||
btc_ble_mesh_health_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -27,7 +27,7 @@ esp_err_t esp_ble_mesh_register_light_client_callback(esp_ble_mesh_light_client_
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_light_client_get_state_t *get_state)
|
||||
esp_ble_mesh_light_client_get_state_t *get_state)
|
||||
{
|
||||
btc_ble_mesh_lighting_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -53,7 +53,7 @@ esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_light_client_set_state_t *set_state)
|
||||
esp_ble_mesh_light_client_set_state_t *set_state)
|
||||
{
|
||||
btc_ble_mesh_lighting_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -27,7 +27,7 @@ esp_err_t esp_ble_mesh_register_sensor_client_callback(esp_ble_mesh_sensor_clien
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_sensor_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_sensor_client_get_state_t *get_state)
|
||||
esp_ble_mesh_sensor_client_get_state_t *get_state)
|
||||
{
|
||||
btc_ble_mesh_sensor_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -52,7 +52,7 @@ esp_err_t esp_ble_mesh_sensor_client_get_state(esp_ble_mesh_client_common_param_
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_sensor_client_set_state_t *set_state)
|
||||
esp_ble_mesh_sensor_client_set_state_t *set_state)
|
||||
{
|
||||
btc_ble_mesh_sensor_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -27,7 +27,7 @@ esp_err_t esp_ble_mesh_register_time_scene_client_callback(esp_ble_mesh_time_sce
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_time_scene_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_time_scene_client_get_state_t *get_state)
|
||||
esp_ble_mesh_time_scene_client_get_state_t *get_state)
|
||||
{
|
||||
btc_ble_mesh_time_scene_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
@ -53,7 +53,7 @@ esp_err_t esp_ble_mesh_time_scene_client_get_state(esp_ble_mesh_client_common_pa
|
|||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_time_scene_client_set_state_t *set_state)
|
||||
esp_ble_mesh_time_scene_client_set_state_t *set_state)
|
||||
{
|
||||
btc_ble_mesh_time_scene_client_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
|
|
@ -756,7 +756,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_cfg_client_cb_t)(esp_ble_mesh_cfg_client_cb_event_t event,
|
||||
esp_ble_mesh_cfg_client_cb_param_t *param);
|
||||
esp_ble_mesh_cfg_client_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Configuration Server Model callback function type
|
||||
|
@ -764,7 +764,7 @@ typedef void (* esp_ble_mesh_cfg_client_cb_t)(esp_ble_mesh_cfg_client_cb_event_t
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_cfg_server_cb_t)(esp_ble_mesh_cfg_server_cb_event_t event,
|
||||
esp_ble_mesh_cfg_server_cb_param_t *param);
|
||||
esp_ble_mesh_cfg_server_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Config Client Model callback.
|
||||
|
@ -800,7 +800,7 @@ esp_err_t esp_ble_mesh_register_config_server_callback(esp_ble_mesh_cfg_server_c
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_cfg_client_get_state_t *get_state);
|
||||
esp_ble_mesh_cfg_client_get_state_t *get_state);
|
||||
|
||||
/**
|
||||
* @brief Set the value of the Configuration Server Model states using the Config Client Model set messages.
|
||||
|
@ -816,7 +816,7 @@ esp_err_t esp_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_cfg_client_set_state_t *set_state);
|
||||
esp_ble_mesh_cfg_client_set_state_t *set_state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -483,7 +483,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_generic_client_cb_t)(esp_ble_mesh_generic_client_cb_event_t event,
|
||||
esp_ble_mesh_generic_client_cb_param_t *param);
|
||||
esp_ble_mesh_generic_client_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Generic Client Model callback.
|
||||
|
@ -509,7 +509,7 @@ esp_err_t esp_ble_mesh_register_generic_client_callback(esp_ble_mesh_generic_cli
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_generic_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_generic_client_get_state_t *get_state);
|
||||
esp_ble_mesh_generic_client_get_state_t *get_state);
|
||||
|
||||
/**
|
||||
* @brief Set the value of Generic Server Model states using the Generic Client Model set messages.
|
||||
|
@ -525,7 +525,7 @@ esp_err_t esp_ble_mesh_generic_client_get_state(esp_ble_mesh_client_common_param
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_generic_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_generic_client_set_state_t *set_state);
|
||||
esp_ble_mesh_generic_client_set_state_t *set_state);
|
||||
|
||||
/**
|
||||
* @brief Generic Server Models related context.
|
||||
|
@ -1285,7 +1285,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_generic_server_cb_t)(esp_ble_mesh_generic_server_cb_event_t event,
|
||||
esp_ble_mesh_generic_server_cb_param_t *param);
|
||||
esp_ble_mesh_generic_server_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Generic Server Model callback.
|
||||
|
|
|
@ -335,7 +335,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_health_client_cb_t)(esp_ble_mesh_health_client_cb_event_t event,
|
||||
esp_ble_mesh_health_client_cb_param_t *param);
|
||||
esp_ble_mesh_health_client_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Health Server Model callback function type
|
||||
|
@ -343,7 +343,7 @@ typedef void (* esp_ble_mesh_health_client_cb_t)(esp_ble_mesh_health_client_cb_e
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_health_server_cb_t)(esp_ble_mesh_health_server_cb_event_t event,
|
||||
esp_ble_mesh_health_server_cb_param_t *param);
|
||||
esp_ble_mesh_health_server_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Health Model callback, the callback will report Health Client & Server Model events.
|
||||
|
@ -379,7 +379,7 @@ esp_err_t esp_ble_mesh_register_health_server_callback(esp_ble_mesh_health_serve
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_health_client_get_state_t *get_state);
|
||||
esp_ble_mesh_health_client_get_state_t *get_state);
|
||||
|
||||
/**
|
||||
* @brief This function is called to set the Health Server states using the Health Client Model set messages.
|
||||
|
@ -395,7 +395,7 @@ esp_err_t esp_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_health_client_set_state_t *set_state);
|
||||
esp_ble_mesh_health_client_set_state_t *set_state);
|
||||
|
||||
/**
|
||||
* @brief This function is called by the Health Server Model to update the context of its Health Current status.
|
||||
|
|
|
@ -539,7 +539,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_light_client_cb_t)(esp_ble_mesh_light_client_cb_event_t event,
|
||||
esp_ble_mesh_light_client_cb_param_t *param);
|
||||
esp_ble_mesh_light_client_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Light Client Model callback.
|
||||
|
@ -565,7 +565,7 @@ esp_err_t esp_ble_mesh_register_light_client_callback(esp_ble_mesh_light_client_
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_light_client_get_state_t *get_state);
|
||||
esp_ble_mesh_light_client_get_state_t *get_state);
|
||||
|
||||
/**
|
||||
* @brief Set the value of Light Server Model states using the Light Client Model set messages.
|
||||
|
@ -581,7 +581,7 @@ esp_err_t esp_ble_mesh_light_client_get_state(esp_ble_mesh_client_common_param_t
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_light_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_light_client_set_state_t *set_state);
|
||||
esp_ble_mesh_light_client_set_state_t *set_state);
|
||||
|
||||
/**
|
||||
* @brief Lighting Server Models related context.
|
||||
|
@ -1663,7 +1663,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_lighting_server_cb_t)(esp_ble_mesh_lighting_server_cb_event_t event,
|
||||
esp_ble_mesh_lighting_server_cb_param_t *param);
|
||||
esp_ble_mesh_lighting_server_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Lighting Server Model callback.
|
||||
|
|
|
@ -215,7 +215,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_sensor_client_cb_t)(esp_ble_mesh_sensor_client_cb_event_t event,
|
||||
esp_ble_mesh_sensor_client_cb_param_t *param);
|
||||
esp_ble_mesh_sensor_client_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Sensor Client Model callback.
|
||||
|
@ -241,7 +241,7 @@ esp_err_t esp_ble_mesh_register_sensor_client_callback(esp_ble_mesh_sensor_clien
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_sensor_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_sensor_client_get_state_t *get_state);
|
||||
esp_ble_mesh_sensor_client_get_state_t *get_state);
|
||||
|
||||
/**
|
||||
* @brief Set the value of Sensor Server Model states using the Sensor Client Model set messages.
|
||||
|
@ -257,7 +257,7 @@ esp_err_t esp_ble_mesh_sensor_client_get_state(esp_ble_mesh_client_common_param_
|
|||
*
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_sensor_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_sensor_client_set_state_t *set_state);
|
||||
esp_ble_mesh_sensor_client_set_state_t *set_state);
|
||||
|
||||
/**
|
||||
* @brief Sensor Server Models related context.
|
||||
|
@ -698,7 +698,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_sensor_server_cb_t)(esp_ble_mesh_sensor_server_cb_event_t event,
|
||||
esp_ble_mesh_sensor_server_cb_param_t *param);
|
||||
esp_ble_mesh_sensor_server_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Sensor Server Model callback.
|
||||
|
|
|
@ -276,7 +276,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_time_scene_client_cb_t)(esp_ble_mesh_time_scene_client_cb_event_t event,
|
||||
esp_ble_mesh_time_scene_client_cb_param_t *param);
|
||||
esp_ble_mesh_time_scene_client_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Time Scene Client Model callback.
|
||||
|
@ -301,7 +301,7 @@ esp_err_t esp_ble_mesh_register_time_scene_client_callback(esp_ble_mesh_time_sce
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_time_scene_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_time_scene_client_get_state_t *get_state);
|
||||
esp_ble_mesh_time_scene_client_get_state_t *get_state);
|
||||
|
||||
/**
|
||||
* @brief Set the value of Time Scene Server Model states using the Time Scene Client Model set messages.
|
||||
|
@ -316,7 +316,7 @@ esp_err_t esp_ble_mesh_time_scene_client_get_state(esp_ble_mesh_client_common_pa
|
|||
* @return ESP_OK on success or error code otherwise.
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_time_scene_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_time_scene_client_set_state_t *set_state);
|
||||
esp_ble_mesh_time_scene_client_set_state_t *set_state);
|
||||
|
||||
/**
|
||||
* @brief Time Scene Server Models related context.
|
||||
|
@ -900,7 +900,7 @@ typedef enum {
|
|||
* @param param: Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_ble_mesh_time_scene_server_cb_t)(esp_ble_mesh_time_scene_server_cb_event_t event,
|
||||
esp_ble_mesh_time_scene_server_cb_param_t *param);
|
||||
esp_ble_mesh_time_scene_server_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register BLE Mesh Time and Scenes Server Model callback.
|
||||
|
|
|
@ -20,12 +20,10 @@
|
|||
#include "cfg_cli.h"
|
||||
#include "esp_ble_mesh_config_model_api.h"
|
||||
|
||||
extern s32_t config_msg_timeout;
|
||||
|
||||
/* Configuration Client Model related functions */
|
||||
|
||||
static inline void btc_ble_mesh_config_client_cb_to_app(esp_ble_mesh_cfg_client_cb_event_t event,
|
||||
esp_ble_mesh_cfg_client_cb_param_t *param)
|
||||
esp_ble_mesh_cfg_client_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_cfg_client_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_cfg_client_cb_t)btc_profile_cb_get(BTC_PID_CONFIG_CLIENT);
|
||||
|
@ -51,7 +49,7 @@ void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
memcpy(dst->cfg_client_get_state.params, src->cfg_client_get_state.params,
|
||||
sizeof(esp_ble_mesh_client_common_param_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
if (src->cfg_client_get_state.get_state) {
|
||||
|
@ -60,7 +58,7 @@ void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
memcpy(dst->cfg_client_get_state.get_state, src->cfg_client_get_state.get_state,
|
||||
sizeof(esp_ble_mesh_cfg_client_get_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -71,7 +69,7 @@ void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
memcpy(dst->cfg_client_set_state.params, src->cfg_client_set_state.params,
|
||||
sizeof(esp_ble_mesh_client_common_param_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
if (src->cfg_client_set_state.set_state) {
|
||||
|
@ -80,13 +78,13 @@ void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
memcpy(dst->cfg_client_set_state.set_state, src->cfg_client_set_state.set_state,
|
||||
sizeof(esp_ble_mesh_cfg_client_set_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_DBG("%s, Unknown deep copy act %d", __func__, msg->act);
|
||||
BT_DBG("%s, Unknown act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +136,7 @@ static void btc_ble_mesh_config_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
if (p_src_data->params) {
|
||||
p_dest_data->params = bt_mesh_malloc(sizeof(esp_ble_mesh_client_common_param_t));
|
||||
if (!p_dest_data->params) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -157,7 +155,7 @@ static void btc_ble_mesh_config_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.comp_data_status.composition_data->len;
|
||||
p_dest_data->status_cb.comp_data_status.composition_data = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.comp_data_status.composition_data) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.comp_data_status.composition_data,
|
||||
|
@ -173,7 +171,7 @@ static void btc_ble_mesh_config_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.model_sub_list.sub_addr->len;
|
||||
p_dest_data->status_cb.model_sub_list.sub_addr = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.model_sub_list.sub_addr) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.model_sub_list.sub_addr,
|
||||
|
@ -187,7 +185,7 @@ static void btc_ble_mesh_config_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.netkey_list.net_idx->len;
|
||||
p_dest_data->status_cb.netkey_list.net_idx = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.netkey_list.net_idx) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.netkey_list.net_idx,
|
||||
|
@ -201,7 +199,7 @@ static void btc_ble_mesh_config_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.appkey_list.app_idx->len;
|
||||
p_dest_data->status_cb.appkey_list.app_idx = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.appkey_list.app_idx) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.appkey_list.app_idx,
|
||||
|
@ -217,7 +215,7 @@ static void btc_ble_mesh_config_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.model_app_list.app_idx->len;
|
||||
p_dest_data->status_cb.model_app_list.app_idx = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.model_app_list.app_idx) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.model_app_list.app_idx,
|
||||
|
@ -306,18 +304,17 @@ static void btc_ble_mesh_config_client_callback(esp_ble_mesh_cfg_client_cb_param
|
|||
msg.pid = BTC_PID_CONFIG_CLIENT;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_cfg_client_cb_param_t), btc_ble_mesh_config_client_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_cfg_client_cb_param_t),
|
||||
btc_ble_mesh_config_client_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_cfg_client_cb_param_t cb_params = {0};
|
||||
esp_ble_mesh_client_common_param_t params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (!model || !ctx) {
|
||||
|
@ -339,7 +336,7 @@ void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
act = ESP_BLE_MESH_CFG_CLIENT_TIMEOUT_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown config client event type %d", __func__, evt_type);
|
||||
BT_ERR("Unknown Config client event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -352,38 +349,37 @@ void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
params.ctx.recv_op = ctx->recv_op;
|
||||
params.ctx.recv_dst = ctx->recv_dst;
|
||||
params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
cb_params.error_code = 0;
|
||||
cb_params.params = ¶ms;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.status_cb)) ? len : sizeof(cb_params.status_cb);
|
||||
memcpy(&cb_params.status_cb, val, length);
|
||||
memcpy(&cb_params.status_cb, val, MIN(len, sizeof(cb_params.status_cb)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_config_client_callback(&cb_params, act);
|
||||
return;
|
||||
}
|
||||
|
||||
void btc_ble_mesh_config_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
void btc_ble_mesh_config_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
if (!model || !ctx || !buf) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_config_client_cb_evt_to_btc(opcode,
|
||||
BTC_BLE_MESH_EVT_CONFIG_CLIENT_PUBLISH, model, ctx, buf->data, buf->len);
|
||||
bt_mesh_config_client_cb_evt_to_btc(opcode, BTC_BLE_MESH_EVT_CONFIG_CLIENT_PUBLISH,
|
||||
model, ctx, buf->data, buf->len);
|
||||
return;
|
||||
}
|
||||
|
||||
static int btc_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_cfg_client_get_state_t *get)
|
||||
{
|
||||
struct bt_mesh_msg_ctx ctx = {0};
|
||||
bt_mesh_client_common_param_t param = {0};
|
||||
|
||||
if (params == NULL) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -402,7 +398,7 @@ static int btc_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param
|
|||
case ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET:
|
||||
case ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET:
|
||||
if (get == NULL) {
|
||||
BT_ERR("%s, Invalid config client get", __func__);
|
||||
BT_ERR("Invalid Configuration Get");
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
|
@ -410,63 +406,65 @@ static int btc_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param
|
|||
break;
|
||||
}
|
||||
|
||||
ctx.net_idx = params->ctx.net_idx;
|
||||
ctx.app_idx = BLE_MESH_KEY_DEV;
|
||||
ctx.addr = params->ctx.addr;
|
||||
ctx.send_rel = params->ctx.send_rel;
|
||||
ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.opcode = params->opcode;
|
||||
param.model = (struct bt_mesh_model *)params->model;
|
||||
param.ctx.net_idx = params->ctx.net_idx;
|
||||
param.ctx.app_idx = BLE_MESH_KEY_DEV;
|
||||
param.ctx.addr = params->ctx.addr;
|
||||
param.ctx.send_rel = params->ctx.send_rel;
|
||||
param.ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.msg_timeout = params->msg_timeout;
|
||||
param.msg_role = params->msg_role;
|
||||
|
||||
config_msg_timeout = params->msg_timeout;
|
||||
|
||||
switch (params->opcode) {
|
||||
switch (param.opcode) {
|
||||
case ESP_BLE_MESH_MODEL_OP_BEACON_GET:
|
||||
return bt_mesh_cfg_beacon_get(&ctx);
|
||||
return bt_mesh_cfg_beacon_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_GET:
|
||||
return bt_mesh_cfg_ttl_get(&ctx);
|
||||
return bt_mesh_cfg_ttl_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_FRIEND_GET:
|
||||
return bt_mesh_cfg_friend_get(&ctx);
|
||||
return bt_mesh_cfg_friend_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_GATT_PROXY_GET:
|
||||
return bt_mesh_cfg_gatt_proxy_get(&ctx);
|
||||
return bt_mesh_cfg_gatt_proxy_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_RELAY_GET:
|
||||
return bt_mesh_cfg_relay_get(&ctx);
|
||||
return bt_mesh_cfg_relay_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_PUB_GET:
|
||||
return bt_mesh_cfg_mod_pub_get(&ctx, get->model_pub_get.element_addr,
|
||||
return bt_mesh_cfg_mod_pub_get(¶m, get->model_pub_get.element_addr,
|
||||
get->model_pub_get.model_id,
|
||||
get->model_pub_get.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_GET:
|
||||
return bt_mesh_cfg_hb_pub_get(&ctx);
|
||||
return bt_mesh_cfg_hb_pub_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_GET:
|
||||
return bt_mesh_cfg_hb_sub_get(&ctx);
|
||||
return bt_mesh_cfg_hb_sub_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_COMPOSITION_DATA_GET:
|
||||
return bt_mesh_cfg_comp_data_get(&ctx, get->comp_data_get.page);
|
||||
return bt_mesh_cfg_comp_data_get(¶m, get->comp_data_get.page);
|
||||
case ESP_BLE_MESH_MODEL_OP_SIG_MODEL_SUB_GET:
|
||||
return bt_mesh_cfg_mod_sub_get(&ctx, get->sig_model_sub_get.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_get(¶m, get->sig_model_sub_get.element_addr,
|
||||
get->sig_model_sub_get.model_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_SUB_GET:
|
||||
return bt_mesh_cfg_mod_sub_get_vnd(&ctx, get->vnd_model_sub_get.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_get_vnd(¶m, get->vnd_model_sub_get.element_addr,
|
||||
get->vnd_model_sub_get.model_id,
|
||||
get->vnd_model_sub_get.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_NET_KEY_GET:
|
||||
return bt_mesh_cfg_net_key_get(&ctx);
|
||||
return bt_mesh_cfg_net_key_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_APP_KEY_GET:
|
||||
return bt_mesh_cfg_app_key_get(&ctx, get->app_key_get.net_idx);
|
||||
return bt_mesh_cfg_app_key_get(¶m, get->app_key_get.net_idx);
|
||||
case ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_GET:
|
||||
return bt_mesh_cfg_node_identity_get(&ctx, get->node_identity_get.net_idx);
|
||||
return bt_mesh_cfg_node_identity_get(¶m, get->node_identity_get.net_idx);
|
||||
case ESP_BLE_MESH_MODEL_OP_SIG_MODEL_APP_GET:
|
||||
return bt_mesh_cfg_mod_app_get(&ctx, get->sig_model_app_get.element_addr,
|
||||
return bt_mesh_cfg_mod_app_get(¶m, get->sig_model_app_get.element_addr,
|
||||
get->sig_model_app_get.model_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_VENDOR_MODEL_APP_GET:
|
||||
return bt_mesh_cfg_mod_app_get_vnd(&ctx, get->vnd_model_app_get.element_addr,
|
||||
return bt_mesh_cfg_mod_app_get_vnd(¶m, get->vnd_model_app_get.element_addr,
|
||||
get->vnd_model_app_get.model_id,
|
||||
get->vnd_model_app_get.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_GET:
|
||||
return bt_mesh_cfg_kr_phase_get(&ctx, get->kr_phase_get.net_idx);
|
||||
return bt_mesh_cfg_kr_phase_get(¶m, get->kr_phase_get.net_idx);
|
||||
case ESP_BLE_MESH_MODEL_OP_LPN_POLLTIMEOUT_GET:
|
||||
return bt_mesh_cfg_lpn_timeout_get(&ctx, get->lpn_pollto_get.lpn_addr);
|
||||
return bt_mesh_cfg_lpn_timeout_get(¶m, get->lpn_pollto_get.lpn_addr);
|
||||
case ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_GET:
|
||||
return bt_mesh_cfg_net_transmit_get(&ctx);
|
||||
return bt_mesh_cfg_net_transmit_get(¶m);
|
||||
default:
|
||||
BT_ERR("%s, Invalid opcode 0x%x", __func__, params->opcode);
|
||||
BT_ERR("Invalid Configuration Get opcode 0x%04x", param.opcode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -476,7 +474,7 @@ static int btc_ble_mesh_config_client_get_state(esp_ble_mesh_client_common_param
|
|||
static int btc_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_cfg_client_set_state_t *set)
|
||||
{
|
||||
struct bt_mesh_msg_ctx ctx = {0};
|
||||
bt_mesh_client_common_param_t param = {0};
|
||||
|
||||
if (params == NULL) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -484,39 +482,41 @@ static int btc_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param
|
|||
}
|
||||
|
||||
if (params->opcode != ESP_BLE_MESH_MODEL_OP_NODE_RESET && set == NULL) {
|
||||
BT_ERR("%s, Invalid config client set", __func__);
|
||||
BT_ERR("Invalid Configuration Set");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ctx.net_idx = params->ctx.net_idx;
|
||||
ctx.app_idx = BLE_MESH_KEY_DEV;
|
||||
ctx.addr = params->ctx.addr;
|
||||
ctx.send_rel = params->ctx.send_rel;
|
||||
ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.opcode = params->opcode;
|
||||
param.model = (struct bt_mesh_model *)params->model;
|
||||
param.ctx.net_idx = params->ctx.net_idx;
|
||||
param.ctx.app_idx = BLE_MESH_KEY_DEV;
|
||||
param.ctx.addr = params->ctx.addr;
|
||||
param.ctx.send_rel = params->ctx.send_rel;
|
||||
param.ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.msg_timeout = params->msg_timeout;
|
||||
param.msg_role = params->msg_role;
|
||||
|
||||
config_msg_timeout = params->msg_timeout;
|
||||
|
||||
switch (params->opcode) {
|
||||
switch (param.opcode) {
|
||||
case ESP_BLE_MESH_MODEL_OP_BEACON_SET:
|
||||
return bt_mesh_cfg_beacon_set(&ctx, set->beacon_set.beacon);
|
||||
return bt_mesh_cfg_beacon_set(¶m, set->beacon_set.beacon);
|
||||
case ESP_BLE_MESH_MODEL_OP_DEFAULT_TTL_SET:
|
||||
return bt_mesh_cfg_ttl_set(&ctx, set->default_ttl_set.ttl);
|
||||
return bt_mesh_cfg_ttl_set(¶m, set->default_ttl_set.ttl);
|
||||
case ESP_BLE_MESH_MODEL_OP_FRIEND_SET:
|
||||
return bt_mesh_cfg_friend_set(&ctx, set->friend_set.friend_state);
|
||||
return bt_mesh_cfg_friend_set(¶m, set->friend_set.friend_state);
|
||||
case ESP_BLE_MESH_MODEL_OP_GATT_PROXY_SET:
|
||||
return bt_mesh_cfg_gatt_proxy_set(&ctx, set->gatt_proxy_set.gatt_proxy);
|
||||
return bt_mesh_cfg_gatt_proxy_set(¶m, set->gatt_proxy_set.gatt_proxy);
|
||||
case ESP_BLE_MESH_MODEL_OP_RELAY_SET:
|
||||
return bt_mesh_cfg_relay_set(&ctx, set->relay_set.relay,
|
||||
return bt_mesh_cfg_relay_set(¶m, set->relay_set.relay,
|
||||
set->relay_set.relay_retransmit);
|
||||
case ESP_BLE_MESH_MODEL_OP_NET_KEY_ADD:
|
||||
return bt_mesh_cfg_net_key_add(&ctx, set->net_key_add.net_idx,
|
||||
return bt_mesh_cfg_net_key_add(¶m, set->net_key_add.net_idx,
|
||||
&set->net_key_add.net_key[0]);
|
||||
case ESP_BLE_MESH_MODEL_OP_APP_KEY_ADD:
|
||||
return bt_mesh_cfg_app_key_add(&ctx, set->app_key_add.net_idx,
|
||||
return bt_mesh_cfg_app_key_add(¶m, set->app_key_add.net_idx,
|
||||
set->app_key_add.app_idx,
|
||||
&set->app_key_add.app_key[0]);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_APP_BIND:
|
||||
return bt_mesh_cfg_mod_app_bind(&ctx, set->model_app_bind.element_addr,
|
||||
return bt_mesh_cfg_mod_app_bind(¶m, set->model_app_bind.element_addr,
|
||||
set->model_app_bind.model_app_idx,
|
||||
set->model_app_bind.model_id,
|
||||
set->model_app_bind.company_id);
|
||||
|
@ -529,46 +529,46 @@ static int btc_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param
|
|||
.period = set->model_pub_set.publish_period,
|
||||
.transmit = set->model_pub_set.publish_retransmit,
|
||||
};
|
||||
return bt_mesh_cfg_mod_pub_set(&ctx, set->model_pub_set.element_addr,
|
||||
return bt_mesh_cfg_mod_pub_set(¶m, set->model_pub_set.element_addr,
|
||||
set->model_pub_set.model_id,
|
||||
set->model_pub_set.company_id, &model_pub);
|
||||
}
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_ADD:
|
||||
return bt_mesh_cfg_mod_sub_add(&ctx, set->model_sub_add.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_add(¶m, set->model_sub_add.element_addr,
|
||||
set->model_sub_add.sub_addr,
|
||||
set->model_sub_add.model_id,
|
||||
set->model_sub_add.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE:
|
||||
return bt_mesh_cfg_mod_sub_del(&ctx, set->model_sub_delete.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_del(¶m, set->model_sub_delete.element_addr,
|
||||
set->model_sub_delete.sub_addr,
|
||||
set->model_sub_delete.model_id,
|
||||
set->model_sub_delete.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_OVERWRITE:
|
||||
return bt_mesh_cfg_mod_sub_overwrite(&ctx, set->model_sub_overwrite.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_overwrite(¶m, set->model_sub_overwrite.element_addr,
|
||||
set->model_sub_overwrite.sub_addr,
|
||||
set->model_sub_overwrite.model_id,
|
||||
set->model_sub_overwrite.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_ADD:
|
||||
return bt_mesh_cfg_mod_sub_va_add(&ctx, set->model_sub_va_add.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_va_add(¶m, set->model_sub_va_add.element_addr,
|
||||
&set->model_sub_va_add.label_uuid[0],
|
||||
set->model_sub_va_add.model_id,
|
||||
set->model_sub_va_add.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_OVERWRITE:
|
||||
return bt_mesh_cfg_mod_sub_va_overwrite(&ctx, set->model_sub_va_overwrite.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_va_overwrite(¶m, set->model_sub_va_overwrite.element_addr,
|
||||
&set->model_sub_va_overwrite.label_uuid[0],
|
||||
set->model_sub_va_overwrite.model_id,
|
||||
set->model_sub_va_overwrite.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_VIRTUAL_ADDR_DELETE:
|
||||
return bt_mesh_cfg_mod_sub_va_del(&ctx, set->model_sub_va_delete.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_va_del(¶m, set->model_sub_va_delete.element_addr,
|
||||
&set->model_sub_va_delete.label_uuid[0],
|
||||
set->model_sub_va_delete.model_id,
|
||||
set->model_sub_va_delete.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_SUB_SET:
|
||||
return bt_mesh_cfg_hb_sub_set(&ctx, (struct bt_mesh_cfg_hb_sub *)&set->heartbeat_sub_set);
|
||||
return bt_mesh_cfg_hb_sub_set(¶m, (struct bt_mesh_cfg_hb_sub *)&set->heartbeat_sub_set);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEARTBEAT_PUB_SET:
|
||||
return bt_mesh_cfg_hb_pub_set(&ctx, (const struct bt_mesh_cfg_hb_pub *)&set->heartbeat_pub_set);
|
||||
return bt_mesh_cfg_hb_pub_set(¶m, (struct bt_mesh_cfg_hb_pub *)&set->heartbeat_pub_set);
|
||||
case ESP_BLE_MESH_MODEL_OP_NODE_RESET:
|
||||
return bt_mesh_cfg_node_reset(&ctx);
|
||||
return bt_mesh_cfg_node_reset(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_PUB_VIRTUAL_ADDR_SET: {
|
||||
struct bt_mesh_cfg_mod_pub model_pub = {
|
||||
.app_idx = set->model_pub_va_set.publish_app_idx,
|
||||
|
@ -577,42 +577,42 @@ static int btc_ble_mesh_config_client_set_state(esp_ble_mesh_client_common_param
|
|||
.period = set->model_pub_va_set.publish_period,
|
||||
.transmit = set->model_pub_va_set.publish_retransmit,
|
||||
};
|
||||
return bt_mesh_cfg_mod_pub_va_set(&ctx, set->model_pub_va_set.element_addr,
|
||||
return bt_mesh_cfg_mod_pub_va_set(¶m, set->model_pub_va_set.element_addr,
|
||||
set->model_pub_va_set.model_id,
|
||||
set->model_pub_va_set.company_id,
|
||||
set->model_pub_va_set.label_uuid, &model_pub);
|
||||
}
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_SUB_DELETE_ALL:
|
||||
return bt_mesh_cfg_mod_sub_del_all(&ctx, set->model_sub_delete_all.element_addr,
|
||||
return bt_mesh_cfg_mod_sub_del_all(¶m, set->model_sub_delete_all.element_addr,
|
||||
set->model_sub_delete_all.model_id,
|
||||
set->model_sub_delete_all.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_NET_KEY_UPDATE:
|
||||
return bt_mesh_cfg_net_key_update(&ctx, set->net_key_update.net_idx,
|
||||
return bt_mesh_cfg_net_key_update(¶m, set->net_key_update.net_idx,
|
||||
set->net_key_update.net_key);
|
||||
case ESP_BLE_MESH_MODEL_OP_NET_KEY_DELETE:
|
||||
return bt_mesh_cfg_net_key_delete(&ctx, set->net_key_delete.net_idx);
|
||||
return bt_mesh_cfg_net_key_delete(¶m, set->net_key_delete.net_idx);
|
||||
case ESP_BLE_MESH_MODEL_OP_APP_KEY_UPDATE:
|
||||
return bt_mesh_cfg_app_key_update(&ctx, set->app_key_update.net_idx,
|
||||
return bt_mesh_cfg_app_key_update(¶m, set->app_key_update.net_idx,
|
||||
set->app_key_update.app_idx,
|
||||
set->app_key_update.app_key);
|
||||
case ESP_BLE_MESH_MODEL_OP_APP_KEY_DELETE:
|
||||
return bt_mesh_cfg_app_key_delete(&ctx, set->app_key_delete.net_idx,
|
||||
return bt_mesh_cfg_app_key_delete(¶m, set->app_key_delete.net_idx,
|
||||
set->app_key_delete.app_idx);
|
||||
case ESP_BLE_MESH_MODEL_OP_NODE_IDENTITY_SET:
|
||||
return bt_mesh_cfg_node_identity_set(&ctx, set->node_identity_set.net_idx,
|
||||
return bt_mesh_cfg_node_identity_set(¶m, set->node_identity_set.net_idx,
|
||||
set->node_identity_set.identity);
|
||||
case ESP_BLE_MESH_MODEL_OP_MODEL_APP_UNBIND:
|
||||
return bt_mesh_cfg_mod_app_unbind(&ctx, set->model_app_unbind.element_addr,
|
||||
return bt_mesh_cfg_mod_app_unbind(¶m, set->model_app_unbind.element_addr,
|
||||
set->model_app_unbind.model_app_idx,
|
||||
set->model_app_unbind.model_id,
|
||||
set->model_app_unbind.company_id);
|
||||
case ESP_BLE_MESH_MODEL_OP_KEY_REFRESH_PHASE_SET:
|
||||
return bt_mesh_cfg_kr_phase_set(&ctx, set->kr_phase_set.net_idx,
|
||||
return bt_mesh_cfg_kr_phase_set(¶m, set->kr_phase_set.net_idx,
|
||||
set->kr_phase_set.transition);
|
||||
case ESP_BLE_MESH_MODEL_OP_NETWORK_TRANSMIT_SET:
|
||||
return bt_mesh_cfg_net_transmit_set(&ctx, set->net_transmit_set.net_transmit);
|
||||
return bt_mesh_cfg_net_transmit_set(¶m, set->net_transmit_set.net_transmit);
|
||||
default:
|
||||
BT_ERR("%s, Invalid opcode 0x%x", __func__, params->opcode);
|
||||
BT_ERR("Invalid Configuration Set opcode 0x%04x", param.opcode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,6 @@ void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg)
|
|||
{
|
||||
btc_ble_mesh_config_client_args_t *arg = NULL;
|
||||
esp_ble_mesh_cfg_client_cb_param_t cb = {0};
|
||||
bt_mesh_role_param_t role_param = {0};
|
||||
|
||||
if (!msg || !msg->arg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -635,12 +634,6 @@ void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg)
|
|||
switch (msg->act) {
|
||||
case BTC_BLE_MESH_ACT_CONFIG_CLIENT_GET_STATE: {
|
||||
cb.params = arg->cfg_client_get_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)cb.params->model;
|
||||
role_param.role = cb.params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
cb.error_code = btc_ble_mesh_config_client_get_state(arg->cfg_client_get_state.params,
|
||||
arg->cfg_client_get_state.get_state);
|
||||
if (cb.error_code) {
|
||||
|
@ -650,12 +643,6 @@ void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg)
|
|||
}
|
||||
case BTC_BLE_MESH_ACT_CONFIG_CLIENT_SET_STATE: {
|
||||
cb.params = arg->cfg_client_set_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)cb.params->model;
|
||||
role_param.role = cb.params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
cb.error_code = btc_ble_mesh_config_client_set_state(arg->cfg_client_set_state.params,
|
||||
arg->cfg_client_set_state.set_state);
|
||||
if (cb.error_code) {
|
||||
|
@ -685,7 +672,7 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_CFG_CLIENT_EVT_MAX) {
|
||||
btc_ble_mesh_config_client_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_config_client_free_req_data(msg);
|
||||
|
@ -695,7 +682,7 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg)
|
|||
/* Configuration Server Model related functions */
|
||||
|
||||
static inline void btc_ble_mesh_config_server_cb_to_app(esp_ble_mesh_cfg_server_cb_event_t event,
|
||||
esp_ble_mesh_cfg_server_cb_param_t *param)
|
||||
esp_ble_mesh_cfg_server_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_cfg_server_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_cfg_server_cb_t)btc_profile_cb_get(BTC_PID_CONFIG_SERVER);
|
||||
|
@ -722,13 +709,11 @@ static void btc_ble_mesh_config_server_callback(esp_ble_mesh_cfg_server_cb_param
|
|||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_cfg_server_cb_param_t), NULL);
|
||||
}
|
||||
|
||||
void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_cfg_server_cb_param_t cb_params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (!model || !ctx) {
|
||||
|
@ -741,7 +726,7 @@ void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type,
|
|||
act = ESP_BLE_MESH_CFG_SERVER_STATE_CHANGE_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown config server event type %d", __func__, evt_type);
|
||||
BT_ERR("Unknown Config server event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -753,10 +738,10 @@ void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type,
|
|||
cb_params.ctx.recv_op = ctx->recv_op;
|
||||
cb_params.ctx.recv_dst = ctx->recv_dst;
|
||||
cb_params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
cb_params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value);
|
||||
memcpy(&cb_params.value, val, length);
|
||||
memcpy(&cb_params.value, val, MIN(len, sizeof(cb_params.value)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_config_server_callback(&cb_params, act);
|
||||
|
@ -777,6 +762,6 @@ void btc_ble_mesh_config_server_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_CFG_SERVER_EVT_MAX) {
|
||||
btc_ble_mesh_config_server_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/* Generic Client Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_generic_client_cb_to_app(esp_ble_mesh_generic_client_cb_event_t event,
|
||||
esp_ble_mesh_generic_client_cb_param_t *param)
|
||||
esp_ble_mesh_generic_client_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_generic_client_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_generic_client_cb_t)btc_profile_cb_get(BTC_PID_GENERIC_CLIENT);
|
||||
|
@ -49,7 +49,7 @@ void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, voi
|
|||
memcpy(dst->generic_client_get_state.params, src->generic_client_get_state.params,
|
||||
sizeof(esp_ble_mesh_client_common_param_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
if (src->generic_client_get_state.get_state) {
|
||||
|
@ -58,7 +58,7 @@ void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, voi
|
|||
memcpy(dst->generic_client_get_state.get_state, src->generic_client_get_state.get_state,
|
||||
sizeof(esp_ble_mesh_generic_client_get_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -78,7 +78,7 @@ void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, voi
|
|||
length = src->generic_client_set_state.set_state->user_property_set.property_value->len;
|
||||
dst->generic_client_set_state.set_state->user_property_set.property_value = bt_mesh_alloc_buf(length);
|
||||
if (!dst->generic_client_set_state.set_state->user_property_set.property_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->generic_client_set_state.set_state->user_property_set.property_value,
|
||||
|
@ -91,7 +91,7 @@ void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, voi
|
|||
length = src->generic_client_set_state.set_state->admin_property_set.property_value->len;
|
||||
dst->generic_client_set_state.set_state->admin_property_set.property_value = bt_mesh_alloc_buf(length);
|
||||
if (!dst->generic_client_set_state.set_state->admin_property_set.property_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->generic_client_set_state.set_state->admin_property_set.property_value,
|
||||
|
@ -103,12 +103,12 @@ void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, voi
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_DBG("%s, Unknown deep copy act %d", __func__, msg->act);
|
||||
BT_DBG("%s, Unknown act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
if (p_src_data->params) {
|
||||
p_dest_data->params = bt_mesh_malloc(sizeof(esp_ble_mesh_client_common_param_t));
|
||||
if (!p_dest_data->params) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->status_cb.user_properties_status.property_ids->len;
|
||||
p_dest_data->status_cb.user_properties_status.property_ids = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.user_properties_status.property_ids) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.user_properties_status.property_ids,
|
||||
|
@ -206,7 +206,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->status_cb.user_property_status.property_value->len;
|
||||
p_dest_data->status_cb.user_property_status.property_value = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.user_property_status.property_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.user_property_status.property_value,
|
||||
|
@ -220,7 +220,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->status_cb.admin_properties_status.property_ids->len;
|
||||
p_dest_data->status_cb.admin_properties_status.property_ids = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.admin_properties_status.property_ids) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.admin_properties_status.property_ids,
|
||||
|
@ -235,7 +235,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->status_cb.admin_property_status.property_value->len;
|
||||
p_dest_data->status_cb.admin_property_status.property_value = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.admin_property_status.property_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.admin_property_status.property_value,
|
||||
|
@ -249,7 +249,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->status_cb.manufacturer_properties_status.property_ids->len;
|
||||
p_dest_data->status_cb.manufacturer_properties_status.property_ids = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.manufacturer_properties_status.property_ids) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.manufacturer_properties_status.property_ids,
|
||||
|
@ -264,7 +264,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->status_cb.manufacturer_property_status.property_value->len;
|
||||
p_dest_data->status_cb.manufacturer_property_status.property_value = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.manufacturer_property_status.property_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.manufacturer_property_status.property_value,
|
||||
|
@ -278,7 +278,7 @@ static void btc_ble_mesh_generic_client_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->status_cb.client_properties_status.property_ids->len;
|
||||
p_dest_data->status_cb.client_properties_status.property_ids = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.client_properties_status.property_ids) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.client_properties_status.property_ids,
|
||||
|
@ -374,18 +374,17 @@ static void btc_ble_mesh_generic_client_callback(esp_ble_mesh_generic_client_cb_
|
|||
msg.pid = BTC_PID_GENERIC_CLIENT;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_generic_client_cb_param_t), btc_ble_mesh_generic_client_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_generic_client_cb_param_t),
|
||||
btc_ble_mesh_generic_client_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_generic_client_cb_param_t cb_params = {0};
|
||||
esp_ble_mesh_client_common_param_t params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (!model || !ctx) {
|
||||
|
@ -407,7 +406,7 @@ void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
act = ESP_BLE_MESH_GENERIC_CLIENT_TIMEOUT_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown generic client event type %d", __func__, evt_type);
|
||||
BT_ERR("Unknown Generic client event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -420,31 +419,30 @@ void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
params.ctx.recv_op = ctx->recv_op;
|
||||
params.ctx.recv_dst = ctx->recv_dst;
|
||||
params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
cb_params.error_code = 0;
|
||||
cb_params.params = ¶ms;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.status_cb)) ? len : sizeof(cb_params.status_cb);
|
||||
memcpy(&cb_params.status_cb, val, length);
|
||||
memcpy(&cb_params.status_cb, val, MIN(len, sizeof(cb_params.status_cb)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_generic_client_callback(&cb_params, act);
|
||||
return;
|
||||
}
|
||||
|
||||
void btc_ble_mesh_generic_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
void btc_ble_mesh_generic_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
if (!model || !ctx || !buf) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_generic_client_cb_evt_to_btc(opcode,
|
||||
BTC_BLE_MESH_EVT_GENERIC_CLIENT_PUBLISH, model, ctx, buf->data, buf->len);
|
||||
bt_mesh_generic_client_cb_evt_to_btc(opcode, BTC_BLE_MESH_EVT_GENERIC_CLIENT_PUBLISH,
|
||||
model, ctx, buf->data, buf->len);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -454,7 +452,6 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
|
|||
btc_ble_mesh_generic_client_args_t *arg = NULL;
|
||||
esp_ble_mesh_generic_client_cb_param_t cb = {0};
|
||||
bt_mesh_client_common_param_t common = {0};
|
||||
bt_mesh_role_param_t role_param = {0};
|
||||
|
||||
if (!msg || !msg->arg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -466,12 +463,6 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
|
|||
switch (msg->act) {
|
||||
case BTC_BLE_MESH_ACT_GENERIC_CLIENT_GET_STATE: {
|
||||
params = arg->generic_client_get_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -480,10 +471,10 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->generic_client_get_state.params;
|
||||
cb.error_code = bt_mesh_generic_client_get_state(&common,
|
||||
(void *)arg->generic_client_get_state.get_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_generic_client_get_state(&common, arg->generic_client_get_state.get_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_generic_client_callback(&cb, ESP_BLE_MESH_GENERIC_CLIENT_GET_STATE_EVT);
|
||||
|
@ -492,12 +483,6 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
|
|||
}
|
||||
case BTC_BLE_MESH_ACT_GENERIC_CLIENT_SET_STATE: {
|
||||
params = arg->generic_client_set_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -506,10 +491,10 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->generic_client_set_state.params;
|
||||
cb.error_code = bt_mesh_generic_client_set_state(&common,
|
||||
(void *)arg->generic_client_set_state.set_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_generic_client_set_state(&common, arg->generic_client_set_state.set_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_generic_client_callback(&cb, ESP_BLE_MESH_GENERIC_CLIENT_SET_STATE_EVT);
|
||||
|
@ -538,7 +523,7 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_GENERIC_CLIENT_EVT_MAX) {
|
||||
btc_ble_mesh_generic_client_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_generic_client_free_req_data(msg);
|
||||
|
@ -547,9 +532,8 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg)
|
|||
|
||||
/* Generic Server Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_generic_server_cb_to_app(
|
||||
esp_ble_mesh_generic_server_cb_event_t event,
|
||||
esp_ble_mesh_generic_server_cb_param_t *param)
|
||||
static inline void btc_ble_mesh_generic_server_cb_to_app(esp_ble_mesh_generic_server_cb_event_t event,
|
||||
esp_ble_mesh_generic_server_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_generic_server_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_generic_server_cb_t)btc_profile_cb_get(BTC_PID_GENERIC_SERVER);
|
||||
|
@ -578,7 +562,7 @@ static void btc_ble_mesh_generic_server_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->value.state_change.user_property_set.value->len;
|
||||
p_dest_data->value.state_change.user_property_set.value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.user_property_set.value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.user_property_set.value,
|
||||
|
@ -592,7 +576,7 @@ static void btc_ble_mesh_generic_server_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->value.state_change.admin_property_set.value->len;
|
||||
p_dest_data->value.state_change.admin_property_set.value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.admin_property_set.value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.admin_property_set.value,
|
||||
|
@ -612,7 +596,7 @@ static void btc_ble_mesh_generic_server_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->value.set.user_property.property_value->len;
|
||||
p_dest_data->value.set.user_property.property_value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.set.user_property.property_value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.set.user_property.property_value,
|
||||
|
@ -626,7 +610,7 @@ static void btc_ble_mesh_generic_server_copy_req_data(btc_msg_t *msg, void *p_de
|
|||
length = p_src_data->value.set.admin_property.property_value->len;
|
||||
p_dest_data->value.set.admin_property.property_value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.set.admin_property.property_value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.set.admin_property.property_value,
|
||||
|
@ -703,17 +687,15 @@ static void btc_ble_mesh_generic_server_callback(esp_ble_mesh_generic_server_cb_
|
|||
msg.pid = BTC_PID_GENERIC_SERVER;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_generic_server_cb_param_t), btc_ble_mesh_generic_server_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_generic_server_cb_param_t),
|
||||
btc_ble_mesh_generic_server_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_generic_server_cb_param_t cb_params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (model == NULL || ctx == NULL) {
|
||||
|
@ -732,7 +714,7 @@ void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type,
|
|||
act = ESP_BLE_MESH_GENERIC_SERVER_RECV_SET_MSG_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown Generic Server event type", __func__);
|
||||
BT_ERR("Unknown Generic Server event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -744,10 +726,10 @@ void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type,
|
|||
cb_params.ctx.recv_op = ctx->recv_op;
|
||||
cb_params.ctx.recv_dst = ctx->recv_dst;
|
||||
cb_params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
cb_params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value);
|
||||
memcpy(&cb_params.value, val, length);
|
||||
memcpy(&cb_params.value, val, MIN(len, sizeof(cb_params.value)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_generic_server_callback(&cb_params, act);
|
||||
|
@ -768,7 +750,7 @@ void btc_ble_mesh_generic_server_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_GENERIC_SERVER_EVT_MAX) {
|
||||
btc_ble_mesh_generic_server_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_generic_server_free_req_data(msg);
|
||||
|
|
|
@ -21,12 +21,10 @@
|
|||
#include "health_cli.h"
|
||||
#include "esp_ble_mesh_health_model_api.h"
|
||||
|
||||
extern s32_t health_msg_timeout;
|
||||
|
||||
/* Health Client Model related functions */
|
||||
|
||||
static inline void btc_ble_mesh_health_client_cb_to_app(esp_ble_mesh_health_client_cb_event_t event,
|
||||
esp_ble_mesh_health_client_cb_param_t *param)
|
||||
esp_ble_mesh_health_client_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_health_client_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_health_client_cb_t)btc_profile_cb_get(BTC_PID_HEALTH_CLIENT);
|
||||
|
@ -52,7 +50,7 @@ void btc_ble_mesh_health_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
memcpy(dst->health_client_get_state.params, src->health_client_get_state.params,
|
||||
sizeof(esp_ble_mesh_client_common_param_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
if (src->health_client_get_state.get_state) {
|
||||
|
@ -61,7 +59,7 @@ void btc_ble_mesh_health_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
memcpy(dst->health_client_get_state.get_state, src->health_client_get_state.get_state,
|
||||
sizeof(esp_ble_mesh_health_client_get_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -75,12 +73,12 @@ void btc_ble_mesh_health_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
memcpy(dst->health_client_set_state.set_state, src->health_client_set_state.set_state,
|
||||
sizeof(esp_ble_mesh_health_client_set_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_DBG("%s, Unknown deep copy act %d", __func__, msg->act);
|
||||
BT_DBG("%s, Unknown act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +130,7 @@ static void btc_ble_mesh_health_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
if (p_src_data->params) {
|
||||
p_dest_data->params = bt_mesh_malloc(sizeof(esp_ble_mesh_client_common_param_t));
|
||||
if (!p_dest_data->params) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -150,7 +148,7 @@ static void btc_ble_mesh_health_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.current_status.fault_array->len;
|
||||
p_dest_data->status_cb.current_status.fault_array = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.current_status.fault_array) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.current_status.fault_array,
|
||||
|
@ -166,7 +164,7 @@ static void btc_ble_mesh_health_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.fault_status.fault_array->len;
|
||||
p_dest_data->status_cb.fault_status.fault_array = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.fault_status.fault_array) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.fault_status.fault_array,
|
||||
|
@ -240,18 +238,17 @@ static void btc_ble_mesh_health_client_callback(esp_ble_mesh_health_client_cb_pa
|
|||
msg.pid = BTC_PID_HEALTH_CLIENT;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_health_client_cb_param_t), btc_ble_mesh_health_client_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_health_client_cb_param_t),
|
||||
btc_ble_mesh_health_client_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, u16_t len)
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, u16_t len)
|
||||
{
|
||||
esp_ble_mesh_health_client_cb_param_t cb_params = {0};
|
||||
esp_ble_mesh_client_common_param_t params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (!model || !ctx) {
|
||||
|
@ -273,7 +270,7 @@ void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
act = ESP_BLE_MESH_HEALTH_CLIENT_TIMEOUT_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown health client event type %d", __func__, evt_type);
|
||||
BT_ERR("Unknown Health client event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -286,38 +283,37 @@ void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
params.ctx.recv_op = ctx->recv_op;
|
||||
params.ctx.recv_dst = ctx->recv_dst;
|
||||
params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
cb_params.error_code = 0;
|
||||
cb_params.params = ¶ms;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.status_cb)) ? len : sizeof(cb_params.status_cb);
|
||||
memcpy(&cb_params.status_cb, val, length);
|
||||
memcpy(&cb_params.status_cb, val, MIN(len, sizeof(cb_params.status_cb)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_health_client_callback(&cb_params, act);
|
||||
return;
|
||||
}
|
||||
|
||||
void btc_ble_mesh_health_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
void btc_ble_mesh_health_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
if (!model || !ctx || !buf) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_health_client_cb_evt_to_btc(opcode,
|
||||
BTC_BLE_MESH_EVT_HEALTH_CLIENT_PUBLISH, model, ctx, buf->data, buf->len);
|
||||
bt_mesh_health_client_cb_evt_to_btc(opcode, BTC_BLE_MESH_EVT_HEALTH_CLIENT_PUBLISH,
|
||||
model, ctx, buf->data, buf->len);
|
||||
return;
|
||||
}
|
||||
|
||||
static int btc_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_health_client_get_state_t *get)
|
||||
{
|
||||
struct bt_mesh_msg_ctx ctx = {0};
|
||||
bt_mesh_client_common_param_t param = {0};
|
||||
|
||||
if (params == NULL) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -325,27 +321,29 @@ static int btc_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param
|
|||
}
|
||||
|
||||
if (params->opcode == ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET && get == NULL) {
|
||||
BT_ERR("%s, Invalid health client get", __func__);
|
||||
BT_ERR("Invalid Health Get");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ctx.net_idx = params->ctx.net_idx;
|
||||
ctx.app_idx = params->ctx.app_idx;
|
||||
ctx.addr = params->ctx.addr;
|
||||
ctx.send_rel = params->ctx.send_rel;
|
||||
ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.opcode = params->opcode;
|
||||
param.model = (struct bt_mesh_model *)params->model;
|
||||
param.ctx.net_idx = params->ctx.net_idx;
|
||||
param.ctx.app_idx = params->ctx.app_idx;
|
||||
param.ctx.addr = params->ctx.addr;
|
||||
param.ctx.send_rel = params->ctx.send_rel;
|
||||
param.ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.msg_timeout = params->msg_timeout;
|
||||
param.msg_role = params->msg_role;
|
||||
|
||||
health_msg_timeout = params->msg_timeout;
|
||||
|
||||
switch (params->opcode) {
|
||||
switch (param.opcode) {
|
||||
case ESP_BLE_MESH_MODEL_OP_ATTENTION_GET:
|
||||
return bt_mesh_health_attention_get(&ctx);
|
||||
return bt_mesh_health_attention_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_GET:
|
||||
return bt_mesh_health_period_get(&ctx);
|
||||
return bt_mesh_health_period_get(¶m);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_GET:
|
||||
return bt_mesh_health_fault_get(&ctx, get->fault_get.company_id);
|
||||
return bt_mesh_health_fault_get(¶m, get->fault_get.company_id);
|
||||
default:
|
||||
BT_ERR("%s, Invalid opcode 0x%x", __func__, params->opcode);
|
||||
BT_ERR("Invalid Health Get opcode 0x%04x", param.opcode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -355,40 +353,42 @@ static int btc_ble_mesh_health_client_get_state(esp_ble_mesh_client_common_param
|
|||
static int btc_ble_mesh_health_client_set_state(esp_ble_mesh_client_common_param_t *params,
|
||||
esp_ble_mesh_health_client_set_state_t *set)
|
||||
{
|
||||
struct bt_mesh_msg_ctx ctx = {0};
|
||||
bt_mesh_client_common_param_t param = {0};
|
||||
|
||||
if (params == NULL || set == NULL) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ctx.net_idx = params->ctx.net_idx;
|
||||
ctx.app_idx = params->ctx.app_idx;
|
||||
ctx.addr = params->ctx.addr;
|
||||
ctx.send_rel = params->ctx.send_rel;
|
||||
ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.opcode = params->opcode;
|
||||
param.model = (struct bt_mesh_model *)params->model;
|
||||
param.ctx.net_idx = params->ctx.net_idx;
|
||||
param.ctx.app_idx = params->ctx.app_idx;
|
||||
param.ctx.addr = params->ctx.addr;
|
||||
param.ctx.send_rel = params->ctx.send_rel;
|
||||
param.ctx.send_ttl = params->ctx.send_ttl;
|
||||
param.msg_timeout = params->msg_timeout;
|
||||
param.msg_role = params->msg_role;
|
||||
|
||||
health_msg_timeout = params->msg_timeout;
|
||||
|
||||
switch (params->opcode) {
|
||||
switch (param.opcode) {
|
||||
case ESP_BLE_MESH_MODEL_OP_ATTENTION_SET:
|
||||
return bt_mesh_health_attention_set(&ctx, set->attention_set.attention, true);
|
||||
return bt_mesh_health_attention_set(¶m, set->attention_set.attention, true);
|
||||
case ESP_BLE_MESH_MODEL_OP_ATTENTION_SET_UNACK:
|
||||
return bt_mesh_health_attention_set(&ctx, set->attention_set.attention, false);
|
||||
return bt_mesh_health_attention_set(¶m, set->attention_set.attention, false);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET:
|
||||
return bt_mesh_health_period_set(&ctx, set->period_set.fast_period_divisor, true);
|
||||
return bt_mesh_health_period_set(¶m, set->period_set.fast_period_divisor, true);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_PERIOD_SET_UNACK:
|
||||
return bt_mesh_health_period_set(&ctx, set->period_set.fast_period_divisor, false);
|
||||
return bt_mesh_health_period_set(¶m, set->period_set.fast_period_divisor, false);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST:
|
||||
return bt_mesh_health_fault_test(&ctx, set->fault_test.company_id, set->fault_test.test_id, true);
|
||||
return bt_mesh_health_fault_test(¶m, set->fault_test.company_id, set->fault_test.test_id, true);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_TEST_UNACK:
|
||||
return bt_mesh_health_fault_test(&ctx, set->fault_test.company_id, set->fault_test.test_id, false);
|
||||
return bt_mesh_health_fault_test(¶m, set->fault_test.company_id, set->fault_test.test_id, false);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR:
|
||||
return bt_mesh_health_fault_clear(&ctx, set->fault_clear.company_id, true);
|
||||
return bt_mesh_health_fault_clear(¶m, set->fault_clear.company_id, true);
|
||||
case ESP_BLE_MESH_MODEL_OP_HEALTH_FAULT_CLEAR_UNACK:
|
||||
return bt_mesh_health_fault_clear(&ctx, set->fault_clear.company_id, false);
|
||||
return bt_mesh_health_fault_clear(¶m, set->fault_clear.company_id, false);
|
||||
default:
|
||||
BT_ERR("%s, Invalid opcode 0x%x", __func__, params->opcode);
|
||||
BT_ERR("Invalid Health Set opcode 0x%04x", param.opcode);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,6 @@ void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg)
|
|||
{
|
||||
btc_ble_mesh_health_client_args_t *arg = NULL;
|
||||
esp_ble_mesh_health_client_cb_param_t cb = {0};
|
||||
bt_mesh_role_param_t role_param = {0};
|
||||
|
||||
if (!msg || !msg->arg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -411,12 +410,6 @@ void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg)
|
|||
switch (msg->act) {
|
||||
case BTC_BLE_MESH_ACT_HEALTH_CLIENT_GET_STATE: {
|
||||
cb.params = arg->health_client_get_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)cb.params->model;
|
||||
role_param.role = cb.params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
cb.error_code = btc_ble_mesh_health_client_get_state(arg->health_client_get_state.params,
|
||||
arg->health_client_get_state.get_state);
|
||||
if (cb.error_code) {
|
||||
|
@ -427,12 +420,6 @@ void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg)
|
|||
}
|
||||
case BTC_BLE_MESH_ACT_HEALTH_CLIENT_SET_STATE: {
|
||||
cb.params = arg->health_client_set_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)cb.params->model;
|
||||
role_param.role = cb.params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
cb.error_code = btc_ble_mesh_health_client_set_state(arg->health_client_set_state.params,
|
||||
arg->health_client_set_state.set_state);
|
||||
if (cb.error_code) {
|
||||
|
@ -463,7 +450,7 @@ void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_HEALTH_CLIENT_EVT_MAX) {
|
||||
btc_ble_mesh_health_client_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_health_client_free_req_data(msg);
|
||||
|
@ -473,7 +460,7 @@ void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg)
|
|||
/* Health Server Model related functions */
|
||||
|
||||
static inline void btc_ble_mesh_health_server_cb_to_app(esp_ble_mesh_health_server_cb_event_t event,
|
||||
esp_ble_mesh_health_server_cb_param_t *param)
|
||||
esp_ble_mesh_health_server_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_health_server_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_health_server_cb_t)btc_profile_cb_get(BTC_PID_HEALTH_SERVER);
|
||||
|
@ -557,8 +544,8 @@ static void btc_ble_mesh_health_server_callback(esp_ble_mesh_health_server_cb_pa
|
|||
msg.pid = BTC_PID_HEALTH_SERVER;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_health_server_cb_param_t), btc_ble_mesh_health_server_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_health_server_cb_param_t),
|
||||
btc_ble_mesh_health_server_copy_req_data);
|
||||
}
|
||||
|
||||
void btc_ble_mesh_health_server_call_handler(btc_msg_t *msg)
|
||||
|
@ -602,7 +589,7 @@ void btc_ble_mesh_health_server_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_HEALTH_SERVER_EVT_MAX) {
|
||||
btc_ble_mesh_health_server_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_health_server_free_req_data(msg);
|
||||
|
@ -619,7 +606,8 @@ void btc_ble_mesh_health_server_fault_clear(struct bt_mesh_model *model, u16_t c
|
|||
btc_ble_mesh_health_server_callback(¶m, ESP_BLE_MESH_HEALTH_SERVER_FAULT_CLEAR_EVT);
|
||||
}
|
||||
|
||||
void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model, u8_t test_id, u16_t company_id)
|
||||
void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model,
|
||||
u8_t test_id, u16_t company_id)
|
||||
{
|
||||
esp_ble_mesh_health_server_cb_param_t param = {0};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/* Lighting Client Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_lighting_client_cb_to_app(esp_ble_mesh_light_client_cb_event_t event,
|
||||
esp_ble_mesh_light_client_cb_param_t *param)
|
||||
esp_ble_mesh_light_client_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_light_client_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_light_client_cb_t)btc_profile_cb_get(BTC_PID_LIGHTING_CLIENT);
|
||||
|
@ -48,7 +48,7 @@ void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, vo
|
|||
memcpy(dst->light_client_get_state.params, src->light_client_get_state.params,
|
||||
sizeof(esp_ble_mesh_client_common_param_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
if (src->light_client_get_state.get_state) {
|
||||
|
@ -57,7 +57,7 @@ void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, vo
|
|||
memcpy(dst->light_client_get_state.get_state, src->light_client_get_state.get_state,
|
||||
sizeof(esp_ble_mesh_light_client_get_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -71,12 +71,12 @@ void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, vo
|
|||
memcpy(dst->light_client_set_state.set_state, src->light_client_set_state.set_state,
|
||||
sizeof(esp_ble_mesh_light_client_set_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_DBG("%s, Unknown deep copy act %d", __func__, msg->act);
|
||||
BT_DBG("%s, Unknown act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ static void btc_ble_mesh_lighting_client_copy_req_data(btc_msg_t *msg, void *p_d
|
|||
if (p_src_data->params) {
|
||||
p_dest_data->params = bt_mesh_malloc(sizeof(esp_ble_mesh_client_common_param_t));
|
||||
if (!p_dest_data->params) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ static void btc_ble_mesh_lighting_client_copy_req_data(btc_msg_t *msg, void *p_d
|
|||
length = p_src_data->status_cb.lc_property_status.property_value->len;
|
||||
p_dest_data->status_cb.lc_property_status.property_value = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.lc_property_status.property_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.lc_property_status.property_value,
|
||||
|
@ -218,18 +218,17 @@ static void btc_ble_mesh_lighting_client_callback(esp_ble_mesh_light_client_cb_p
|
|||
msg.pid = BTC_PID_LIGHTING_CLIENT;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_light_client_cb_param_t), btc_ble_mesh_lighting_client_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_light_client_cb_param_t),
|
||||
btc_ble_mesh_lighting_client_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_light_client_cb_param_t cb_params = {0};
|
||||
esp_ble_mesh_client_common_param_t params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (!model || !ctx) {
|
||||
|
@ -251,7 +250,7 @@ void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
act = ESP_BLE_MESH_LIGHT_CLIENT_TIMEOUT_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown lighting client event type", __func__);
|
||||
BT_ERR("Unknown Lighting client event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -264,31 +263,30 @@ void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
params.ctx.recv_op = ctx->recv_op;
|
||||
params.ctx.recv_dst = ctx->recv_dst;
|
||||
params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
cb_params.error_code = 0;
|
||||
cb_params.params = ¶ms;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.status_cb)) ? len : sizeof(cb_params.status_cb);
|
||||
memcpy(&cb_params.status_cb, val, length);
|
||||
memcpy(&cb_params.status_cb, val, MIN(len, sizeof(cb_params.status_cb)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_lighting_client_callback(&cb_params, act);
|
||||
return;
|
||||
}
|
||||
|
||||
void btc_ble_mesh_lighting_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
void btc_ble_mesh_lighting_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
if (!model || !ctx || !buf) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_lighting_client_cb_evt_to_btc(opcode,
|
||||
BTC_BLE_MESH_EVT_LIGHTING_CLIENT_PUBLISH, model, ctx, buf->data, buf->len);
|
||||
bt_mesh_lighting_client_cb_evt_to_btc(opcode, BTC_BLE_MESH_EVT_LIGHTING_CLIENT_PUBLISH,
|
||||
model, ctx, buf->data, buf->len);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -298,7 +296,6 @@ void btc_ble_mesh_lighting_client_call_handler(btc_msg_t *msg)
|
|||
btc_ble_mesh_lighting_client_args_t *arg = NULL;
|
||||
esp_ble_mesh_light_client_cb_param_t cb = {0};
|
||||
bt_mesh_client_common_param_t common = {0};
|
||||
bt_mesh_role_param_t role_param = {0};
|
||||
|
||||
if (!msg || !msg->arg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -310,12 +307,6 @@ void btc_ble_mesh_lighting_client_call_handler(btc_msg_t *msg)
|
|||
switch (msg->act) {
|
||||
case BTC_BLE_MESH_ACT_LIGHTING_CLIENT_GET_STATE: {
|
||||
params = arg->light_client_get_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -324,10 +315,10 @@ void btc_ble_mesh_lighting_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->light_client_get_state.params;
|
||||
cb.error_code = bt_mesh_light_client_get_state(&common,
|
||||
(void *)arg->light_client_get_state.get_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_light_client_get_state(&common, arg->light_client_get_state.get_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_lighting_client_callback(&cb, ESP_BLE_MESH_LIGHT_CLIENT_GET_STATE_EVT);
|
||||
|
@ -336,12 +327,6 @@ void btc_ble_mesh_lighting_client_call_handler(btc_msg_t *msg)
|
|||
}
|
||||
case BTC_BLE_MESH_ACT_LIGHTING_CLIENT_SET_STATE: {
|
||||
params = arg->light_client_set_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -350,10 +335,10 @@ void btc_ble_mesh_lighting_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->light_client_set_state.params;
|
||||
cb.error_code = bt_mesh_light_client_set_state(&common,
|
||||
(void *)arg->light_client_set_state.set_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_light_client_set_state(&common, arg->light_client_set_state.set_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_lighting_client_callback(&cb, ESP_BLE_MESH_LIGHT_CLIENT_SET_STATE_EVT);
|
||||
|
@ -382,7 +367,7 @@ void btc_ble_mesh_lighting_client_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_LIGHT_CLIENT_EVT_MAX) {
|
||||
btc_ble_mesh_lighting_client_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_lighting_client_free_req_data(msg);
|
||||
|
@ -391,9 +376,8 @@ void btc_ble_mesh_lighting_client_cb_handler(btc_msg_t *msg)
|
|||
|
||||
/* Lighting Server Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_lighting_server_cb_to_app(
|
||||
esp_ble_mesh_lighting_server_cb_event_t event,
|
||||
esp_ble_mesh_lighting_server_cb_param_t *param)
|
||||
static inline void btc_ble_mesh_lighting_server_cb_to_app(esp_ble_mesh_lighting_server_cb_event_t event,
|
||||
esp_ble_mesh_lighting_server_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_lighting_server_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_lighting_server_cb_t)btc_profile_cb_get(BTC_PID_LIGHTING_SERVER);
|
||||
|
@ -421,7 +405,7 @@ static void btc_ble_mesh_lighting_server_copy_req_data(btc_msg_t *msg, void *p_d
|
|||
length = p_src_data->value.state_change.lc_property_set.property_value->len;
|
||||
p_dest_data->value.state_change.lc_property_set.property_value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.lc_property_set.property_value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.lc_property_set.property_value,
|
||||
|
@ -437,7 +421,7 @@ static void btc_ble_mesh_lighting_server_copy_req_data(btc_msg_t *msg, void *p_d
|
|||
length = p_src_data->value.set.lc_property.property_value->len;
|
||||
p_dest_data->value.set.lc_property.property_value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.set.lc_property.property_value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.set.lc_property.property_value,
|
||||
|
@ -452,7 +436,7 @@ static void btc_ble_mesh_lighting_server_copy_req_data(btc_msg_t *msg, void *p_d
|
|||
length = p_src_data->value.status.sensor_status.data->len;
|
||||
p_dest_data->value.status.sensor_status.data = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.status.sensor_status.data == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.status.sensor_status.data,
|
||||
|
@ -515,17 +499,15 @@ static void btc_ble_mesh_lighting_server_callback(esp_ble_mesh_lighting_server_c
|
|||
msg.pid = BTC_PID_LIGHTING_SERVER;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(
|
||||
&msg, cb_params, sizeof(esp_ble_mesh_lighting_server_cb_param_t), btc_ble_mesh_lighting_server_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_lighting_server_cb_param_t),
|
||||
btc_ble_mesh_lighting_server_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_lighting_server_cb_param_t cb_params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (model == NULL || ctx == NULL) {
|
||||
|
@ -547,7 +529,7 @@ void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type,
|
|||
act = ESP_BLE_MESH_LIGHTING_SERVER_RECV_STATUS_MSG_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown Lighting Server event type", __func__);
|
||||
BT_ERR("Unknown Lighting server event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -559,10 +541,10 @@ void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type,
|
|||
cb_params.ctx.recv_op = ctx->recv_op;
|
||||
cb_params.ctx.recv_dst = ctx->recv_dst;
|
||||
cb_params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
cb_params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value);
|
||||
memcpy(&cb_params.value, val, length);
|
||||
memcpy(&cb_params.value, val, MIN(len, sizeof(cb_params.value)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_lighting_server_callback(&cb_params, act);
|
||||
|
@ -583,7 +565,7 @@ void btc_ble_mesh_lighting_server_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_LIGHTING_SERVER_EVT_MAX) {
|
||||
btc_ble_mesh_lighting_server_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_lighting_server_free_req_data(msg);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -22,7 +22,7 @@
|
|||
/* Sensor Client Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_sensor_client_cb_to_app(esp_ble_mesh_sensor_client_cb_event_t event,
|
||||
esp_ble_mesh_sensor_client_cb_param_t *param)
|
||||
esp_ble_mesh_sensor_client_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_sensor_client_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_sensor_client_cb_t)btc_profile_cb_get(BTC_PID_SENSOR_CLIENT);
|
||||
|
@ -58,7 +58,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_get_state.get_state->column_get.raw_value_x->len;
|
||||
dst->sensor_client_get_state.get_state->column_get.raw_value_x = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_get_state.get_state->column_get.raw_value_x) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_get_state.get_state->column_get.raw_value_x,
|
||||
|
@ -71,7 +71,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_get_state.get_state->series_get.raw_value_x1->len;
|
||||
dst->sensor_client_get_state.get_state->series_get.raw_value_x1 = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_get_state.get_state->series_get.raw_value_x1) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_get_state.get_state->series_get.raw_value_x1,
|
||||
|
@ -82,7 +82,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_get_state.get_state->series_get.raw_value_x2->len;
|
||||
dst->sensor_client_get_state.get_state->series_get.raw_value_x2 = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_get_state.get_state->series_get.raw_value_x2) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_get_state.get_state->series_get.raw_value_x2,
|
||||
|
@ -94,7 +94,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_down->len;
|
||||
dst->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_down = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_down) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_down,
|
||||
|
@ -124,7 +124,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_up->len;
|
||||
dst->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_up = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_up) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_set_state.set_state->cadence_set.status_trigger_delta_up,
|
||||
|
@ -135,7 +135,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_set_state.set_state->cadence_set.fast_cadence_low->len;
|
||||
dst->sensor_client_set_state.set_state->cadence_set.fast_cadence_low = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_set_state.set_state->cadence_set.fast_cadence_low) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_set_state.set_state->cadence_set.fast_cadence_low,
|
||||
|
@ -146,7 +146,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_set_state.set_state->cadence_set.fast_cadence_high->len;
|
||||
dst->sensor_client_set_state.set_state->cadence_set.fast_cadence_high = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_set_state.set_state->cadence_set.fast_cadence_high) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_set_state.set_state->cadence_set.fast_cadence_high,
|
||||
|
@ -159,7 +159,7 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
length = src->sensor_client_set_state.set_state->setting_set.sensor_setting_raw->len;
|
||||
dst->sensor_client_set_state.set_state->setting_set.sensor_setting_raw = bt_mesh_alloc_buf(length);
|
||||
if (!dst->sensor_client_set_state.set_state->setting_set.sensor_setting_raw) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(dst->sensor_client_set_state.set_state->setting_set.sensor_setting_raw,
|
||||
|
@ -171,12 +171,12 @@ void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_DBG("%s, Unknown deep copy act %d", __func__, msg->act);
|
||||
BT_DBG("%s, Unknown act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
if (p_src_data->params) {
|
||||
p_dest_data->params = bt_mesh_malloc(sizeof(esp_ble_mesh_client_common_param_t));
|
||||
if (!p_dest_data->params) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.descriptor_status.descriptor->len;
|
||||
p_dest_data->status_cb.descriptor_status.descriptor = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.descriptor_status.descriptor) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.descriptor_status.descriptor,
|
||||
|
@ -290,7 +290,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.cadence_status.sensor_cadence_value->len;
|
||||
p_dest_data->status_cb.cadence_status.sensor_cadence_value = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.cadence_status.sensor_cadence_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.cadence_status.sensor_cadence_value,
|
||||
|
@ -304,7 +304,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.settings_status.sensor_setting_property_ids->len;
|
||||
p_dest_data->status_cb.settings_status.sensor_setting_property_ids = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.settings_status.sensor_setting_property_ids) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.settings_status.sensor_setting_property_ids,
|
||||
|
@ -319,7 +319,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.setting_status.sensor_setting_raw->len;
|
||||
p_dest_data->status_cb.setting_status.sensor_setting_raw = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.setting_status.sensor_setting_raw) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.setting_status.sensor_setting_raw,
|
||||
|
@ -333,7 +333,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.sensor_status.marshalled_sensor_data->len;
|
||||
p_dest_data->status_cb.sensor_status.marshalled_sensor_data = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.sensor_status.marshalled_sensor_data) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.sensor_status.marshalled_sensor_data,
|
||||
|
@ -347,7 +347,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.column_status.sensor_column_value->len;
|
||||
p_dest_data->status_cb.column_status.sensor_column_value = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.column_status.sensor_column_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.column_status.sensor_column_value,
|
||||
|
@ -361,7 +361,7 @@ static void btc_ble_mesh_sensor_client_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->status_cb.series_status.sensor_series_value->len;
|
||||
p_dest_data->status_cb.series_status.sensor_series_value = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.series_status.sensor_series_value) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.series_status.sensor_series_value,
|
||||
|
@ -456,18 +456,17 @@ static void btc_ble_mesh_sensor_client_callback(esp_ble_mesh_sensor_client_cb_pa
|
|||
msg.pid = BTC_PID_SENSOR_CLIENT;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_sensor_client_cb_param_t), btc_ble_mesh_sensor_client_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_sensor_client_cb_param_t),
|
||||
btc_ble_mesh_sensor_client_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_sensor_client_cb_param_t cb_params = {0};
|
||||
esp_ble_mesh_client_common_param_t params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (!model || !ctx) {
|
||||
|
@ -489,7 +488,7 @@ void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
act = ESP_BLE_MESH_SENSOR_CLIENT_TIMEOUT_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown sensor client event type %d", __func__, evt_type);
|
||||
BT_ERR("Unknown Sensor client event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -502,31 +501,30 @@ void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
params.ctx.recv_op = ctx->recv_op;
|
||||
params.ctx.recv_dst = ctx->recv_dst;
|
||||
params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
cb_params.error_code = 0;
|
||||
cb_params.params = ¶ms;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.status_cb)) ? len : sizeof(cb_params.status_cb);
|
||||
memcpy(&cb_params.status_cb, val, length);
|
||||
memcpy(&cb_params.status_cb, val, MIN(len, sizeof(cb_params.status_cb)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_sensor_client_callback(&cb_params, act);
|
||||
return;
|
||||
}
|
||||
|
||||
void btc_ble_mesh_sensor_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
void btc_ble_mesh_sensor_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
if (!model || !ctx || !buf) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_sensor_client_cb_evt_to_btc(opcode,
|
||||
BTC_BLE_MESH_EVT_SENSOR_CLIENT_PUBLISH, model, ctx, buf->data, buf->len);
|
||||
bt_mesh_sensor_client_cb_evt_to_btc(opcode, BTC_BLE_MESH_EVT_SENSOR_CLIENT_PUBLISH,
|
||||
model, ctx, buf->data, buf->len);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -536,7 +534,6 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
|
|||
btc_ble_mesh_sensor_client_args_t *arg = NULL;
|
||||
esp_ble_mesh_sensor_client_cb_param_t cb = {0};
|
||||
bt_mesh_client_common_param_t common = {0};
|
||||
bt_mesh_role_param_t role_param = {0};
|
||||
|
||||
if (!msg || !msg->arg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -548,12 +545,6 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
|
|||
switch (msg->act) {
|
||||
case BTC_BLE_MESH_ACT_SENSOR_CLIENT_GET_STATE: {
|
||||
params = arg->sensor_client_get_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -562,10 +553,10 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->sensor_client_get_state.params;
|
||||
cb.error_code = bt_mesh_sensor_client_get_state(&common,
|
||||
(void *)arg->sensor_client_get_state.get_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_sensor_client_get_state(&common, arg->sensor_client_get_state.get_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_sensor_client_callback(&cb, ESP_BLE_MESH_SENSOR_CLIENT_GET_STATE_EVT);
|
||||
|
@ -574,12 +565,6 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
|
|||
}
|
||||
case BTC_BLE_MESH_ACT_SENSOR_CLIENT_SET_STATE: {
|
||||
params = arg->sensor_client_set_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -588,10 +573,10 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->sensor_client_set_state.params;
|
||||
cb.error_code = bt_mesh_sensor_client_set_state(&common,
|
||||
(void *)arg->sensor_client_set_state.set_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_sensor_client_set_state(&common, arg->sensor_client_set_state.set_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_sensor_client_callback(&cb, ESP_BLE_MESH_SENSOR_CLIENT_SET_STATE_EVT);
|
||||
|
@ -620,7 +605,7 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_SENSOR_CLIENT_EVT_MAX) {
|
||||
btc_ble_mesh_sensor_client_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_sensor_client_free_req_data(msg);
|
||||
|
@ -629,9 +614,8 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg)
|
|||
|
||||
/* Sensor Server Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_sensor_server_cb_to_app(
|
||||
esp_ble_mesh_sensor_server_cb_event_t event,
|
||||
esp_ble_mesh_sensor_server_cb_param_t *param)
|
||||
static inline void btc_ble_mesh_sensor_server_cb_to_app(esp_ble_mesh_sensor_server_cb_event_t event,
|
||||
esp_ble_mesh_sensor_server_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_sensor_server_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_sensor_server_cb_t)btc_profile_cb_get(BTC_PID_SENSOR_SERVER);
|
||||
|
@ -659,7 +643,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.state_change.sensor_cadence_set.trigger_delta_down->len;
|
||||
p_dest_data->value.state_change.sensor_cadence_set.trigger_delta_down = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.sensor_cadence_set.trigger_delta_down == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.sensor_cadence_set.trigger_delta_down,
|
||||
|
@ -670,7 +654,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.state_change.sensor_cadence_set.trigger_delta_up->len;
|
||||
p_dest_data->value.state_change.sensor_cadence_set.trigger_delta_up = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.sensor_cadence_set.trigger_delta_up == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.sensor_cadence_set.trigger_delta_up,
|
||||
|
@ -681,7 +665,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.state_change.sensor_cadence_set.fast_cadence_low->len;
|
||||
p_dest_data->value.state_change.sensor_cadence_set.fast_cadence_low = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.sensor_cadence_set.fast_cadence_low == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.sensor_cadence_set.fast_cadence_low,
|
||||
|
@ -692,7 +676,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.state_change.sensor_cadence_set.fast_cadence_high->len;
|
||||
p_dest_data->value.state_change.sensor_cadence_set.fast_cadence_high = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.sensor_cadence_set.fast_cadence_high == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.sensor_cadence_set.fast_cadence_high,
|
||||
|
@ -705,7 +689,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.state_change.sensor_setting_set.setting_value->len;
|
||||
p_dest_data->value.state_change.sensor_setting_set.setting_value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.state_change.sensor_setting_set.setting_value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.state_change.sensor_setting_set.setting_value,
|
||||
|
@ -720,7 +704,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.get.sensor_column.raw_value_x->len;
|
||||
p_dest_data->value.get.sensor_column.raw_value_x = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.get.sensor_column.raw_value_x == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.get.sensor_column.raw_value_x,
|
||||
|
@ -732,7 +716,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.get.sensor_series.raw_value->len;
|
||||
p_dest_data->value.get.sensor_series.raw_value = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.get.sensor_series.raw_value == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.get.sensor_series.raw_value,
|
||||
|
@ -748,7 +732,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.set.sensor_cadence.cadence->len;
|
||||
p_dest_data->value.set.sensor_cadence.cadence = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.set.sensor_cadence.cadence == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.set.sensor_cadence.cadence,
|
||||
|
@ -761,7 +745,7 @@ static void btc_ble_mesh_sensor_server_copy_req_data(btc_msg_t *msg, void *p_des
|
|||
length = p_src_data->value.set.sensor_setting.setting_raw->len;
|
||||
p_dest_data->value.set.sensor_setting.setting_raw = bt_mesh_alloc_buf(length);
|
||||
if (p_dest_data->value.set.sensor_setting.setting_raw == NULL) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->value.set.sensor_setting.setting_raw,
|
||||
|
@ -835,17 +819,15 @@ static void btc_ble_mesh_sensor_server_callback(esp_ble_mesh_sensor_server_cb_pa
|
|||
msg.pid = BTC_PID_SENSOR_SERVER;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(
|
||||
&msg, cb_params, sizeof(esp_ble_mesh_sensor_server_cb_param_t), btc_ble_mesh_sensor_server_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_sensor_server_cb_param_t),
|
||||
btc_ble_mesh_sensor_server_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_sensor_server_cb_param_t cb_params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (model == NULL || ctx == NULL) {
|
||||
|
@ -864,7 +846,7 @@ void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type,
|
|||
act = ESP_BLE_MESH_SENSOR_SERVER_RECV_SET_MSG_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown Sensor Server event type", __func__);
|
||||
BT_ERR("Unknown Sensor server event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -876,10 +858,10 @@ void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type,
|
|||
cb_params.ctx.recv_op = ctx->recv_op;
|
||||
cb_params.ctx.recv_dst = ctx->recv_dst;
|
||||
cb_params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
cb_params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value);
|
||||
memcpy(&cb_params.value, val, length);
|
||||
memcpy(&cb_params.value, val, MIN(len, sizeof(cb_params.value)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_sensor_server_callback(&cb_params, act);
|
||||
|
@ -900,7 +882,7 @@ void btc_ble_mesh_sensor_server_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_SENSOR_SERVER_EVT_MAX) {
|
||||
btc_ble_mesh_sensor_server_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_sensor_server_free_req_data(msg);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/* Time and Scenes Client Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_time_scene_client_cb_to_app(esp_ble_mesh_time_scene_client_cb_event_t event,
|
||||
esp_ble_mesh_time_scene_client_cb_param_t *param)
|
||||
esp_ble_mesh_time_scene_client_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_time_scene_client_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_time_scene_client_cb_t)btc_profile_cb_get(BTC_PID_TIME_SCENE_CLIENT);
|
||||
|
@ -48,7 +48,7 @@ void btc_ble_mesh_time_scene_client_arg_deep_copy(btc_msg_t *msg, void *p_dest,
|
|||
memcpy(dst->time_scene_client_get_state.params, src->time_scene_client_get_state.params,
|
||||
sizeof(esp_ble_mesh_client_common_param_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
if (src->time_scene_client_get_state.get_state) {
|
||||
|
@ -57,7 +57,7 @@ void btc_ble_mesh_time_scene_client_arg_deep_copy(btc_msg_t *msg, void *p_dest,
|
|||
memcpy(dst->time_scene_client_get_state.get_state, src->time_scene_client_get_state.get_state,
|
||||
sizeof(esp_ble_mesh_time_scene_client_get_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -71,12 +71,12 @@ void btc_ble_mesh_time_scene_client_arg_deep_copy(btc_msg_t *msg, void *p_dest,
|
|||
memcpy(dst->time_scene_client_set_state.set_state, src->time_scene_client_set_state.set_state,
|
||||
sizeof(esp_ble_mesh_time_scene_client_set_state_t));
|
||||
} else {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_DBG("%s, Unknown deep copy act %d", __func__, msg->act);
|
||||
BT_DBG("%s, Unknown act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ static void btc_ble_mesh_time_scene_client_copy_req_data(btc_msg_t *msg, void *p
|
|||
if (p_src_data->params) {
|
||||
p_dest_data->params = bt_mesh_malloc(sizeof(esp_ble_mesh_client_common_param_t));
|
||||
if (!p_dest_data->params) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ static void btc_ble_mesh_time_scene_client_copy_req_data(btc_msg_t *msg, void *p
|
|||
length = p_src_data->status_cb.scene_register_status.scenes->len;
|
||||
p_dest_data->status_cb.scene_register_status.scenes = bt_mesh_alloc_buf(length);
|
||||
if (!p_dest_data->status_cb.scene_register_status.scenes) {
|
||||
BT_ERR("%s, Failed to allocate memory, act %d", __func__, msg->act);
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
return;
|
||||
}
|
||||
net_buf_simple_add_mem(p_dest_data->status_cb.scene_register_status.scenes,
|
||||
|
@ -220,18 +220,17 @@ static void btc_ble_mesh_time_scene_client_callback(esp_ble_mesh_time_scene_clie
|
|||
msg.pid = BTC_PID_TIME_SCENE_CLIENT;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(&msg, cb_params,
|
||||
sizeof(esp_ble_mesh_time_scene_client_cb_param_t), btc_ble_mesh_time_scene_client_copy_req_data);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_time_scene_client_cb_param_t),
|
||||
btc_ble_mesh_time_scene_client_copy_req_data);
|
||||
}
|
||||
|
||||
void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_time_scene_client_cb_param_t cb_params = {0};
|
||||
esp_ble_mesh_client_common_param_t params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (!model || !ctx) {
|
||||
|
@ -253,7 +252,7 @@ void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
act = ESP_BLE_MESH_TIME_SCENE_CLIENT_TIMEOUT_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown time scene client event type %d", __func__, evt_type);
|
||||
BT_ERR("Unknown Time Scene client event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -266,31 +265,30 @@ void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
|||
params.ctx.recv_op = ctx->recv_op;
|
||||
params.ctx.recv_dst = ctx->recv_dst;
|
||||
params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
cb_params.error_code = 0;
|
||||
cb_params.params = ¶ms;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.status_cb)) ? len : sizeof(cb_params.status_cb);
|
||||
memcpy(&cb_params.status_cb, val, length);
|
||||
memcpy(&cb_params.status_cb, val, MIN(len, sizeof(cb_params.status_cb)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_time_scene_client_callback(&cb_params, act);
|
||||
return;
|
||||
}
|
||||
|
||||
void btc_ble_mesh_time_scene_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
void btc_ble_mesh_time_scene_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
if (!model || !ctx || !buf) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_time_scene_client_cb_evt_to_btc(opcode,
|
||||
BTC_BLE_MESH_EVT_TIME_SCENE_CLIENT_PUBLISH, model, ctx, buf->data, buf->len);
|
||||
bt_mesh_time_scene_client_cb_evt_to_btc(opcode, BTC_BLE_MESH_EVT_TIME_SCENE_CLIENT_PUBLISH,
|
||||
model, ctx, buf->data, buf->len);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -300,7 +298,6 @@ void btc_ble_mesh_time_scene_client_call_handler(btc_msg_t *msg)
|
|||
esp_ble_mesh_client_common_param_t *params = NULL;
|
||||
esp_ble_mesh_time_scene_client_cb_param_t cb = {0};
|
||||
bt_mesh_client_common_param_t common = {0};
|
||||
bt_mesh_role_param_t role_param = {0};
|
||||
|
||||
if (!msg || !msg->arg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
|
@ -312,12 +309,6 @@ void btc_ble_mesh_time_scene_client_call_handler(btc_msg_t *msg)
|
|||
switch (msg->act) {
|
||||
case BTC_BLE_MESH_ACT_TIME_SCENE_CLIENT_GET_STATE: {
|
||||
params = arg->time_scene_client_get_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -326,10 +317,10 @@ void btc_ble_mesh_time_scene_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->time_scene_client_get_state.params;
|
||||
cb.error_code = bt_mesh_time_scene_client_get_state(&common,
|
||||
(void *)arg->time_scene_client_get_state.get_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_time_scene_client_get_state(&common, arg->time_scene_client_get_state.get_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_time_scene_client_callback(&cb, ESP_BLE_MESH_TIME_SCENE_CLIENT_GET_STATE_EVT);
|
||||
|
@ -338,12 +329,6 @@ void btc_ble_mesh_time_scene_client_call_handler(btc_msg_t *msg)
|
|||
}
|
||||
case BTC_BLE_MESH_ACT_TIME_SCENE_CLIENT_SET_STATE: {
|
||||
params = arg->time_scene_client_set_state.params;
|
||||
role_param.model = (struct bt_mesh_model *)params->model;
|
||||
role_param.role = params->msg_role;
|
||||
if (bt_mesh_set_client_model_role(&role_param)) {
|
||||
BT_ERR("%s, Failed to set model role", __func__);
|
||||
break;
|
||||
}
|
||||
common.opcode = params->opcode;
|
||||
common.model = (struct bt_mesh_model *)params->model;
|
||||
common.ctx.net_idx = params->ctx.net_idx;
|
||||
|
@ -352,10 +337,10 @@ void btc_ble_mesh_time_scene_client_call_handler(btc_msg_t *msg)
|
|||
common.ctx.send_rel = params->ctx.send_rel;
|
||||
common.ctx.send_ttl = params->ctx.send_ttl;
|
||||
common.msg_timeout = params->msg_timeout;
|
||||
common.msg_role = params->msg_role;
|
||||
|
||||
cb.params = arg->time_scene_client_set_state.params;
|
||||
cb.error_code = bt_mesh_time_scene_client_set_state(&common,
|
||||
(void *)arg->time_scene_client_set_state.set_state, (void *)&cb.status_cb);
|
||||
cb.error_code = bt_mesh_time_scene_client_set_state(&common, arg->time_scene_client_set_state.set_state);
|
||||
if (cb.error_code) {
|
||||
/* If send failed, callback error_code to app layer immediately */
|
||||
btc_ble_mesh_time_scene_client_callback(&cb, ESP_BLE_MESH_TIME_SCENE_CLIENT_SET_STATE_EVT);
|
||||
|
@ -384,7 +369,7 @@ void btc_ble_mesh_time_scene_client_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_TIME_SCENE_CLIENT_EVT_MAX) {
|
||||
btc_ble_mesh_time_scene_client_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_ble_mesh_time_scene_client_free_req_data(msg);
|
||||
|
@ -393,9 +378,8 @@ void btc_ble_mesh_time_scene_client_cb_handler(btc_msg_t *msg)
|
|||
|
||||
/* Time and Scenes Server Models related functions */
|
||||
|
||||
static inline void btc_ble_mesh_time_scene_server_cb_to_app(
|
||||
esp_ble_mesh_time_scene_server_cb_event_t event,
|
||||
esp_ble_mesh_time_scene_server_cb_param_t *param)
|
||||
static inline void btc_ble_mesh_time_scene_server_cb_to_app(esp_ble_mesh_time_scene_server_cb_event_t event,
|
||||
esp_ble_mesh_time_scene_server_cb_param_t *param)
|
||||
{
|
||||
esp_ble_mesh_time_scene_server_cb_t btc_ble_mesh_cb =
|
||||
(esp_ble_mesh_time_scene_server_cb_t)btc_profile_cb_get(BTC_PID_TIME_SCENE_SERVER);
|
||||
|
@ -419,17 +403,14 @@ static void btc_ble_mesh_time_scene_server_callback(esp_ble_mesh_time_scene_serv
|
|||
msg.pid = BTC_PID_TIME_SCENE_SERVER;
|
||||
msg.act = act;
|
||||
|
||||
btc_transfer_context(
|
||||
&msg, cb_params, sizeof(esp_ble_mesh_time_scene_server_cb_param_t), NULL);
|
||||
btc_transfer_context(&msg, cb_params, sizeof(esp_ble_mesh_time_scene_server_cb_param_t), NULL);
|
||||
}
|
||||
|
||||
void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len)
|
||||
{
|
||||
esp_ble_mesh_time_scene_server_cb_param_t cb_params = {0};
|
||||
size_t length = 0U;
|
||||
uint8_t act = 0U;
|
||||
|
||||
if (model == NULL || ctx == NULL) {
|
||||
|
@ -451,7 +432,7 @@ void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type,
|
|||
act = ESP_BLE_MESH_TIME_SCENE_SERVER_RECV_STATUS_MSG_EVT;
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown Time Scene Server event type", __func__);
|
||||
BT_ERR("Unknown Time Scene server event type %d", evt_type);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -463,10 +444,10 @@ void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type,
|
|||
cb_params.ctx.recv_op = ctx->recv_op;
|
||||
cb_params.ctx.recv_dst = ctx->recv_dst;
|
||||
cb_params.ctx.recv_rssi = ctx->recv_rssi;
|
||||
cb_params.ctx.send_ttl = ctx->send_ttl;
|
||||
|
||||
if (val && len) {
|
||||
length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value);
|
||||
memcpy(&cb_params.value, val, length);
|
||||
memcpy(&cb_params.value, val, MIN(len, sizeof(cb_params.value)));
|
||||
}
|
||||
|
||||
btc_ble_mesh_time_scene_server_callback(&cb_params, act);
|
||||
|
@ -487,7 +468,7 @@ void btc_ble_mesh_time_scene_server_cb_handler(btc_msg_t *msg)
|
|||
if (msg->act < ESP_BLE_MESH_TIME_SCENE_SERVER_EVT_MAX) {
|
||||
btc_ble_mesh_time_scene_server_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BT_ERR("%s, Unknown msg->act = %d", __func__, msg->act);
|
||||
BT_ERR("%s, Unknown act %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -53,15 +53,14 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg);
|
|||
|
||||
void btc_ble_mesh_config_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
void btc_ble_mesh_config_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
void btc_ble_mesh_config_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
void btc_ble_mesh_config_server_cb_handler(btc_msg_t *msg);
|
||||
|
||||
|
@ -70,10 +69,9 @@ typedef enum {
|
|||
BTC_BLE_MESH_EVT_CONFIG_SERVER_MAX,
|
||||
} btc_ble_mesh_config_server_evt_t;
|
||||
|
||||
void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -53,15 +53,14 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg);
|
|||
|
||||
void btc_ble_mesh_generic_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
void btc_ble_mesh_generic_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
void btc_ble_mesh_generic_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_GENERIC_SERVER_STATE_CHANGE,
|
||||
|
@ -70,10 +69,9 @@ typedef enum {
|
|||
BTC_BLE_MESH_EVT_GENERIC_SERVER_MAX,
|
||||
} btc_ble_mesh_generic_server_evt_t;
|
||||
|
||||
void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
void btc_ble_mesh_generic_server_cb_handler(btc_msg_t *msg);
|
||||
|
||||
|
|
|
@ -53,15 +53,14 @@ void btc_ble_mesh_health_client_call_handler(btc_msg_t *msg);
|
|||
|
||||
void btc_ble_mesh_health_client_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_ble_mesh_health_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
void btc_ble_mesh_health_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, u16_t len);
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, u16_t len);
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_ACT_HEALTH_SERVER_FAULT_UPDATE,
|
||||
|
@ -82,7 +81,8 @@ void btc_ble_mesh_health_server_arg_deep_copy(btc_msg_t *msg, void *p_dest, void
|
|||
|
||||
void btc_ble_mesh_health_server_fault_clear(struct bt_mesh_model *model, u16_t company_id);
|
||||
|
||||
void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model, u8_t test_id, u16_t company_id);
|
||||
void btc_ble_mesh_health_server_fault_test(struct bt_mesh_model *model,
|
||||
u8_t test_id, u16_t company_id);
|
||||
|
||||
void btc_ble_mesh_health_server_attention_on(struct bt_mesh_model *model, u8_t time);
|
||||
|
||||
|
|
|
@ -53,15 +53,14 @@ void btc_ble_mesh_lighting_client_cb_handler(btc_msg_t *msg);
|
|||
|
||||
void btc_ble_mesh_lighting_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
void btc_ble_mesh_lighting_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
void btc_ble_mesh_lighting_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_LIGHTING_SERVER_STATE_CHANGE,
|
||||
|
@ -71,10 +70,9 @@ typedef enum {
|
|||
BTC_BLE_MESH_EVT_LIGHTING_SERVER_MAX,
|
||||
} btc_ble_mesh_lighting_server_evt_t;
|
||||
|
||||
void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
void btc_ble_mesh_lighting_server_cb_handler(btc_msg_t *msg);
|
||||
|
||||
|
|
|
@ -320,10 +320,9 @@ esp_ble_mesh_elem_t *btc_ble_mesh_elem_find(u16_t addr);
|
|||
uint8_t btc_ble_mesh_elem_count(void);
|
||||
|
||||
esp_ble_mesh_model_t *btc_ble_mesh_model_find_vnd(const esp_ble_mesh_elem_t *elem,
|
||||
uint16_t company, uint16_t id);
|
||||
uint16_t company, uint16_t id);
|
||||
|
||||
esp_ble_mesh_model_t *btc_ble_mesh_model_find(const esp_ble_mesh_elem_t *elem,
|
||||
uint16_t id);
|
||||
esp_ble_mesh_model_t *btc_ble_mesh_model_find(const esp_ble_mesh_elem_t *elem, uint16_t id);
|
||||
|
||||
const esp_ble_mesh_comp_t *btc_ble_mesh_comp_get(void);
|
||||
|
||||
|
|
|
@ -53,15 +53,14 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg);
|
|||
|
||||
void btc_ble_mesh_sensor_client_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
void btc_ble_mesh_sensor_client_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
void btc_ble_mesh_sensor_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_SENSOR_SERVER_STATE_CHANGE,
|
||||
|
@ -70,10 +69,9 @@ typedef enum {
|
|||
BTC_BLE_MESH_EVT_SENSOR_SERVER_MAX,
|
||||
} btc_ble_mesh_sensor_server_evt_t;
|
||||
|
||||
void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
void btc_ble_mesh_sensor_server_cb_handler(btc_msg_t *msg);
|
||||
|
||||
|
|
|
@ -53,15 +53,14 @@ 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_publish_callback(u32_t opcode,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
void btc_ble_mesh_time_scene_client_publish_callback(u32_t opcode, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf);
|
||||
|
||||
void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_TIME_SCENE_SERVER_STATE_CHANGE,
|
||||
|
@ -71,10 +70,9 @@ typedef enum {
|
|||
BTC_BLE_MESH_EVT_TIME_SCENE_SERVER_MAX,
|
||||
} btc_ble_mesh_time_scene_server_evt_t;
|
||||
|
||||
void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type,
|
||||
struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type, struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const u8_t *val, size_t len);
|
||||
|
||||
void btc_ble_mesh_time_scene_server_cb_handler(btc_msg_t *msg);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "esp_attr.h"
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
#include "mesh_byteorder.h"
|
||||
|
@ -34,14 +35,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLE_MESH_ALLOC_FROM_PSRAM_FIRST
|
||||
#define bt_mesh_malloc(size) heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
|
||||
#define bt_mesh_calloc(size) heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
|
||||
#else
|
||||
#define bt_mesh_malloc(size) malloc((size))
|
||||
#define bt_mesh_calloc(size) calloc(1, (size))
|
||||
#endif /* CONFIG_BLE_MESH_ALLOC_FROM_PSRAM_FIRST */
|
||||
#define bt_mesh_free(p) free((p))
|
||||
IRAM_ATTR void *bt_mesh_malloc(size_t size);
|
||||
|
||||
IRAM_ATTR void *bt_mesh_calloc(size_t size);
|
||||
|
||||
IRAM_ATTR void bt_mesh_free(void *ptr);
|
||||
|
||||
/**
|
||||
* @brief This function allocates memory to store outgoing message.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "mesh_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -36,6 +37,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#define BLE_MESH_ADV_TASK_STACK_SIZE 3072
|
||||
#define BLE_MESH_ADV_TASK_NAME "mesh_adv_task"
|
||||
#define BLE_MESH_ADV_TASK_PRIO (configMAX_PRIORITIES - 5)
|
||||
|
||||
/**
|
||||
* @brief Put the current thread to sleep.
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
|
||||
typedef struct {
|
||||
SemaphoreHandle_t mutex;
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
|
||||
StaticQueue_t *buffer;
|
||||
#endif
|
||||
} bt_mesh_mutex_t;
|
||||
|
|
|
@ -493,7 +493,7 @@ void net_buf_unref(struct net_buf *buf)
|
|||
pool->uninit_count++;
|
||||
#if defined(CONFIG_BLE_MESH_NET_BUF_POOL_USAGE)
|
||||
pool->avail_count++;
|
||||
NET_BUF_DBG("%s, pool %p, avail_count %d, uninit_count %d", __func__,
|
||||
NET_BUF_DBG("Unref, pool %p, avail_count %d, uninit_count %d",
|
||||
pool, pool->avail_count, pool->uninit_count);
|
||||
NET_BUF_ASSERT(pool->avail_count <= pool->buf_count);
|
||||
#endif
|
||||
|
@ -546,7 +546,7 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
|
|||
|
||||
NET_BUF_ASSERT(pool);
|
||||
|
||||
NET_BUF_DBG("%s, pool %p, uninit_count %d, buf_count %d", __func__,
|
||||
NET_BUF_DBG("Alloc, pool %p, uninit_count %d, buf_count %d",
|
||||
pool, pool->uninit_count, pool->buf_count);
|
||||
|
||||
/* We need to lock interrupts temporarily to prevent race conditions
|
||||
|
@ -570,7 +570,7 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
|
|||
|
||||
bt_mesh_buf_unlock();
|
||||
|
||||
NET_BUF_ERR("%s, Failed to get free buffer", __func__);
|
||||
NET_BUF_ERR("Out of free buffer, pool %p", pool);
|
||||
return NULL;
|
||||
|
||||
success:
|
||||
|
@ -579,11 +579,11 @@ success:
|
|||
if (size) {
|
||||
buf->__buf = data_alloc(buf, &size, timeout);
|
||||
if (!buf->__buf) {
|
||||
NET_BUF_ERR("%s, Failed to allocate data", __func__);
|
||||
NET_BUF_ERR("Out of data, buf %p", buf);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
NET_BUF_WARN("%s, Zero data size", __func__);
|
||||
NET_BUF_WARN("Zero data size, buf %p", buf);
|
||||
buf->__buf = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,37 @@
|
|||
#include "client_common.h"
|
||||
#include "mesh_common.h"
|
||||
|
||||
IRAM_ATTR void *bt_mesh_malloc(size_t size)
|
||||
{
|
||||
#ifdef CONFIG_BLE_MESH_MEM_ALLOC_MODE_INTERNAL
|
||||
return heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#elif CONFIG_BLE_MESH_ALLOC_FROM_PSRAM_FIRST
|
||||
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#elif CONFIG_BLE_MESH_MEM_ALLOC_MODE_IRAM_8BIT
|
||||
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#else
|
||||
return malloc(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
IRAM_ATTR void *bt_mesh_calloc(size_t size)
|
||||
{
|
||||
#ifdef CONFIG_BLE_MESH_MEM_ALLOC_MODE_INTERNAL
|
||||
return heap_caps_calloc(1, size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#elif CONFIG_BLE_MESH_ALLOC_FROM_PSRAM_FIRST
|
||||
return heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#elif CONFIG_BLE_MESH_MEM_ALLOC_MODE_IRAM_8BIT
|
||||
return heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#else
|
||||
return calloc(1, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
IRAM_ATTR void bt_mesh_free(void *ptr)
|
||||
{
|
||||
heap_caps_free(ptr);
|
||||
}
|
||||
|
||||
struct net_buf_simple *bt_mesh_alloc_buf(u16_t size)
|
||||
{
|
||||
struct net_buf_simple *buf = NULL;
|
||||
|
@ -26,7 +57,7 @@ struct net_buf_simple *bt_mesh_alloc_buf(u16_t size)
|
|||
|
||||
buf = (struct net_buf_simple *)bt_mesh_calloc(sizeof(struct net_buf_simple) + size);
|
||||
if (!buf) {
|
||||
BT_ERR("%s, Failed to allocate memory", __func__);
|
||||
BT_ERR("%s, Out of memory", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -52,7 +83,7 @@ u8_t bt_mesh_get_device_role(struct bt_mesh_model *model, bool srv_send)
|
|||
bt_mesh_client_user_data_t *client = NULL;
|
||||
|
||||
if (srv_send) {
|
||||
BT_DBG("%s, Message is sent by a server model", __func__);
|
||||
BT_DBG("Message is sent by a server model");
|
||||
return NODE;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,32 +22,36 @@ static bt_mesh_mutex_t atomic_lock;
|
|||
void bt_mesh_mutex_create(bt_mesh_mutex_t *mutex)
|
||||
{
|
||||
if (!mutex) {
|
||||
BT_ERR("%s, Invalid mutex", __func__);
|
||||
BT_ERR("Create, invalid mutex");
|
||||
return;
|
||||
}
|
||||
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
mutex->buffer = heap_caps_calloc(1, sizeof(StaticQueue_t), MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM);
|
||||
__ASSERT(mutex->buffer, "%s, Failed to create queue buffer", __func__);
|
||||
mutex->mutex = xSemaphoreCreateMutexStatic(mutex->buffer);
|
||||
__ASSERT(mutex->mutex, "%s, Failed to create static mutex", __func__);
|
||||
#else
|
||||
mutex->mutex = xSemaphoreCreateMutex();
|
||||
__ASSERT(mutex->mutex, "%s, Failed to create mutex", __func__);
|
||||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
|
||||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
|
||||
mutex->buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#elif CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT
|
||||
mutex->buffer = heap_caps_calloc_prefer(1, sizeof(StaticQueue_t), 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#endif
|
||||
__ASSERT(mutex->buffer, "Failed to create mutex buffer");
|
||||
mutex->mutex = xSemaphoreCreateMutexStatic(mutex->buffer);
|
||||
__ASSERT(mutex->mutex, "Failed to create static mutex");
|
||||
#else /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */
|
||||
mutex->mutex = xSemaphoreCreateMutex();
|
||||
__ASSERT(mutex->mutex, "Failed to create mutex");
|
||||
#endif /* CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC */
|
||||
}
|
||||
|
||||
void bt_mesh_mutex_free(bt_mesh_mutex_t *mutex)
|
||||
{
|
||||
if (!mutex) {
|
||||
BT_ERR("%s, Invalid mutex", __func__);
|
||||
BT_ERR("Free, invalid mutex");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mutex->mutex) {
|
||||
vSemaphoreDelete(mutex->mutex);
|
||||
mutex->mutex = NULL;
|
||||
#if CONFIG_SPIRAM_USE_MALLOC
|
||||
#if CONFIG_BLE_MESH_FREERTOS_STATIC_ALLOC
|
||||
heap_caps_free(mutex->buffer);
|
||||
mutex->buffer = NULL;
|
||||
#endif
|
||||
|
@ -57,7 +61,7 @@ void bt_mesh_mutex_free(bt_mesh_mutex_t *mutex)
|
|||
void bt_mesh_mutex_lock(bt_mesh_mutex_t *mutex)
|
||||
{
|
||||
if (!mutex) {
|
||||
BT_ERR("%s, Invalid mutex", __func__);
|
||||
BT_ERR("Lock, invalid mutex");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,7 +73,7 @@ void bt_mesh_mutex_lock(bt_mesh_mutex_t *mutex)
|
|||
void bt_mesh_mutex_unlock(bt_mesh_mutex_t *mutex)
|
||||
{
|
||||
if (!mutex) {
|
||||
BT_ERR("%s, Invalid mutex", __func__);
|
||||
BT_ERR("Unlock, invalid mutex");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ void bt_mesh_timer_init(void)
|
|||
bm_alarm_hash_map = hash_map_new(BLE_MESH_GENERAL_ALARM_HASH_MAP_SIZE,
|
||||
hash_function_pointer, NULL,
|
||||
(data_free_fn)osi_alarm_free, NULL);
|
||||
__ASSERT(bm_alarm_hash_map, "%s, Failed to create hash map", __func__);
|
||||
__ASSERT(bm_alarm_hash_map, "Failed to create hash map");
|
||||
}
|
||||
|
||||
void bt_mesh_timer_deinit(void)
|
||||
|
@ -74,12 +74,12 @@ int k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler)
|
|||
if (!hash_map_has_key(bm_alarm_hash_map, (void *)work)) {
|
||||
alarm = osi_alarm_new("bt_mesh", (osi_alarm_callback_t)handler, (void *)&work->work, 0);
|
||||
if (alarm == NULL) {
|
||||
BT_ERR("%s, Alarm not created", __func__);
|
||||
BT_ERR("Alarm not created");
|
||||
bt_mesh_alarm_unlock();
|
||||
return -EIO;
|
||||
}
|
||||
if (!hash_map_set(bm_alarm_hash_map, work, (void *)alarm)) {
|
||||
BT_ERR("%s, Alarm not set", __func__);
|
||||
BT_ERR("Alarm not set");
|
||||
bt_mesh_alarm_unlock();
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ int k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler)
|
|||
|
||||
alarm = hash_map_get(bm_alarm_hash_map, work);
|
||||
if (alarm == NULL) {
|
||||
BT_ERR("%s, Alarm not found", __func__);
|
||||
BT_ERR("Init, alarm not found");
|
||||
bt_mesh_alarm_unlock();
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ int k_delayed_work_submit(struct k_delayed_work *work, s32_t delay)
|
|||
bt_mesh_alarm_lock();
|
||||
osi_alarm_t *alarm = hash_map_get(bm_alarm_hash_map, (void *)work);
|
||||
if (alarm == NULL) {
|
||||
BT_WARN("%s, Alarm not found", __func__);
|
||||
BT_WARN("Submit, alarm not found");
|
||||
bt_mesh_alarm_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ int k_delayed_work_submit_periodic(struct k_delayed_work *work, s32_t period)
|
|||
bt_mesh_alarm_lock();
|
||||
osi_alarm_t *alarm = hash_map_get(bm_alarm_hash_map, (void *)work);
|
||||
if (alarm == NULL) {
|
||||
BT_WARN("%s, Alarm not found", __func__);
|
||||
BT_WARN("Submit, alarm not found");
|
||||
bt_mesh_alarm_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ int k_delayed_work_cancel(struct k_delayed_work *work)
|
|||
bt_mesh_alarm_lock();
|
||||
osi_alarm_t *alarm = hash_map_get(bm_alarm_hash_map, (void *)work);
|
||||
if (alarm == NULL) {
|
||||
BT_WARN("%s, Alarm not found", __func__);
|
||||
BT_WARN("Cancel, alarm not found");
|
||||
bt_mesh_alarm_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ int k_delayed_work_free(struct k_delayed_work *work)
|
|||
bt_mesh_alarm_lock();
|
||||
osi_alarm_t *alarm = hash_map_get(bm_alarm_hash_map, work);
|
||||
if (alarm == NULL) {
|
||||
BT_WARN("%s, Alarm not found", __func__);
|
||||
BT_WARN("Free, alarm not found");
|
||||
bt_mesh_alarm_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ s32_t k_delayed_work_remaining_get(struct k_delayed_work *work)
|
|||
bt_mesh_alarm_lock();
|
||||
osi_alarm_t *alarm = hash_map_get(bm_alarm_hash_map, (void *)work);
|
||||
if (alarm == NULL) {
|
||||
BT_WARN("%s, Alarm not found", __func__);
|
||||
BT_WARN("Get time, alarm not found");
|
||||
bt_mesh_alarm_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -22,221 +22,11 @@
|
|||
#include "fast_prov.h"
|
||||
#include "provisioner_main.h"
|
||||
|
||||
#include "generic_client.h"
|
||||
#include "sensor_client.h"
|
||||
#include "time_scene_client.h"
|
||||
#include "lighting_client.h"
|
||||
|
||||
#include "generic_server.h"
|
||||
#include "sensor_server.h"
|
||||
#include "time_scene_server.h"
|
||||
#include "lighting_server.h"
|
||||
|
||||
#define BLE_MESH_SDU_MAX_LEN 384
|
||||
|
||||
static const struct bt_mesh_comp *dev_comp;
|
||||
static u16_t dev_primary_addr;
|
||||
|
||||
static const struct {
|
||||
const u16_t id;
|
||||
int (*const init)(struct bt_mesh_model *model, bool primary);
|
||||
} model_init[] = {
|
||||
{ BLE_MESH_MODEL_ID_CFG_SRV, bt_mesh_cfg_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_HEALTH_SRV, bt_mesh_health_srv_init },
|
||||
#if defined(CONFIG_BLE_MESH_CFG_CLI)
|
||||
{ BLE_MESH_MODEL_ID_CFG_CLI, bt_mesh_cfg_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_HEALTH_CLI)
|
||||
{ BLE_MESH_MODEL_ID_HEALTH_CLI, bt_mesh_health_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_ONOFF_CLI, bt_mesh_gen_onoff_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_LEVEL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_LEVEL_CLI, bt_mesh_gen_level_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI, bt_mesh_gen_def_trans_time_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_POWER_ONOFF_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI, bt_mesh_gen_pwr_onoff_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_POWER_LEVEL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI, bt_mesh_gen_pwr_level_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_BATTERY_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_BATTERY_CLI, bt_mesh_gen_battery_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_LOCATION_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_LOCATION_CLI, bt_mesh_gen_location_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_PROPERTY_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_PROP_CLI, bt_mesh_gen_property_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_SENSOR_CLI)
|
||||
{ BLE_MESH_MODEL_ID_SENSOR_CLI, bt_mesh_sensor_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_TIME_CLI)
|
||||
{ BLE_MESH_MODEL_ID_TIME_CLI, bt_mesh_time_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_SCENE_CLI)
|
||||
{ BLE_MESH_MODEL_ID_SCENE_CLI, bt_mesh_scene_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_SCHEDULER_CLI)
|
||||
{ BLE_MESH_MODEL_ID_SCHEDULER_CLI, bt_mesh_scheduler_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_LIGHTNESS_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI, bt_mesh_light_lightness_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_CTL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_CLI, bt_mesh_light_ctl_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_HSL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_CLI, bt_mesh_light_hsl_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_XYL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_XYL_CLI, bt_mesh_light_xyl_cli_init },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_LC_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LC_CLI, bt_mesh_light_lc_cli_init },
|
||||
#endif
|
||||
{ BLE_MESH_MODEL_ID_GEN_ONOFF_SRV, bt_mesh_gen_onoff_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_LEVEL_SRV, bt_mesh_gen_level_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV, bt_mesh_gen_def_trans_time_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV, bt_mesh_gen_power_onoff_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV, bt_mesh_gen_power_onoff_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV, bt_mesh_gen_power_level_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV, bt_mesh_gen_power_level_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_BATTERY_SRV, bt_mesh_gen_battery_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_LOCATION_SRV, bt_mesh_gen_location_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_LOCATION_SETUP_SRV, bt_mesh_gen_location_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_USER_PROP_SRV, bt_mesh_gen_user_prop_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV, bt_mesh_gen_admin_prop_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV, bt_mesh_gen_manu_prop_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV, bt_mesh_gen_client_prop_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV, bt_mesh_light_lightness_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV, bt_mesh_light_lightness_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_SRV, bt_mesh_light_ctl_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV, bt_mesh_light_ctl_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV, bt_mesh_light_ctl_temp_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_SRV, bt_mesh_light_hsl_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV, bt_mesh_light_hsl_hue_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV, bt_mesh_light_hsl_sat_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV, bt_mesh_light_hsl_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_XYL_SRV, bt_mesh_light_xyl_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV, bt_mesh_light_xyl_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LC_SRV, bt_mesh_light_lc_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LC_SETUP_SRV, bt_mesh_light_lc_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_TIME_SRV, bt_mesh_time_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_TIME_SETUP_SRV, bt_mesh_time_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_SCENE_SRV, bt_mesh_scene_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_SCENE_SETUP_SRV, bt_mesh_scene_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_SCHEDULER_SRV, bt_mesh_scheduler_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_SCHEDULER_SETUP_SRV, bt_mesh_scheduler_setup_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_SENSOR_SRV, bt_mesh_sensor_srv_init },
|
||||
{ BLE_MESH_MODEL_ID_SENSOR_SETUP_SRV, bt_mesh_sensor_setup_srv_init },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const u16_t id;
|
||||
int (*const deinit)(struct bt_mesh_model *model, bool primary);
|
||||
} model_deinit[] = {
|
||||
{ BLE_MESH_MODEL_ID_CFG_SRV, bt_mesh_cfg_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_HEALTH_SRV, bt_mesh_health_srv_deinit },
|
||||
#if defined(CONFIG_BLE_MESH_CFG_CLI)
|
||||
{ BLE_MESH_MODEL_ID_CFG_CLI, bt_mesh_cfg_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_HEALTH_CLI)
|
||||
{ BLE_MESH_MODEL_ID_HEALTH_CLI, bt_mesh_health_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_ONOFF_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_ONOFF_CLI, bt_mesh_gen_onoff_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_LEVEL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_LEVEL_CLI, bt_mesh_gen_level_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_CLI, bt_mesh_gen_def_trans_time_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_POWER_ONOFF_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_CLI, bt_mesh_gen_pwr_onoff_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_POWER_LEVEL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_CLI, bt_mesh_gen_pwr_level_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_BATTERY_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_BATTERY_CLI, bt_mesh_gen_battery_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_LOCATION_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_LOCATION_CLI, bt_mesh_gen_location_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_GENERIC_PROPERTY_CLI)
|
||||
{ BLE_MESH_MODEL_ID_GEN_PROP_CLI, bt_mesh_gen_property_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_SENSOR_CLI)
|
||||
{ BLE_MESH_MODEL_ID_SENSOR_CLI, bt_mesh_sensor_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_TIME_CLI)
|
||||
{ BLE_MESH_MODEL_ID_TIME_CLI, bt_mesh_time_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_SCENE_CLI)
|
||||
{ BLE_MESH_MODEL_ID_SCENE_CLI, bt_mesh_scene_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_SCHEDULER_CLI)
|
||||
{ BLE_MESH_MODEL_ID_SCHEDULER_CLI, bt_mesh_scheduler_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_LIGHTNESS_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_CLI, bt_mesh_light_lightness_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_CTL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_CLI, bt_mesh_light_ctl_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_HSL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_CLI, bt_mesh_light_hsl_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_XYL_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_XYL_CLI, bt_mesh_light_xyl_cli_deinit },
|
||||
#endif
|
||||
#if defined(CONFIG_BLE_MESH_LIGHT_LC_CLI)
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LC_CLI, bt_mesh_light_lc_cli_deinit },
|
||||
#endif
|
||||
{ BLE_MESH_MODEL_ID_GEN_ONOFF_SRV, bt_mesh_gen_onoff_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_LEVEL_SRV, bt_mesh_gen_level_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV, bt_mesh_gen_def_trans_time_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV, bt_mesh_gen_power_onoff_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SETUP_SRV, bt_mesh_gen_power_onoff_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV, bt_mesh_gen_power_level_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SETUP_SRV, bt_mesh_gen_power_level_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_BATTERY_SRV, bt_mesh_gen_battery_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_LOCATION_SRV, bt_mesh_gen_location_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_LOCATION_SETUP_SRV, bt_mesh_gen_location_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_USER_PROP_SRV, bt_mesh_gen_user_prop_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_ADMIN_PROP_SRV, bt_mesh_gen_admin_prop_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_MANUFACTURER_PROP_SRV, bt_mesh_gen_manu_prop_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_GEN_CLIENT_PROP_SRV, bt_mesh_gen_client_prop_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV, bt_mesh_light_lightness_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SETUP_SRV, bt_mesh_light_lightness_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_SRV, bt_mesh_light_ctl_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_SETUP_SRV, bt_mesh_light_ctl_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV, bt_mesh_light_ctl_temp_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_SRV, bt_mesh_light_hsl_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV, bt_mesh_light_hsl_hue_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV, bt_mesh_light_hsl_sat_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_HSL_SETUP_SRV, bt_mesh_light_hsl_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_XYL_SRV, bt_mesh_light_xyl_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_XYL_SETUP_SRV, bt_mesh_light_xyl_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LC_SRV, bt_mesh_light_lc_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_LIGHT_LC_SETUP_SRV, bt_mesh_light_lc_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_TIME_SRV, bt_mesh_time_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_TIME_SETUP_SRV, bt_mesh_time_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_SCENE_SRV, bt_mesh_scene_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_SCENE_SETUP_SRV, bt_mesh_scene_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_SCHEDULER_SRV, bt_mesh_scheduler_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_SCHEDULER_SETUP_SRV, bt_mesh_scheduler_setup_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_SENSOR_SRV, bt_mesh_sensor_srv_deinit },
|
||||
{ BLE_MESH_MODEL_ID_SENSOR_SETUP_SRV, bt_mesh_sensor_setup_srv_deinit },
|
||||
};
|
||||
|
||||
void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
|
||||
struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary,
|
||||
|
@ -245,6 +35,11 @@ void bt_mesh_model_foreach(void (*func)(struct bt_mesh_model *mod,
|
|||
{
|
||||
int i, j;
|
||||
|
||||
if (dev_comp == NULL) {
|
||||
BT_ERR("Invalid device composition");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < dev_comp->elem_count; i++) {
|
||||
struct bt_mesh_elem *elem = &dev_comp->elem[i];
|
||||
|
||||
|
@ -267,7 +62,7 @@ s32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod)
|
|||
int period = 0;
|
||||
|
||||
if (!mod->pub) {
|
||||
BT_ERR("%s, Model has no publication support", __func__);
|
||||
BT_ERR("Model has no publication support");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -289,7 +84,7 @@ s32_t bt_mesh_model_pub_period_get(struct bt_mesh_model *mod)
|
|||
period = K_MINUTES((mod->pub->period & BIT_MASK(6)) * 10U);
|
||||
break;
|
||||
default:
|
||||
BT_ERR("%s, Unknown model publication period", __func__);
|
||||
BT_ERR("Unknown model publication period");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -306,7 +101,7 @@ static s32_t next_period(struct bt_mesh_model *mod)
|
|||
u32_t elapsed = 0U, period = 0U;
|
||||
|
||||
if (!pub) {
|
||||
BT_ERR("%s, Model has no publication support", __func__);
|
||||
BT_ERR("Model has no publication support");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -336,7 +131,7 @@ static void publish_sent(int err, void *user_data)
|
|||
BT_DBG("err %d", err);
|
||||
|
||||
if (!mod->pub) {
|
||||
BT_ERR("%s, Model has no publication support", __func__);
|
||||
BT_ERR("Model has no publication support");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -377,7 +172,7 @@ static int publish_retransmit(struct bt_mesh_model *mod)
|
|||
{
|
||||
struct bt_mesh_model_pub *pub = mod->pub;
|
||||
if (!pub) {
|
||||
BT_ERR("%s, Model has no publication support", __func__);
|
||||
BT_ERR("Model has no publication support");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -399,13 +194,13 @@ static int publish_retransmit(struct bt_mesh_model *mod)
|
|||
|
||||
key = bt_mesh_tx_appkey_get(pub->dev_role, pub->key);
|
||||
if (!key) {
|
||||
BT_ERR("%s, AppKey 0x%03x not exists", __func__, pub->key);
|
||||
BT_ERR("AppKey 0x%03x not exists", pub->key);
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
|
||||
tx.sub = bt_mesh_tx_netkey_get(pub->dev_role, key->net_idx);
|
||||
if (!tx.sub) {
|
||||
BT_ERR("%s, Subnet 0x%04x not exists", __func__, key->net_idx);
|
||||
BT_ERR("Subnet 0x%04x not exists", key->net_idx);
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
|
||||
|
@ -414,7 +209,7 @@ static int publish_retransmit(struct bt_mesh_model *mod)
|
|||
|
||||
sdu = bt_mesh_alloc_buf(pub->msg->len + BLE_MESH_MIC_SHORT);
|
||||
if (!sdu) {
|
||||
BT_ERR("%s, Failed to allocate memory", __func__);
|
||||
BT_ERR("%s, Out of memory", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -447,12 +242,12 @@ static void mod_publish(struct k_work *work)
|
|||
BT_DBG("%s", __func__);
|
||||
|
||||
period_ms = bt_mesh_model_pub_period_get(pub->mod);
|
||||
BT_INFO("period %u ms", period_ms);
|
||||
BT_INFO("Publish period %u ms", period_ms);
|
||||
|
||||
if (pub->count) {
|
||||
err = publish_retransmit(pub->mod);
|
||||
if (err) {
|
||||
BT_ERR("%s, Failed to retransmit (err %d)", __func__, err);
|
||||
BT_ERR("Failed to retransmit (err %d)", err);
|
||||
|
||||
pub->count = 0U;
|
||||
|
||||
|
@ -469,14 +264,11 @@ static void mod_publish(struct k_work *work)
|
|||
return;
|
||||
}
|
||||
|
||||
__ASSERT_NO_MSG(pub->update != NULL);
|
||||
|
||||
/* Callback the model publish update event to the application layer.
|
||||
* In the event, users can update the context of the publish message
|
||||
* which will be published in the next period.
|
||||
*/
|
||||
err = pub->update(pub->mod);
|
||||
if (err) {
|
||||
if (pub->update && pub->update(pub->mod)) {
|
||||
/* Cancel this publish attempt. */
|
||||
BT_ERR("Update failed, skipping publish (err %d)", err);
|
||||
pub->period_start = k_uptime_get_32();
|
||||
|
@ -486,7 +278,7 @@ static void mod_publish(struct k_work *work)
|
|||
|
||||
err = bt_mesh_model_publish(pub->mod);
|
||||
if (err) {
|
||||
BT_ERR("%s, Publishing failed (err %d)", __func__, err);
|
||||
BT_ERR("Publishing failed (err %d)", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,12 +292,12 @@ struct bt_mesh_model *bt_mesh_model_get(bool vnd, u8_t elem_idx, u8_t mod_idx)
|
|||
struct bt_mesh_elem *elem = NULL;
|
||||
|
||||
if (!dev_comp) {
|
||||
BT_ERR("%s, dev_comp is not initialized", __func__);
|
||||
BT_ERR("dev_comp not initialized");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (elem_idx >= dev_comp->elem_count) {
|
||||
BT_ERR("%s, Invalid element index %u", __func__, elem_idx);
|
||||
BT_ERR("Invalid element index %u", elem_idx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -513,14 +305,14 @@ struct bt_mesh_model *bt_mesh_model_get(bool vnd, u8_t elem_idx, u8_t mod_idx)
|
|||
|
||||
if (vnd) {
|
||||
if (mod_idx >= elem->vnd_model_count) {
|
||||
BT_ERR("%s, Invalid vendor model index %u", __func__, mod_idx);
|
||||
BT_ERR("Invalid vendor model index %u", mod_idx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &elem->vnd_models[mod_idx];
|
||||
} else {
|
||||
if (mod_idx >= elem->model_count) {
|
||||
BT_ERR("%s, Invalid SIG model index %u", __func__, mod_idx);
|
||||
BT_ERR("Invalid SIG model index %u", mod_idx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -531,8 +323,19 @@ struct bt_mesh_model *bt_mesh_model_get(bool vnd, u8_t elem_idx, u8_t mod_idx)
|
|||
static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
int *err = user_data;
|
||||
int i;
|
||||
|
||||
if (!user_data) {
|
||||
BT_ERR("Invalid model init user data");
|
||||
return;
|
||||
}
|
||||
|
||||
if (*err) {
|
||||
BT_ERR("Model init failed (err %d)", *err);
|
||||
return;
|
||||
}
|
||||
|
||||
mod->elem = elem;
|
||||
|
||||
if (mod->pub) {
|
||||
|
@ -556,18 +359,27 @@ static void mod_init(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(model_init); i++) {
|
||||
if (model_init[i].id == mod->id) {
|
||||
model_init[i].init(mod, primary);
|
||||
}
|
||||
if (mod->cb && mod->cb->init) {
|
||||
*err = mod->cb->init(mod);
|
||||
}
|
||||
}
|
||||
|
||||
static void mod_deinit(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
||||
bool vnd, bool primary, void *user_data)
|
||||
{
|
||||
int *err = user_data;
|
||||
int i;
|
||||
|
||||
if (!user_data) {
|
||||
BT_ERR("Invalid model deinit user data");
|
||||
return;
|
||||
}
|
||||
|
||||
if (*err) {
|
||||
BT_ERR("Model deinit failed (err %d)", *err);
|
||||
return;
|
||||
}
|
||||
|
||||
mod->elem = NULL;
|
||||
|
||||
if (mod->pub) {
|
||||
|
@ -587,15 +399,15 @@ static void mod_deinit(struct bt_mesh_model *mod, struct bt_mesh_elem *elem,
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(model_deinit); i++) {
|
||||
if (model_deinit[i].id == mod->id) {
|
||||
model_deinit[i].deinit(mod, primary);
|
||||
}
|
||||
if (mod->cb && mod->cb->deinit) {
|
||||
*err = mod->cb->deinit(mod);
|
||||
}
|
||||
}
|
||||
|
||||
int bt_mesh_comp_register(const struct bt_mesh_comp *comp)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
/* There must be at least one element */
|
||||
if (!comp->elem_count) {
|
||||
return -EINVAL;
|
||||
|
@ -603,23 +415,24 @@ int bt_mesh_comp_register(const struct bt_mesh_comp *comp)
|
|||
|
||||
dev_comp = comp;
|
||||
|
||||
bt_mesh_model_foreach(mod_init, NULL);
|
||||
bt_mesh_model_foreach(mod_init, &err);
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
int bt_mesh_comp_deregister(void)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (dev_comp == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_model_foreach(mod_deinit, NULL);
|
||||
bt_mesh_model_foreach(mod_deinit, &err);
|
||||
|
||||
dev_primary_addr = BLE_MESH_ADDR_UNASSIGNED;
|
||||
dev_comp = NULL;
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
void bt_mesh_comp_provision(u16_t addr)
|
||||
|
@ -645,8 +458,6 @@ void bt_mesh_comp_unprovision(void)
|
|||
BT_DBG("%s", __func__);
|
||||
|
||||
dev_primary_addr = BLE_MESH_ADDR_UNASSIGNED;
|
||||
|
||||
bt_mesh_model_foreach(mod_init, NULL);
|
||||
}
|
||||
|
||||
u16_t bt_mesh_primary_addr(void)
|
||||
|
@ -668,7 +479,7 @@ u16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, u16_t addr)
|
|||
}
|
||||
|
||||
static struct bt_mesh_model *bt_mesh_elem_find_group(struct bt_mesh_elem *elem,
|
||||
u16_t group_addr)
|
||||
u16_t group_addr)
|
||||
{
|
||||
struct bt_mesh_model *model = NULL;
|
||||
u16_t *match = NULL;
|
||||
|
@ -776,7 +587,7 @@ static int get_opcode(struct net_buf_simple *buf, u32_t *opcode)
|
|||
case 0x00:
|
||||
case 0x01:
|
||||
if (buf->data[0] == 0x7f) {
|
||||
BT_ERR("%s, Ignoring RFU OpCode", __func__);
|
||||
BT_ERR("Ignoring RFU OpCode");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -784,7 +595,7 @@ static int get_opcode(struct net_buf_simple *buf, u32_t *opcode)
|
|||
return 0;
|
||||
case 0x02:
|
||||
if (buf->len < 2) {
|
||||
BT_ERR("%s, Too short payload for 2-octet OpCode", __func__);
|
||||
BT_ERR("Too short payload for 2-octet OpCode");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -792,7 +603,7 @@ static int get_opcode(struct net_buf_simple *buf, u32_t *opcode)
|
|||
return 0;
|
||||
case 0x03:
|
||||
if (buf->len < 3) {
|
||||
BT_ERR("%s, Too short payload for 3-octet OpCode", __func__);
|
||||
BT_ERR("Too short payload for 3-octet OpCode");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -838,7 +649,7 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct net_buf_simple *buf)
|
|||
BT_INFO("recv, len %u: %s", buf->len, bt_hex(buf->data, buf->len));
|
||||
|
||||
if (get_opcode(buf, &opcode) < 0) {
|
||||
BT_WARN("%s, Unable to decode OpCode", __func__);
|
||||
BT_WARN("Unable to decode OpCode");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -932,7 +743,7 @@ static bool ready_to_send(u8_t role, u16_t dst)
|
|||
return true;
|
||||
} else if (IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && bt_mesh_is_provisioner_en() && role == PROVISIONER) {
|
||||
if (!bt_mesh_provisioner_check_msg_dst(dst)) {
|
||||
BT_ERR("%s, Failed to find DST 0x%04x", __func__, dst);
|
||||
BT_ERR("Failed to find DST 0x%04x", dst);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -952,7 +763,7 @@ static int model_send(struct bt_mesh_model *model,
|
|||
|
||||
role = bt_mesh_get_device_role(model, tx->ctx->srv_send);
|
||||
if (role == ROLE_NVAL) {
|
||||
BT_ERR("%s, Failed to get model role", __func__);
|
||||
BT_ERR("Failed to get model role");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -961,22 +772,22 @@ static int model_send(struct bt_mesh_model *model,
|
|||
BT_INFO("send, len %u: %s", msg->len, bt_hex(msg->data, msg->len));
|
||||
|
||||
if (!ready_to_send(role, tx->ctx->addr)) {
|
||||
BT_ERR("%s, Not ready", __func__);
|
||||
BT_ERR("Not ready to send");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (net_buf_simple_tailroom(msg) < BLE_MESH_MIC_SHORT) {
|
||||
BT_ERR("%s, Not enough tailroom for TransMIC", __func__);
|
||||
BT_ERR("Not enough tailroom for TransMIC");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (msg->len > MIN(BLE_MESH_TX_SDU_MAX, BLE_MESH_SDU_MAX_LEN) - BLE_MESH_MIC_SHORT) {
|
||||
BT_ERR("%s, Too big message", __func__);
|
||||
BT_ERR("Too big message (len %d)", msg->len);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
if (!implicit_bind && !model_has_key(model, tx->ctx->app_idx)) {
|
||||
BT_ERR("%s, Model not bound to AppKey 0x%04x", __func__, tx->ctx->app_idx);
|
||||
BT_ERR("Model not bound to AppKey 0x%04x", tx->ctx->app_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -993,13 +804,13 @@ int bt_mesh_model_send(struct bt_mesh_model *model,
|
|||
|
||||
role = bt_mesh_get_device_role(model, ctx->srv_send);
|
||||
if (role == ROLE_NVAL) {
|
||||
BT_ERR("%s, Failed to get model role", __func__);
|
||||
BT_ERR("Failed to get model role");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sub = bt_mesh_tx_netkey_get(role, ctx->net_idx);
|
||||
if (!sub) {
|
||||
BT_ERR("%s, Failed to get subnet", __func__);
|
||||
BT_ERR("Invalid NetKeyIndex 0x%04x", ctx->net_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -1035,28 +846,28 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
|
|||
BT_DBG("%s", __func__);
|
||||
|
||||
if (!pub || !pub->msg) {
|
||||
BT_ERR("%s, Model has no publication support", __func__);
|
||||
BT_ERR("Model has no publication support");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (pub->addr == BLE_MESH_ADDR_UNASSIGNED) {
|
||||
BT_WARN("%s, Unassigned model publish address", __func__);
|
||||
BT_WARN("Unassigned publish address");
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
|
||||
key = bt_mesh_tx_appkey_get(pub->dev_role, pub->key);
|
||||
if (!key) {
|
||||
BT_ERR("%s, AppKey 0x%03x not exists", __func__, pub->key);
|
||||
BT_ERR("Invalid AppKeyIndex 0x%03x", pub->key);
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
|
||||
if (pub->msg->len + BLE_MESH_MIC_SHORT > MIN(BLE_MESH_TX_SDU_MAX, BLE_MESH_SDU_MAX_LEN)) {
|
||||
BT_ERR("%s, Message does not fit maximum SDU size", __func__);
|
||||
BT_ERR("Message does not fit maximum SDU size");
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
if (pub->count) {
|
||||
BT_WARN("%s, Clearing publish retransmit timer", __func__);
|
||||
BT_WARN("Clearing publish retransmit timer");
|
||||
k_delayed_work_cancel(&pub->timer);
|
||||
}
|
||||
|
||||
|
@ -1071,7 +882,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
|
|||
|
||||
tx.sub = bt_mesh_tx_netkey_get(pub->dev_role, ctx.net_idx);
|
||||
if (!tx.sub) {
|
||||
BT_ERR("%s, Subnet 0x%04x not exists", __func__, ctx.net_idx);
|
||||
BT_ERR("Invalid NetKeyIndex 0x%04x", ctx.net_idx);
|
||||
return -EADDRNOTAVAIL;
|
||||
}
|
||||
|
||||
|
@ -1082,7 +893,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
|
|||
|
||||
sdu = bt_mesh_alloc_buf(pub->msg->len + BLE_MESH_MIC_SHORT);
|
||||
if (!sdu) {
|
||||
BT_ERR("%s, Failed to allocate memory", __func__);
|
||||
BT_ERR("%s, Out of memory", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -1098,7 +909,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
|
|||
}
|
||||
|
||||
struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
|
||||
u16_t company, u16_t id)
|
||||
u16_t company, u16_t id)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1112,8 +923,7 @@ struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem,
|
||||
u16_t id)
|
||||
struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, u16_t id)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -29,11 +29,6 @@ u8_t bt_mesh_elem_count(void);
|
|||
/* Find local element based on unicast or group address */
|
||||
struct bt_mesh_elem *bt_mesh_elem_find(u16_t addr);
|
||||
|
||||
struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem,
|
||||
u16_t company, u16_t id);
|
||||
struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem,
|
||||
u16_t id);
|
||||
|
||||
u16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, u16_t addr);
|
||||
|
||||
bool bt_mesh_fixed_group_match(u16_t addr);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue