From: Wootak Jung Date: Wed, 23 Jan 2019 04:57:50 +0000 (+0900) Subject: Remove unnecessary connection getting functions X-Git-Tag: submit/tizen/20190124.075029^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git;a=commitdiff_plain;h=412bfd641f5d1d78310b5a49ca80cf45b990138e Remove unnecessary connection getting functions Remove duplicated function _bt_gdbus_init_system_gconn() Remove duplicated function __get_gdbus_connection() Rename _bt_gdbus_get_system_gconn() to _bt_get_system_private_conn() Rename _bt_init_system_gdbus_conn() to _bt_get_system_shared_conn() Add 'static' keyword for static functions Change-Id: I85571703b1c9a74365c83dc9d701cb418963ae59 --- diff --git a/bt-api/bt-adapter-le.c b/bt-api/bt-adapter-le.c index 31c1c74..8554da0 100644 --- a/bt-api/bt-adapter-le.c +++ b/bt-api/bt-adapter-le.c @@ -33,7 +33,7 @@ BT_EXPORT_API int bluetooth_check_adapter_le(void) 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; diff --git a/bt-api/bt-adapter.c b/bt-api/bt-adapter.c index 1b0de98..ef01810 100644 --- a/bt-api/bt-adapter.c +++ b/bt-api/bt-adapter.c @@ -64,7 +64,7 @@ BT_EXPORT_API int bluetooth_check_adapter(void) #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; diff --git a/bt-api/bt-audio.c b/bt-api/bt-audio.c index e890624..d569f87 100644 --- a/bt-api/bt-audio.c +++ b/bt-api/bt-audio.c @@ -507,7 +507,7 @@ static GVariant* __bt_hf_agent_dbus_send(const char *path, const char *interface 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, diff --git a/bt-api/bt-common.c b/bt-api/bt-common.c index ed4ddba..23e9ab3 100644 --- a/bt-api/bt-common.c +++ b/bt-api/bt-common.c @@ -49,20 +49,17 @@ #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; @@ -95,24 +92,28 @@ GDBusConnection *g_bus_get_private_conn(void) 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) @@ -747,7 +748,6 @@ gboolean _bt_utf8_validate(char *name) 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]; @@ -888,14 +888,6 @@ void __rfcomm_delete_id(int id) 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; @@ -904,7 +896,7 @@ static GDBusProxy *__bt_gdbus_get_profile_proxy(void) if (profile_gproxy) return profile_gproxy; - gconn = __get_gdbus_connection(); + gconn = _bt_get_system_private_conn(); if (gconn == NULL) return NULL; @@ -928,7 +920,7 @@ static GDBusProxy *__bt_gdbus_get_device_proxy(char *object_path) GError *err = NULL; GDBusProxy *device_gproxy; - gconn = __get_gdbus_connection(); + gconn = _bt_get_system_private_conn(); if (gconn == NULL) return NULL; @@ -951,7 +943,7 @@ void _bt_unregister_gdbus(int object_id) { GDBusConnection *gconn; - gconn = _bt_init_system_gdbus_conn(); + gconn = _bt_get_system_shared_conn(); if (gconn == NULL) return; @@ -983,7 +975,7 @@ int _bt_register_new_conn(const char *path, bt_new_connection_cb cb) GError *error = NULL; char *bus_name; - gconn = _bt_init_system_gdbus_conn(); + gconn = _bt_get_system_shared_conn(); if (gconn == NULL) return -1; @@ -1021,7 +1013,7 @@ static GDBusProxy * __bt_gdbus_get_adapter_proxy() 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, @@ -1088,7 +1080,7 @@ int _bt_register_new_conn_ex(const char *path, const char *bus_name, bt_new_conn int id; GError *error = NULL; - gconn = _bt_init_system_gdbus_conn(); + gconn = _bt_get_system_shared_conn(); if (gconn == NULL) return -1; @@ -1508,7 +1500,7 @@ int _bt_discover_service_uuids(char *address, char *remote_uuid) 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); @@ -1578,7 +1570,7 @@ int _bt_get_cod_by_address(char *address, bluetooth_device_class_t *dev_class) 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); @@ -1834,7 +1826,7 @@ char *_bt_get_device_object_path(char *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, @@ -1877,23 +1869,6 @@ fail: 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; @@ -1966,7 +1941,7 @@ GVariant *_bt_get_managed_objects(void) 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, @@ -2329,7 +2304,7 @@ BT_EXPORT_API int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr { int ret; - _bt_gdbus_init_system_gconn(); + _bt_get_system_private_conn(); ret = _bt_init_event_handler(); if (ret != BLUETOOTH_ERROR_NONE && @@ -2401,9 +2376,9 @@ BT_EXPORT_API int bluetooth_unregister_callback(void) _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; diff --git a/bt-api/bt-event-handler.c b/bt-api/bt-event-handler.c index 810984a..6a3ce72 100644 --- a/bt-api/bt-event-handler.c +++ b/bt-api/bt-event-handler.c @@ -4037,7 +4037,7 @@ int _bt_register_event(int event_type, void *event_cb, void *user_data) 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; @@ -4078,7 +4078,7 @@ int _bt_unregister_event(int event_type) 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); @@ -4126,7 +4126,7 @@ void _bt_register_name_owner_changed(void) { 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; @@ -4141,7 +4141,7 @@ void _bt_unregister_name_owner_changed(void) { 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); @@ -4157,7 +4157,7 @@ static void __bt_gatt_get_uuid_from_path(char *path, char **service_uuid) 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, @@ -4279,7 +4279,7 @@ int _bt_register_manager_subscribe_signal(gboolean subscribe) 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; diff --git a/bt-api/bt-gatt-client.c b/bt-api/bt-gatt-client.c index a473a37..1b4cada 100755 --- a/bt-api/bt-gatt-client.c +++ b/bt-api/bt-gatt-client.c @@ -223,7 +223,7 @@ BT_EXPORT_API int bluetooth_gatt_get_service_property(const char *service_handle 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, @@ -530,7 +530,7 @@ BT_EXPORT_API int bluetooth_gatt_discover_service_characteristics( 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, @@ -654,7 +654,7 @@ BT_EXPORT_API int bluetooth_gatt_get_characteristics_property( 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, @@ -819,7 +819,7 @@ BT_EXPORT_API int bluetooth_gatt_get_char_from_uuid(const char *service_handle, 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, @@ -865,7 +865,7 @@ BT_EXPORT_API int bluetooth_gatt_get_char_descriptor_property( 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, @@ -995,7 +995,7 @@ static void __bluetooth_internal_read_cb(GObject *source_object, 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); @@ -1056,7 +1056,7 @@ BT_EXPORT_API int bluetooth_gatt_read_characteristic_value(const char *chr, 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)); @@ -1093,7 +1093,7 @@ static void __bluetooth_internal_write_cb(GObject *source_object, 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); @@ -1146,7 +1146,7 @@ BT_EXPORT_API int bluetooth_gatt_set_characteristics_value( 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")); @@ -1211,7 +1211,7 @@ BT_EXPORT_API int bluetooth_gatt_set_characteristics_value_by_type( 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")); @@ -1266,7 +1266,7 @@ BT_EXPORT_API int bluetooth_gatt_set_characteristics_value_request( 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")); @@ -1325,7 +1325,7 @@ static int __bluetooth_gatt_descriptor_iter(const char *char_handle, 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, @@ -1490,7 +1490,7 @@ BT_EXPORT_API int bluetooth_gatt_discover_characteristic_descriptor( 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, @@ -1531,7 +1531,7 @@ static void __bluetooth_internal_read_desc_cb(GObject *source_object, 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); @@ -1595,7 +1595,7 @@ BT_EXPORT_API int bluetooth_gatt_read_descriptor_value(const char *desc, 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)); @@ -1635,7 +1635,7 @@ static void __bluetooth_internal_write_desc_cb(GObject *source_object, 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); @@ -1689,7 +1689,7 @@ BT_EXPORT_API int bluetooth_gatt_write_descriptor_value(const char *desc, 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")); @@ -1739,7 +1739,7 @@ BT_EXPORT_API int bluetooth_gatt_watch_characteristics(const char *char_handle, 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, @@ -1789,7 +1789,7 @@ BT_EXPORT_API int bluetooth_gatt_unwatch_characteristics(const char *char_handle 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, diff --git a/bt-api/bt-gatt-service.c b/bt-api/bt-gatt-service.c index f7d73ec..49e2f46 100644 --- a/bt-api/bt-gatt-service.c +++ b/bt-api/bt-gatt-service.c @@ -1399,7 +1399,7 @@ static GDBusProxy *__bt_gatt_gdbus_init_manager_proxy(const gchar *service, 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; @@ -1581,7 +1581,7 @@ BT_EXPORT_API int bluetooth_gatt_init(void) 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; diff --git a/bt-api/bt-hid-device.c b/bt-api/bt-hid-device.c index 50d04e0..803996f 100644 --- a/bt-api/bt-hid-device.c +++ b/bt-api/bt-hid-device.c @@ -97,7 +97,7 @@ static GVariant* __bt_hid_agent_dbus_send(const char *path, 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, @@ -472,7 +472,7 @@ int _bt_hid_device_get_fd(const char *address, int *ctrl, int *intr) 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); diff --git a/bt-api/bt-request-sender.c b/bt-api/bt-request-sender.c index 546711b..c31ab18 100644 --- a/bt-api/bt-request-sender.c +++ b/bt-api/bt-request-sender.c @@ -44,7 +44,7 @@ static GDBusProxy *__bt_gdbus_init_service_proxy(void) GDBusProxy *proxy; GError *err = NULL; - service_gconn = _bt_gdbus_get_system_gconn(); + service_gconn = _bt_get_system_private_conn(); if (!service_gconn) return NULL; diff --git a/bt-api/bt-telephony.c b/bt-api/bt-telephony.c index 61b6b27..fde8499 100644 --- a/bt-api/bt-telephony.c +++ b/bt-api/bt-telephony.c @@ -931,7 +931,7 @@ static int __bluetooth_telephony_get_connected_device(void) 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( @@ -1317,7 +1317,7 @@ BT_EXPORT_API int bluetooth_telephony_init(bt_telephony_func_ptr cb, /* 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"); @@ -1759,7 +1759,7 @@ BT_EXPORT_API int bluetooth_telephony_audio_open(void) 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; @@ -1832,7 +1832,7 @@ BT_EXPORT_API int bluetooth_telephony_audio_close(void) 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; diff --git a/bt-api/include/bt-common.h b/bt-api/include/bt-common.h index e7d3765..bda9c40 100644 --- a/bt-api/include/bt-common.h +++ b/bt-api/include/bt-common.h @@ -372,23 +372,13 @@ int _bt_register_new_conn(const char *path, bt_new_connection_cb cb); 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); diff --git a/bt-oal/bluez_hal/src/bt-hal-gatt-server.c b/bt-oal/bluez_hal/src/bt-hal-gatt-server.c index f35bc0c..bfeee9a 100644 --- a/bt-oal/bluez_hal/src/bt-hal-gatt-server.c +++ b/bt-oal/bluez_hal/src/bt-hal-gatt-server.c @@ -322,7 +322,7 @@ static const gchar manager_introspection_xml[] = " " ""; -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)); @@ -340,7 +340,7 @@ GSList *_bt_get_service_list_from_server(int instance) 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; @@ -360,7 +360,7 @@ void _bt_remote_service_from_gatt_server(int instance, int service_handle) } } -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)) { @@ -535,7 +535,7 @@ static struct gatt_service_info *__bt_gatt_find_gatt_service_from_char(const cha 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; @@ -553,7 +553,7 @@ char *__bt_gatt_find_char_path_from_handle(int char_hdl) 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; @@ -1426,7 +1426,7 @@ done: 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; @@ -1735,7 +1735,7 @@ static bt_status_t gatt_server_register_app(bt_uuid_t *uuid) 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; @@ -1898,7 +1898,7 @@ static char* __bt_hal_convert_uuid_to_string(bt_uuid_t *srvc_id) 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 */ @@ -2115,7 +2115,7 @@ static int __bt_hal_gatt_init(void) 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; @@ -2132,7 +2132,7 @@ void _bt_hal_is_gatt_server_initialzed(int slot, char **app_path) *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;