From: Anupam Roy Date: Fri, 20 Nov 2020 07:10:52 +0000 (+0530) Subject: Fix position of setting is_own GATT attribute handle X-Git-Tag: submit/tizen/20201202.002505~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=124b8bc8952eeec6c56038e137b46c53e8d8dbdc;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix position of setting is_own GATT attribute handle Issue: is_own_handle variable is wrongly set when GATT read/write callback is found for the attribute handle. But, it is possible that, callback is explicitly not set by application for one of its own handle. In such case, is_own_handle will remain false, even when the attribute is owned by the app. This will cause to miss the GATT internal response by CAPI, when response is needed for that attribute. Fix: is_own_handle is set to true, when GATT attribute is matched for an application. Change-Id: I85be0fcc03881372c46c76c56cfc69e1952f0163 Signed-off-by: Anupam Roy --- diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 0a45a48..48e0588 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -970,12 +970,12 @@ static bt_gatt_server_read_value_requested_cb __bt_gatt_attribute_get_read_cb(in if (chr) { if (chr->handle == att_handle) { + *is_own_handle = true; /* Attribute matched */ if (chr->read_requested_cb) { BT_DBG("GATT Server: char handle found [%s]", chr->uuid); *user_data = chr->read_requested_user_data; *gatt_handle = chr; *server = serv; - *is_own_handle = true; return chr->read_requested_cb; } else return NULL; @@ -984,11 +984,11 @@ static bt_gatt_server_read_value_requested_cb __bt_gatt_attribute_get_read_cb(in bt_gatt_descriptor_s *desc = l4->data; if (desc && desc->handle == att_handle) { + *is_own_handle = true; /* Attribute matched */ if (desc->read_requested_cb) { *user_data = desc->read_requested_user_data; *gatt_handle = desc; *server = serv; - *is_own_handle = true; BT_DBG("GATT Server: desc handle found [%s]", desc->uuid); return desc->read_requested_cb; } else @@ -1025,12 +1025,12 @@ static bt_gatt_server_write_value_requested_cb __bt_gatt_attribute_get_value_cha if (chr) { if (chr->handle == att_handle) { + *is_own_handle = true; /* Attribute matched */ if (chr->write_value_requested_cb) { BT_DBG("GATT Server: char handle found [%s]", chr->uuid); *user_data = chr->write_value_requested_user_data; *gatt_handle = chr; *server = svc; - *is_own_handle = true; return chr->write_value_requested_cb; } else return NULL; @@ -1039,11 +1039,11 @@ static bt_gatt_server_write_value_requested_cb __bt_gatt_attribute_get_value_cha bt_gatt_descriptor_s *desc = l4->data; if (desc && desc->handle == att_handle) { + *is_own_handle = true; /* Attribute matched */ if (desc->write_value_requested_cb) { *user_data = desc->write_value_requested_user_data; *gatt_handle = desc; *server = svc; - *is_own_handle = true; BT_DBG("GATT Server: desc handle found [%s]", desc->uuid); return desc->write_value_requested_cb; } else