Fix issue where conn info could not be found 50/303750/1
authorWootak Jung <wootak.jung@samsung.com>
Wed, 3 Jan 2024 00:11:39 +0000 (09:11 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 4 Jan 2024 08:12:15 +0000 (17:12 +0900)
Branch logic is required because remote device management method is
different depending on the stack.

In the case of bluez, it is managed by remote address,
so if you distinguish it by instance ID, conn info may not be found.

In the case of bluedroid, it is managed by conn ID,
so you need to find conn info using remote address + instance ID.

Change-Id: Ieea79d1b86ff72dc3490a68fdfb50de934b4d04d
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-service/services/gatt/bt-service-gatt.c

index 37a02ac91c1bcc925c6eeff862745898102cf50d..7b2952272cc9ee1ef2c0741abc0c58f3fb5bccd3 100644 (file)
@@ -1687,6 +1687,7 @@ static void __bt_handle_gatt_server_service_deleted(event_gatts_srvc_t *event)
        }
 }
 
+#ifdef TIZEN_BLUEDROID_PORTING
 static struct gatt_client_info_t *_bt_find_remote_gatt_client_info_with_inst_id(char *address, int instance_id)
 {
        GSList *l;
@@ -1705,6 +1706,7 @@ static struct gatt_client_info_t *_bt_find_remote_gatt_client_info_with_inst_id(
        }
        return NULL;
 }
+#endif
 
 struct gatt_client_info_t *_bt_find_remote_gatt_client_info(char *address)
 {
@@ -3167,7 +3169,11 @@ int _bt_gatt_server_send_indication(char *sender, bluetooth_device_address_t *de
                }
 
        } else {
+#ifdef TIZEN_BLUEDROID_PORTING
                conn = _bt_find_remote_gatt_client_info_with_inst_id(address, param->instance_id);
+#else
+               conn = _bt_find_remote_gatt_client_info(address);
+#endif
                if (conn) {
                        ret = gatts_send_indication(param->instance_id, param->atrribute_handle,
                                        conn->connection_id, data->length,