Fix timeout issue when acquire notify fails 82/316782/1
authorWootak Jung <wootak.jung@samsung.com>
Wed, 21 Aug 2024 05:00:07 +0000 (14:00 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Tue, 17 Dec 2024 02:05:04 +0000 (11:05 +0900)
Change-Id: Ic43b1ce1ce36bec3cb52551b54483eedb020f5eb
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/gatt-client.c

index 5b0693894dd98e2686f20ea1fe3ecbfed4c107df..68d86c9400066e61abde3a144e5132a672c96802 100644 (file)
@@ -1686,7 +1686,12 @@ static void notify_io_cb(uint16_t value_handle, const uint8_t *value,
 
 static void register_notify_io_cb(uint16_t att_ecode, void *user_data)
 {
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
        struct notify_client *client = user_data;
+#else
+       struct async_dbus_op *op = user_data;
+       struct notify_client *client = op->data;
+#endif
        struct characteristic *chrc = client->chrc;
        struct bt_gatt_client *gatt = chrc->service->client->gatt;
 
@@ -1697,6 +1702,9 @@ static void register_notify_io_cb(uint16_t att_ecode, void *user_data)
                chrc->notify_io = NULL;
 #endif
                notify_client_free(client);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               create_notify_reply(op, false, att_ecode);
+#endif
                return;
        }
 
@@ -1731,6 +1739,9 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
        struct bt_gatt_client *gatt = chrc->service->client->gatt;
        const char *sender = dbus_message_get_sender(msg);
        struct notify_client *client;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       struct async_dbus_op *op;
+#endif
 
        if (!gatt)
                return btd_error_failed(msg, "Not connected");
@@ -1754,12 +1765,18 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
        chrc->notify_io->data = client;
        chrc->notify_io->msg = dbus_message_ref(msg);
        chrc->notify_io->destroy = notify_io_destroy;
+
+       op = async_dbus_op_new(msg, client);
 #endif
        client->notify_id = bt_gatt_client_register_notify(gatt,
                                                chrc->value_handle,
                                                register_notify_io_cb,
                                                notify_io_cb,
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
                                                client, NULL);
+#else
+                                               op, NULL);
+#endif
        if (!client->notify_id) {
                notify_client_unref(client);
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY