Fix issue where pb get size fail event does not occur 93/316793/1
authorWootak Jung <wootak.jung@samsung.com>
Fri, 8 Nov 2024 04:51:40 +0000 (13:51 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 18 Dec 2024 03:03:01 +0000 (12:03 +0900)
Change-Id: I86aebb41b4fffca9ecdcc8815ec5c63ba86c4e8b
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-service/services/obex/bt-service-pbap.c

index 4e453e2ca88004b36af047c0222ea3f994832cbc..23dfc2e02cf4e39c11cb0f0d8004fad361867da4 100644 (file)
@@ -452,27 +452,30 @@ void __bt_pbap_select_cb(GDBusProxy *proxy,
                BT_ERR("g_dbus_proxy_call_finish failed");
                g_object_unref(proxy);
                if (error) {
-                       BT_ERR("errCode[%x], message[%s]\n",
-                                       error->code, error->message);
+                       GVariant *signal = NULL;
+                       int result = BLUETOOTH_ERROR_INTERNAL;
+                       int event;
+
+                       BT_ERR("operation[%d] errCode[%x], message[%s]\n",
+                                       pbap_data->operation, error->code, error->message);
+
+                       if (strstr(error->message, "Not Found") != NULL)
+                               result = BLUETOOTH_ERROR_NO_DATA;
 
                        if (pbap_data->operation == PULL_ALL ||
-                               pbap_data->operation == GET_VCARD) {
-                               GVariant *signal = NULL;
-                               int result = BLUETOOTH_ERROR_INTERNAL;
-                               int event;
-
-                               if (pbap_data->operation == PULL_ALL)
-                                       event = BLUETOOTH_PBAP_PHONEBOOK_PULL;
-                               else
-                                       event = BLUETOOTH_PBAP_VCARD_PULL;
-                               if (strstr(error->message, "Not Found") != NULL)
-                                       result = BLUETOOTH_ERROR_NO_DATA;
-                               signal = g_variant_new("(issi)", result,
-                                               address_string, "", FALSE);
-
-                               _bt_send_event(BT_PBAP_CLIENT_EVENT,
-                                                       event, signal);
+                                       pbap_data->operation == GET_VCARD) {
+                               event = (pbap_data->operation == PULL_ALL) ? BLUETOOTH_PBAP_PHONEBOOK_PULL
+                                               : BLUETOOTH_PBAP_VCARD_PULL;
+
+                               signal = g_variant_new("(issi)", result, address_string, "", FALSE);
+                               _bt_send_event(BT_PBAP_CLIENT_EVENT, event, signal);
+                       } else if (pbap_data->operation == GET_SIZE) {
+                               event = BLUETOOTH_PBAP_PHONEBOOK_SIZE;
+
+                               signal = g_variant_new("(isi)", result, address_string, FALSE);
+                               _bt_send_event(BT_PBAP_CLIENT_EVENT, event, signal);
                        }
+
                        g_clear_error(&error);
                }