static bt_user_info_t user_info[BT_MAX_USER_INFO];
static GDBusConnection *system_shared_conn = NULL;
-static GDBusConnection *system_private_conn = NULL;
+static GDBusConnection *system_common_conn = NULL;
static guint bus_id;
#define DBUS_TIMEOUT 20 * 1000 /* 20 Seconds */
+#if 0 // Remain this code for private connection in later.
static GDBusConnection *g_bus_get_private_conn(void)
{
GError *error = NULL;
return private_gconn;
}
+#endif
-GDBusConnection *_bt_get_system_private_conn(void)
+// TODO: Need to use _bt_get_system_shared_conn in later.
+GDBusConnection *_bt_get_system_common_conn(void)
{
- if (system_private_conn == NULL)
- system_private_conn = g_bus_get_private_conn();
- else if (g_dbus_connection_is_closed(system_private_conn))
- system_private_conn = g_bus_get_private_conn();
-
- return system_private_conn;
+ if (system_common_conn == NULL) {
+ GError *error = NULL;
+ system_common_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ BT_ERR("GDBus connection Error : %s \n", error->message);
+ g_clear_error(&error);
+ return NULL;
+ }
+ }
+ return system_common_conn;
}
GDBusConnection *_bt_get_system_shared_conn(void)
GError *err = NULL;
GDBusProxy *device_gproxy;
- gconn = _bt_get_system_private_conn();
+ gconn = _bt_get_system_common_conn();
if (gconn == NULL)
return NULL;
GVariant *result = NULL;
char *adapter_path = NULL;
- conn = _bt_get_system_private_conn();
+ conn = _bt_get_system_common_conn();
retv_if(conn == NULL, NULL);
manager_proxy = g_dbus_proxy_new_sync(conn,
int result = BLUETOOTH_ERROR_INTERNAL;
retv_if(remote_uuid == NULL, BLUETOOTH_ERROR_INTERNAL);
- gconn = _bt_get_system_private_conn();
+ gconn = _bt_get_system_common_conn();
retv_if(gconn == NULL, BLUETOOTH_ERROR_INTERNAL);
object_path = _bt_get_device_object_path(address);
retv_if(object_path == NULL, BLUETOOTH_ERROR_INTERNAL);
unsigned int class = 0x00;
int ret = BLUETOOTH_ERROR_NONE;
- gconn = _bt_get_system_private_conn();
+ gconn = _bt_get_system_common_conn();
retv_if(gconn == NULL, BLUETOOTH_ERROR_INTERNAL);
object_path = _bt_get_device_object_path(address);
GDBusConnection *conn = NULL;
char *object_path = NULL;
- conn = _bt_get_system_private_conn();
+ conn = _bt_get_system_common_conn();
retv_if(conn == NULL, NULL);
proxy = g_dbus_proxy_new_sync(conn,
BT_DBG("+");
- g_conn = _bt_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, NULL);
manager_proxy = g_dbus_proxy_new_sync(g_conn,
{
int ret;
- _bt_get_system_private_conn();
+ _bt_get_system_common_conn();
ret = _bt_init_event_handler();
if (ret != BLUETOOTH_ERROR_NONE &&
profile_gproxy = NULL;
}
- if (system_private_conn) {
- g_object_unref(system_private_conn);
- system_private_conn = NULL;
- }
-
return BLUETOOTH_ERROR_NONE;
}