Commit e4c5bb9
Bluetooth: GATT: Change get_handle function of find_by_uuid
bt_gatt_find_by_uuid used bt_gatt_attr_value_handle but that
function only works to get the value handle of a characteristic
declaration, i.e. if the UUID is not BT_UUID_GATT_CHRC then it
would always return handle = 0. This meant that
bt_gatt_find_by_uuid would always use handle = 0 as the starting
handle for non-BT_UUID_GATT_CHRC attributes, instead of the handle
of the provided attr.
This was not an issue for any UUIDs that may only exist once on a
GATT server, which is most UUIDs, but for UUIDs like the
BT_UUID_TBS_* UUIDs that may be multiple instances of, it would
always return the first attribute rather than the one starting
from the provided start attr.
This commit also ensures that we do not overflow the `end_handle`
when adding 2 uint16_t values.
Signed-off-by: Emil Gydesen <[email protected]>1 parent 8b7beff commit e4c5bb9
File tree
4 files changed
+22
-17
lines changed- include/zephyr/bluetooth
- subsys/bluetooth/host
- tests/bsim/bluetooth/host
- gatt/ccc_store/src
- security/ccc_update/src
4 files changed
+22
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
| 720 | + | |
| 721 | + | |
721 | 722 | | |
722 | 723 | | |
723 | 724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
2852 | 2855 | | |
2853 | 2856 | | |
2854 | 2857 | | |
2855 | | - | |
2856 | | - | |
2857 | | - | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
2858 | 2870 | | |
2859 | | - | |
2860 | | - | |
| 2871 | + | |
2861 | 2872 | | |
2862 | 2873 | | |
2863 | 2874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
| 233 | + | |
| 234 | + | |
238 | 235 | | |
239 | 236 | | |
240 | 237 | | |
| |||
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 275 | + | |
| 276 | + | |
281 | 277 | | |
282 | 278 | | |
283 | 279 | | |
| |||
0 commit comments