#ifdef TIZEN_FEATURE_GATT_RELAY
/* Search for handle */
static bt_gatt_server_read_value_requested_cb __bt_gatt_attribute_get_read_cb(int att_handle, bt_gatt_server_h *server,
- bt_gatt_h *gatt_handle, void **user_data)
+ bt_gatt_h *gatt_handle, bool *is_own_handle, void **user_data)
{
const GSList *gatt_server_list = NULL;
const GSList *l1, *l2, *l3, *l4;
for (l2 = serv->services; l2 != NULL; l2 = l2->next) {
bt_gatt_service_s *svc = l2->data;
+
for (l3 = svc->characteristics; l3 != NULL; l3 = l3->next) {
bt_gatt_characteristic_s *chr = l3->data;
if (chr) {
if (chr->handle == att_handle) {
if (chr->read_requested_cb) {
- BT_INFO("GATT Server: Handle search match found! Its a characteristic: UUID [%s]", chr->uuid);
+ 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;
*user_data = desc->read_requested_user_data;
*gatt_handle = desc;
*server = serv;
- BT_INFO("GATT Server: Handle search match found! Its a Desc UUID [%s]", desc->uuid);
+ *is_own_handle = true;
+ BT_DBG("GATT Server: desc handle found [%s]", desc->uuid);
return desc->read_requested_cb;
} else
return NULL;
}
static bt_gatt_server_write_value_requested_cb __bt_gatt_attribute_get_value_change_cb(int att_handle, bt_gatt_h *server,
- bt_gatt_h *gatt_handle, void **user_data)
+ bt_gatt_h *gatt_handle, bool *is_own_handle, void **user_data)
{
const GSList *gatt_server_list = NULL;
const GSList *l1, *l2, *l3, *l4;
for (l2 = serv->services; l2 != NULL; l2 = l2->next) {
bt_gatt_service_s *svc = l2->data;
+
for (l3 = svc->characteristics; l3 != NULL; l3 = l3->next) {
bt_gatt_characteristic_s *chr = l3->data;
if (chr) {
if (chr->handle == att_handle) {
if (chr->write_value_requested_cb) {
- BT_INFO("GATT Server: Handle search match found! Its a characteristic: UUID [%s]", chr->uuid);
+ 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;
*user_data = desc->write_value_requested_user_data;
*gatt_handle = desc;
*server = svc;
- BT_INFO("GATT Server: Handle search match found! Its a Desc UUID [%s]", desc->uuid);
+ *is_own_handle = true;
+ BT_DBG("GATT Server: desc handle found [%s]", desc->uuid);
return desc->write_value_requested_cb;
} else
return NULL;
void *user_data_read = NULL;
bt_gatt_h gatt_handle = NULL;
bt_gatt_server_h serv = NULL;
+ bool is_own_handle = false;
cb_read = __bt_gatt_attribute_get_read_cb(read_req->attribute_handle,
- &serv, &gatt_handle, &user_data_read);
+ &serv, &gatt_handle, &is_own_handle, &user_data_read);
/* Copy data */
_bt_convert_address_to_string(&device_addr, &read_req->device_address);
- BT_INFO("GATT Server Read Req: Addr [%s]", device_addr);
- BT_INFO("GATT Server Read Req: Att handle[%d]", read_req->attribute_handle);
- BT_INFO("GATT Server Read Req: Conn ID [%d]", read_req->connection_id);
- BT_INFO("GATT Server Read Req: Trans ID [%d]", read_req->request_id);
- BT_INFO("GATT Server Read Req: Offset [%d]", read_req->offset);
- BT_INFO("GATT Server Read Req: Is Long [%d]", read_req->is_long);
+ BT_DBG("conn_id %d, trans id %d, attr handle %d, offset %d, is_long %d, addr %s",
+ read_req->connection_id, read_req->request_id,
+ read_req->attribute_handle, read_req->offset,
+ read_req->is_long, device_addr);
if (cb_read == NULL) {
- BT_INFO("GATT Server: App has not set the Read requested callback..for the current handle");
-
- bt_gatt_server_send_response(read_req->request_id,
+ BT_DBG("GATT Server: App has not set the Read requested callback..for the current handle");
+ if (is_own_handle) {
+ BT_DBG("GATT Server: Internal response sent for Read Request");
+ bt_gatt_server_send_response(read_req->request_id,
BT_GATT_REQUEST_TYPE_READ, 0,
BLUETOOTH_ERROR_INTERNAL, NULL, 0);
+ }
- BT_INFO("GATT Server: Internal response sent for Read Request");
if (device_addr != NULL)
free(device_addr);
return;
void *user_data_write = NULL;
bt_gatt_h gatt_handle = NULL;
bt_gatt_h server = NULL;
+ bool is_own_handle = false;
bluetooth_gatt_server_write_requested_info_t *write_req =
(bluetooth_gatt_server_write_requested_info_t *)(param->param_data);
memcpy(val, write_req->data.data, write_req->length);
cb_wr = __bt_gatt_attribute_get_value_change_cb(write_req->attribute_handle,
- &server, &gatt_handle, &user_data_write);
+ &server, &gatt_handle, &is_own_handle, &user_data_write);
/* Copy data */
_bt_convert_address_to_string(&device_addr, &write_req->device_address);
- BT_INFO("GATT Server Write Req: Address [%s]", device_addr);
- BT_INFO("GATT Server Write Req: Att handle [%d]", write_req->attribute_handle);
- BT_INFO("GATT Server Write Req: Conn ID [%d]", write_req->connection_id);
- BT_INFO("GATT Server Write Req: Trans ID [%d]", write_req->request_id);
- BT_INFO("GATT Server Write Req: Offset [%d]", write_req->offset);
- BT_INFO("GATT Server Write Req: Length [%d]", write_req->length);
- BT_INFO("GATT Server Write Req: Need Resp [%d]", write_req->need_resp);
+ BT_DBG("GATT Server Write Requested [%s] att handle %d, conn id %d, trans id %d, offset %d, length %d, need resp %d",
+ device_addr, write_req->attribute_handle, write_req->connection_id, write_req->request_id,
+ write_req->offset, write_req->length, write_req->need_resp);
+
if (cb_wr == NULL) {
- BT_INFO("GATT Server: App has not set the Write requested callback..for the current handle");
+ BT_DBG("GATT Server: App has not set the Write requested callback..for the current handle");
- if (write_req->need_resp) {
- BT_INFO("GATT Server: Send Response to Remote GATT client");
+ if (write_req->need_resp && is_own_handle) {
+ BT_DBG("GATT Server: Internal response sent for Write Request");
bt_gatt_server_send_response(write_req->request_id,
BT_GATT_REQUEST_TYPE_WRITE, 0,
BLUETOOTH_ERROR_INTERNAL, NULL, 0);
-
- BT_INFO("GATT Server: Internal response sent for Write Request");
}
/* Free Data */