X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-service%2Fbt-service-pbap.c;h=296e136c435ef27e81f2a1d7f3b5d8e3044e2ebb;hb=be038779d7c753421a2f570abc10b49a40a5c154;hp=d69b66adae8f2467a5d2f34db0e36972d71a06f3;hpb=20a5c4d66cf82f793ac4c7fd707a5e43f38438ed;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-service/bt-service-pbap.c b/bt-service/bt-service-pbap.c index d69b66a..296e136 100644 --- a/bt-service/bt-service-pbap.c +++ b/bt-service/bt-service-pbap.c @@ -253,6 +253,26 @@ void _bt_obex_pbap_client_disconnect(char *path) BT_DBG("-"); } +static int __bt_pbap_get_error(const char *error_message) +{ + if (error_message == NULL) { + BT_ERR("Error message NULL"); + return BLUETOOTH_ERROR_INTERNAL; + } + + BT_ERR("Error message = %s", error_message); + if (g_strcmp0(error_message, "Unable to find service record") == 0) + return BLUETOOTH_ERROR_SERVICE_NOT_FOUND; + else if (g_strcmp0(error_message, "Transport got disconnected") == 0) + return BLUETOOTH_ERROR_AUTHORIZATION_REJECTED; + else if (g_str_has_prefix(error_message, "Connection refused") == 0) + return BLUETOOTH_ERROR_AUTHENTICATION_REJECTED; + else if (g_strcmp0(error_message, "Timed out waiting for response") == 0) + return BLUETOOTH_ERROR_TIMEOUT; + else + return BLUETOOTH_ERROR_INTERNAL; +} + void __bt_pbap_connect_cb(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { @@ -269,9 +289,11 @@ void __bt_pbap_connect_cb(GDBusProxy *proxy, if (value == NULL) { BT_ERR("g_dbus_proxy_call_finish failed"); if (error) { - BT_ERR("errCode[%x], message[%s]\n", - error->code, error->message); - g_clear_error(&error); + g_dbus_error_strip_remote_error(error); + result = __bt_pbap_get_error(error->message); + BT_ERR("Failed to coonect with error[0x%x][%s]", + result, error->message); + g_error_free(error); } g_object_unref(g_pbap_proxy); g_pbap_proxy = NULL;