Bluetooth: Host: Fix not sending Service Changed indication
gatt_unregister() clears handles if those were auto-assigned by host. This resulted in Service Changed indication not beding sent since call to sc_indicate() pass already cleared handles. This was affecting GATT/SR/GAS/BV-01-C and GATT/SR/GAS/BV-07-C test cases. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
parent
7c606c29c6
commit
eccd8adc68
1 changed files with 9 additions and 2 deletions
|
|
@ -1743,10 +1743,18 @@ int bt_gatt_service_register(struct bt_gatt_service *svc)
|
|||
|
||||
int bt_gatt_service_unregister(struct bt_gatt_service *svc)
|
||||
{
|
||||
uint16_t sc_start_handle;
|
||||
uint16_t sc_end_handle;
|
||||
int err;
|
||||
|
||||
__ASSERT(svc, "invalid parameters\n");
|
||||
|
||||
/* gatt_unregister() clears handles when those were auto-assigned
|
||||
* by host
|
||||
*/
|
||||
sc_start_handle = svc->attrs[0].handle;
|
||||
sc_end_handle = svc->attrs[svc->attr_count - 1].handle;
|
||||
|
||||
k_sched_lock();
|
||||
|
||||
err = gatt_unregister(svc);
|
||||
|
|
@ -1761,8 +1769,7 @@ int bt_gatt_service_unregister(struct bt_gatt_service *svc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
sc_indicate(svc->attrs[0].handle,
|
||||
svc->attrs[svc->attr_count - 1].handle);
|
||||
sc_indicate(sc_start_handle, sc_end_handle);
|
||||
|
||||
db_changed();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue