Fix issue where conn info could not be found 36/303636/3 accepted/tizen/7.0/unified/20240105.014818
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:11:03 +0000 (08:11 +0000)
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 c0a2c895214a12c14e5d986c4918b9c6763bf172..731ecc93cb7df99951b017fb92543f3b35c9dc60 100644 (file)
@@ -1622,6 +1622,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;
@@ -1640,6 +1641,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)
 {
@@ -2981,7 +2983,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,