int ret;
int value;
- ret = _bt_get_adapter_path(_bt_gdbus_get_system_gconn(), NULL);
+ ret = _bt_get_adapter_path(_bt_get_system_private_conn(), NULL);
if (ret != BLUETOOTH_ERROR_NONE)
return BLUETOOTH_ADAPTER_LE_DISABLED;
#ifndef TIZEN_TEST_EMUL
int ret;
- ret = _bt_get_adapter_path(_bt_gdbus_get_system_gconn(), NULL);
+ ret = _bt_get_adapter_path(_bt_get_system_private_conn(), NULL);
if (ret != BLUETOOTH_ERROR_NONE)
return BLUETOOTH_ADAPTER_DISABLED;
GDBusProxy *proxy = NULL;
GDBusConnection *conn = NULL;
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, NULL);
proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
#include "bt-dpm.h"
#endif
-
static bt_user_info_t user_info[BT_MAX_USER_INFO];
-static GDBusConnection *system_gdbus_conn = NULL;
-
+static GDBusConnection *system_shared_conn = NULL;
+static GDBusConnection *system_private_conn = NULL;
static guint bus_id;
-static GDBusConnection *system_gconn = NULL;
-
static gboolean bt_enabled = FALSE;
#define DBUS_TIMEOUT 20 * 1000 /* 20 Seconds */
-GDBusConnection *g_bus_get_private_conn(void)
+static GDBusConnection *g_bus_get_private_conn(void)
{
GError *error = NULL;
char *address;
return private_gconn;
}
-GDBusConnection *_bt_gdbus_init_system_gconn(void)
+GDBusConnection *_bt_get_system_private_conn(void)
{
- if (system_gconn != NULL)
- return system_gconn;
-
- system_gconn = g_bus_get_private_conn();
+ 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_gconn;
+ return system_private_conn;
}
-GDBusConnection *_bt_gdbus_get_system_gconn(void)
+GDBusConnection *_bt_get_system_shared_conn(void)
{
- if (system_gconn == NULL)
- system_gconn = _bt_gdbus_init_system_gconn();
- else if (g_dbus_connection_is_closed(system_gconn))
- system_gconn = g_bus_get_private_conn();
-
- return system_gconn;
+ if (system_shared_conn == NULL) {
+ GError *error = NULL;
+ system_shared_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_shared_conn;
}
void _bt_print_device_address_t(const bluetooth_device_address_t *addr)
static GDBusProxy *profile_gproxy;
-static GDBusConnection *gconn;
static int latest_id = -1;
#define BT_RFCOMM_ID_MAX 245
static gboolean id_used[BT_RFCOMM_ID_MAX];
latest_id = id - 1;
}
-static GDBusConnection *__get_gdbus_connection()
-{
- if (gconn == NULL)
- gconn = g_bus_get_private_conn();
-
- return gconn;
-}
-
static GDBusProxy *__bt_gdbus_get_profile_proxy(void)
{
GDBusConnection *gconn;
if (profile_gproxy)
return profile_gproxy;
- gconn = __get_gdbus_connection();
+ gconn = _bt_get_system_private_conn();
if (gconn == NULL)
return NULL;
GError *err = NULL;
GDBusProxy *device_gproxy;
- gconn = __get_gdbus_connection();
+ gconn = _bt_get_system_private_conn();
if (gconn == NULL)
return NULL;
{
GDBusConnection *gconn;
- gconn = _bt_init_system_gdbus_conn();
+ gconn = _bt_get_system_shared_conn();
if (gconn == NULL)
return;
GError *error = NULL;
char *bus_name;
- gconn = _bt_init_system_gdbus_conn();
+ gconn = _bt_get_system_shared_conn();
if (gconn == NULL)
return -1;
GVariant *result = NULL;
char *adapter_path = NULL;
- conn = __get_gdbus_connection();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, NULL);
manager_proxy = g_dbus_proxy_new_sync(conn,
int id;
GError *error = NULL;
- gconn = _bt_init_system_gdbus_conn();
+ gconn = _bt_get_system_shared_conn();
if (gconn == NULL)
return -1;
int result = BLUETOOTH_ERROR_INTERNAL;
BT_INFO("+");
retv_if(remote_uuid == NULL, BLUETOOTH_ERROR_INTERNAL);
- gconn = __get_gdbus_connection();
+ gconn = _bt_get_system_private_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 = __get_gdbus_connection();
+ gconn = _bt_get_system_private_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_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, NULL);
proxy = g_dbus_proxy_new_sync(conn,
return object_path;
}
-GDBusConnection *_bt_init_system_gdbus_conn(void)
-{
- GError *error = NULL;
- if (system_gdbus_conn == NULL) {
- system_gdbus_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_gdbus_conn;
-}
-
-
int _bt_register_osp_server_in_agent(int type, char *uuid, char *path, int fd)
{
int ret;
BT_DBG("+");
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, NULL);
manager_proxy = g_dbus_proxy_new_sync(g_conn,
{
int ret;
- _bt_gdbus_init_system_gconn();
+ _bt_get_system_private_conn();
ret = _bt_init_event_handler();
if (ret != BLUETOOTH_ERROR_NONE &&
_bt_gdbus_deinit_proxys();
- if (system_gconn) {
- g_object_unref(system_gconn);
- system_gconn = NULL;
+ if (system_private_conn) {
+ g_object_unref(system_private_conn);
+ system_private_conn = NULL;
}
return BLUETOOTH_ERROR_NONE;
return BLUETOOTH_ERROR_INTERNAL;
}
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
if (connection_type == NULL)
return BLUETOOTH_ERROR_INTERNAL;
return BLUETOOTH_ERROR_INTERNAL;
}
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
event_list = g_slist_remove(event_list, (void *)cb_data);
{
GDBusConnection *connection_type;
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
if (connection_type == NULL) {
BT_ERR("Unable to get the bus");
return;
{
GDBusConnection *connection_type;
- connection_type = _bt_gdbus_get_system_gconn();
+ connection_type = _bt_get_system_private_conn();
if (connection_type != NULL && owner_sig_id > 0) {
g_dbus_connection_signal_unsubscribe(connection_type,
owner_sig_id);
GVariant *ret = NULL;
GVariant *value = NULL;
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
ret_if(g_conn == NULL);
proxy = g_dbus_proxy_new_sync(g_conn,
static guint service_added_id = 0;
static guint interface_removed_id = 0;
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
if (g_conn == NULL)
return BLUETOOTH_ERROR_INTERNAL;
BT_CHECK_PARAMETER(service, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_PARAMETER(service_handle, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_PARAMETER(char_uuid, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_DBG("+");
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
BT_CHECK_PARAMETER(chr, return);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
resp_data = g_malloc0(sizeof(bt_gatt_resp_data_t));
int att_ecode = 0;
bt_gatt_resp_data_t *resp_data = user_data;
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED_INTERNAL(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
const gchar *key;
char_descriptor_type_t desc_type = TYPE_NONE;
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_PARAMETER(characteristic_handle, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_DBG("+");
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
BT_CHECK_PARAMETER(desc, return);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
resp_data = g_malloc0(sizeof(bt_gatt_resp_data_t));
BT_DBG("+");
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
BT_INFO_C("### Enable CCCD : %s [%s]", char_handle + 15, svc_name);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
g_dbus_connection_call_sync(conn,
BT_INFO("Disable CCCD : %s", char_handle);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
g_dbus_connection_call_sync(conn,
GDBusProxy *proxy;
GError *err = NULL;
- g_conn = _bt_init_system_gdbus_conn();
+ g_conn = _bt_get_system_shared_conn();
if (!g_conn) {
BT_ERR("Unable to get connection");
return NULL;
return BLUETOOTH_ERROR_ALREADY_INITIALIZED;
}
- g_conn = _bt_init_system_gdbus_conn();
+ g_conn = _bt_get_system_shared_conn();
if (!g_conn) {
BT_ERR("Unable to get connection");
goto failed;
GDBusProxy *proxy = NULL;
GDBusConnection *conn = NULL;
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, NULL);
proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
int index1 = 0;
int index2 = 0;
GUnixFDList *out_fd_list = NULL;
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
adapter_path = _bt_get_device_object_path((char *)address);
GDBusProxy *proxy;
GError *err = NULL;
- service_gconn = _bt_gdbus_get_system_gconn();
+ service_gconn = _bt_get_system_private_conn();
if (!service_gconn)
return NULL;
int ret = BLUETOOTH_TELEPHONY_ERROR_NONE;
FN_START;
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_TELEPHONY_ERROR_INTERNAL);
manager_proxy = g_dbus_proxy_new_sync(
/* As a result of discussion with system team, private connection is not
* suitable in here. It is better to use shared connection. */
//telephony_dbus_info.conn = _bt_gdbus_init_system_gconn();
- telephony_dbus_info.conn = _bt_init_system_gdbus_conn();
+ telephony_dbus_info.conn = _bt_get_system_shared_conn();
if (!telephony_dbus_info.conn) {
is_initialized = FALSE;
BT_ERR("Could not get DBus Connection");
return BLUETOOTH_TELEPHONY_ERROR_PERMISSION_DENIED;
}
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
if (!conn) {
BT_DBG("No System Bus found\n");
return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
return BLUETOOTH_TELEPHONY_ERROR_PERMISSION_DENIED;
}
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
if (!conn) {
BT_DBG("No System Bus found\n");
return BLUETOOTH_TELEPHONY_ERROR_INTERNAL;
int _bt_register_new_conn_ex(const char *path, const char *bus_name, bt_new_connection_cb cb);
void _bt_swap_addr(unsigned char *dst, const unsigned char *src);
-GDBusConnection *_bt_init_system_gdbus_conn(void);
-
-GDBusConnection *g_bus_get_private_conn(void);
-
-//GDBusConnection *_bt_get_system_gconn(void);
-
-//GDBusConnection *_bt_get_system_conn(void);
-
int _bt_register_osp_server_in_agent(int type, char *uuid, char *path, int fd);
int _bt_unregister_osp_server_in_agent(int type, char *uuid);
-
int _bt_check_privilege(int service_type, int service_function);
-GDBusConnection *_bt_gdbus_init_system_gconn(void);
-
-GDBusConnection *_bt_gdbus_get_system_gconn(void);
+GDBusConnection *_bt_get_system_shared_conn(void);
+GDBusConnection *_bt_get_system_private_conn(void);
GVariant *_bt_get_managed_objects(void);
" </interface>"
"</node>";
-GSList *_bt_get_service_list_from_server(int instance)
+static GSList *_bt_get_service_list_from_server(int instance)
{
GSList *l;
INFO("Number of GATT Server apps [%d]", g_slist_length(gatt_server_apps));
return NULL;
}
-void _bt_remote_service_from_gatt_server(int instance, int service_handle)
+static void _bt_remote_service_from_gatt_server(int instance, int service_handle)
{
GSList *l;
GSList *l1;
}
}
-void _bt_hal_update_gatt_service_in_gatt_server(int slot, struct gatt_service_info *serv_info)
+static void _bt_hal_update_gatt_service_in_gatt_server(int slot, struct gatt_service_info *serv_info)
{
GSList *l;
for (l = gatt_server_apps; l; l = g_slist_next(l)) {
return NULL;
}
-char *__bt_gatt_find_char_path_from_handle(int char_hdl)
+static char *__bt_gatt_find_char_path_from_handle(int char_hdl)
{
GSList *l1, *l2;
return NULL;
}
-struct gatt_char_info *__bt_gatt_find_char_info_from_handle(int char_hdl)
+static struct gatt_char_info *__bt_gatt_find_char_info_from_handle(int char_hdl)
{
GSList *l1, *l2;
g_dbus_method_invocation_return_value(invocation, NULL);
}
-gboolean __bt_hal_gatt_emit_interface_removed(gchar *object_path, gchar *interface)
+static gboolean __bt_hal_gatt_emit_interface_removed(gchar *object_path, gchar *interface)
{
gboolean ret;
GError *error = NULL;
return BT_STATUS_SUCCESS;
}
-void _bt_hal_remove_gatt_server_from_list(int server_if)
+static void _bt_hal_remove_gatt_server_from_list(int server_if)
{
GSList *l;
struct gatt_server_app *info = NULL;
return strdup(uuid);
}
-int __bt_hal_add_service_to_dbus(char *app_path, int slot, btgatt_srvc_id_t *srvc_id)
+static int __bt_hal_add_service_to_dbus(char *app_path, int slot, btgatt_srvc_id_t *srvc_id)
{
gboolean ret;
/* For GATT service specific */
return BT_STATUS_SUCCESS;
}
-void _bt_hal_is_gatt_server_initialzed(int slot, char **app_path)
+static void _bt_hal_is_gatt_server_initialzed(int slot, char **app_path)
{
GSList *l;
*app_path = NULL;
}
-void _bt_hal_update_gatt_server_path(int slot, char *app_path)
+static void _bt_hal_update_gatt_server_path(int slot, char *app_path)
{
if (app_path == NULL)
return;