static char *g_pbap_session_path = NULL;
static char *g_pbap_server_address = NULL;
static GDBusProxy *g_pbap_proxy = NULL;
+static gboolean g_is_pbap_connecting;
static struct {
int type;
g_free(address_string);
BT_DBG("-");
+
+ g_is_pbap_connecting = FALSE;
}
int _bt_pbap_connect(const bluetooth_device_address_t *address)
if (g_pbap_session_path)
return BLUETOOTH_ERROR_ALREADY_CONNECT;
+ if (g_is_pbap_connecting == TRUE)
+ return BLUETOOTH_ERROR_IN_PROGRESS;
+
BT_DBG("BD Address [%2.2X %2.2X %2.2X %2.2X %2.2X %2.2X]",
address->addr[0], address->addr[1],
address->addr[2], address->addr[3],
g_conn = _bt_gdbus_get_session_gconn();
if (g_conn == NULL) {
BT_ERR("Couldn't connect to session bus");
- return EXIT_FAILURE;
+ return BLUETOOTH_ERROR_INTERNAL;
}
g_pbap_proxy = g_dbus_proxy_new_sync(g_conn,
G_DBUS_PROXY_FLAGS_NONE, NULL,
ERR("Unable to create proxy: %s", error->message);
g_clear_error(&error);
}
- return -1;
+ return BLUETOOTH_ERROR_INTERNAL;
}
/* Create Hash*/
GVariant *temp = g_variant_new("(s@a{sv})", ptr, args);
+ g_is_pbap_connecting = TRUE;
g_dbus_proxy_call(g_pbap_proxy, "CreateSession",
temp,
G_DBUS_CALL_FLAGS_NONE, -1, NULL,
(GAsyncReadyCallback)__bt_pbap_connect_cb, ptr);
BT_DBG("-");
- return 0;
+ return BLUETOOTH_ERROR_NONE;
}
void __bt_pbap_disconnect_cb(GDBusProxy *proxy,
G_DBUS_CALL_FLAGS_NONE, -1, NULL,
(GAsyncReadyCallback)__bt_pbap_disconnect_cb, ptr);
- return 0;
+ return BLUETOOTH_ERROR_NONE;
}
void __bt_pbap_select_cb(GDBusProxy *proxy,