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)
{
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;