diff options
author | Taejin Woo <tt.woo@samsung.com> | 2016-09-28 13:50:51 +0900 |
---|---|---|
committer | Taejin Woo <tt.woo@samsung.com> | 2016-09-28 13:51:29 +0900 |
commit | b2cbbd84c2a69ee85eeea90364f9994cf03b7dd5 (patch) | |
tree | 6537f68d0d71eb0c30a0118985073467e8cfc116 | |
parent | 16f7b4f10da67b54254d83e8e4a57f0f17cd4004 (diff) | |
download | bluetooth-b2cbbd84c2a69ee85eeea90364f9994cf03b7dd5.tar.gz bluetooth-b2cbbd84c2a69ee85eeea90364f9994cf03b7dd5.tar.bz2 bluetooth-b2cbbd84c2a69ee85eeea90364f9994cf03b7dd5.zip |
Remove unused file and fix memory leaksubmit/tizen/20161003.235123accepted/tizen/wearable/20161004.075603
Change-Id: I3f4092a950f0f27b06976970e0195a0c7d47f1af
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/bt-dbus-method.h | 57 | ||||
-rw-r--r-- | src/bt-dbus-method.c | 215 | ||||
-rw-r--r-- | src/bt-main-view.c | 3 | ||||
-rw-r--r-- | src/bt-popup.c | 1 | ||||
-rw-r--r-- | src/bt-profile-view.c | 1 |
6 files changed, 2 insertions, 276 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ffe186c..ec3ae7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,6 @@ SET(SRCS src/bt-handler.c src/bt-popup.c src/bt-util.c - src/bt-dbus-method.c ) IF (TELEPHONY_DISABLED) diff --git a/include/bt-dbus-method.h b/include/bt-dbus-method.h deleted file mode 100644 index bc0c206..0000000 --- a/include/bt-dbus-method.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2000-2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Flora License, Version 1.1 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __BT_DBUS_METHOD_H__ -#define __BT_DBUS_METHOD_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <glib.h> -#include <dbus/dbus.h> -#include <dbus/dbus-glib-bindings.h> - -#define BT_ADAPTER_PATH_LEN 50 - -#define BLUEZ_DBUS_NAME "org.bluez" -#define MANAGER_INTERFACE "org.bluez.Manager" -#define ADAPTER_INTERFACE "org.bluez.Adapter" -#define HID_INTERFACE "org.bluez.Input" -#define HEADSET_INTERFACE "org.bluez.Headset" -#define SYNK_INTERFACE "org.bluez.AudioSink" -#define NETWORK_INTERFACE "org.bluez.Network" -#define NETWORK_SERVER_INTERFACE "org.bluez.NetworkServer" - -#define AGENT_NAME "org.projectx.bt" -#define AGENT_PATH "/org/tizen/adapter_agent" -#define AGENT_INTERFACE "org.bluez.Agent" - -#define BT_CORE_NAME "org.projectx.bt_core" -#define BT_CORE_PATH "/org/projectx/bt_core" -#define BT_CORE_INTERFACE "org.projectx.btcore" - -DBusGProxy *_bt_get_adapter_proxy(DBusGConnection *conn); - -gboolean _bt_is_profile_connected(int connected_type, - DBusGConnection *conn, - unsigned char *addr); - -#ifdef __cplusplus -} -#endif -#endif /* __BT_DBUS_METHOD_H__ */ diff --git a/src/bt-dbus-method.c b/src/bt-dbus-method.c deleted file mode 100644 index 07fd48c..0000000 --- a/src/bt-dbus-method.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2000-2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Flora License, Version 1.1 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://floralicense.org/license/ - - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include <glib.h> -#include <dbus/dbus.h> -#include <dbus/dbus-glib-bindings.h> - -#include "bt-main.h" -#include "bt-type-define.h" -#include "bt-util.h" -#include "bt-dbus-method.h" - - -/********************************************************************** -* Static Functions -***********************************************************************/ - -int __bt_get_adapter_path(DBusGConnection *GConn, char *path) -{ - FN_START; - - GError *error = NULL; - DBusGProxy *manager_proxy = NULL; - char *adapter_path = NULL; - int ret = BT_APP_ERROR_NONE; - gsize len = 0; - - retv_if(GConn == NULL, -1); - retv_if(path == NULL, -1); - - manager_proxy = dbus_g_proxy_new_for_name(GConn, BLUEZ_DBUS_NAME, "/", - "org.bluez.Manager"); - - retv_if(manager_proxy == NULL, -1); - - dbus_g_proxy_call(manager_proxy, "DefaultAdapter", &error, - G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, &adapter_path, - G_TYPE_INVALID); - - if (error != NULL) { - ERR("Getting DefaultAdapter failed: [%s]", error->message); - g_error_free(error); - g_object_unref(manager_proxy); - return -1; - } - - if (adapter_path == NULL) { - g_object_unref(manager_proxy); - return -1; - } - - len = g_strlcpy(path, adapter_path, BT_ADAPTER_PATH_LEN); - - if (len >= BT_ADAPTER_PATH_LEN) { - ERR("The copied len is too large"); - ret = -1; - } - - g_object_unref(manager_proxy); - g_free(adapter_path); - - FN_END; - return ret; -} - - -/********************************************************************** -* Common Functions -***********************************************************************/ - -DBusGProxy *_bt_get_adapter_proxy(DBusGConnection *conn) -{ - FN_START; - DBusGProxy *adapter = NULL; - char adapter_path[BT_ADAPTER_PATH_LEN] = { 0 }; - - retv_if(conn == NULL, NULL); - - if (__bt_get_adapter_path(conn, adapter_path) < 0) { - ERR("Could not get adapter path"); - return NULL; - } - - adapter = dbus_g_proxy_new_for_name(conn, BLUEZ_DBUS_NAME, - adapter_path, ADAPTER_INTERFACE); - - FN_END; - return adapter; -} - -gboolean _bt_is_profile_connected(int connected_type, - DBusGConnection *conn, - unsigned char *addr) -{ - FN_START; - char *object_path = NULL; - char addr_str[BT_ADDRESS_STR_LEN + 1] = { 0 }; - gboolean connected = FALSE; - DBusGProxy *proxy = NULL; - DBusGProxy *adapter = NULL; - GError *error = NULL; - GHashTable *hash = NULL; - GValue *value = NULL; - char *interface = NULL; - char path[BT_ADAPTER_PATH_LEN + 1] = {0}; - - retv_if(conn == NULL, FALSE); - retv_if(addr == NULL, FALSE); - - _bt_util_addr_type_to_addr_string(addr_str, addr); - - if (connected_type == BT_NETWORK_SERVER_CONNECTED) { - if (__bt_get_adapter_path(conn, path) != BT_APP_ERROR_NONE) - return FALSE; - - object_path = g_strdup(path); - } else { - adapter = _bt_get_adapter_proxy(conn); - - retv_if(adapter == NULL, FALSE); - - dbus_g_proxy_call(adapter, "FindDevice", - &error, G_TYPE_STRING, addr_str, - G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, - &object_path, G_TYPE_INVALID); - - g_object_unref(adapter); - - if (error != NULL) { - ERR("Failed to Find device: %s", error->message); - g_error_free(error); - return FALSE; - } - } - - retv_if(object_path == NULL, FALSE); - - switch (connected_type) { - case BT_HEADSET_CONNECTED: - interface = HEADSET_INTERFACE; - break; - case BT_STEREO_HEADSET_CONNECTED: - interface = SYNK_INTERFACE; - break; - case BT_HID_CONNECTED: - interface = HID_INTERFACE; - break; - case BT_NETWORK_CONNECTED: - interface = NETWORK_INTERFACE; - break; - case BT_NETWORK_SERVER_CONNECTED: - interface = NETWORK_SERVER_INTERFACE; - break; - default: - DBG("Unknown type!"); - g_free(object_path); - return FALSE; - } - - INFO("Interface: %s", interface); - - proxy = dbus_g_proxy_new_for_name(conn, BLUEZ_DBUS_NAME, object_path, interface); - - g_free(object_path); - - retv_if(proxy == NULL, FALSE); - - if (connected_type == BT_NETWORK_SERVER_CONNECTED) { - dbus_g_proxy_call(proxy, "GetProperties", &error, - G_TYPE_STRING, addr_str, - G_TYPE_INVALID, - dbus_g_type_get_map("GHashTable", - G_TYPE_STRING, G_TYPE_VALUE), - &hash, G_TYPE_INVALID); - - } else { - - dbus_g_proxy_call(proxy, "GetProperties", &error, - G_TYPE_INVALID, - dbus_g_type_get_map("GHashTable", - G_TYPE_STRING, G_TYPE_VALUE), - &hash, G_TYPE_INVALID); - } - - if (error != NULL) { - ERR("Failed to get properties: %s", error->message); - g_error_free(error); - g_object_unref(proxy); - return FALSE; - } - - if (hash != NULL) { - value = g_hash_table_lookup(hash, "Connected"); - connected = value ? g_value_get_boolean(value) : FALSE; - } - - g_object_unref(proxy); - FN_END; - return connected; -} diff --git a/src/bt-main-view.c b/src/bt-main-view.c index 74dc78d..28e7085 100644 --- a/src/bt-main-view.c +++ b/src/bt-main-view.c @@ -21,7 +21,6 @@ #include "bt-handler.h" #include "bt-util.h" #include "bt-type-define.h" -#include "bt-dbus-method.h" #include "bt-popup.h" #include "bt-profile-view.h" #include "bt-resource.h" @@ -946,6 +945,7 @@ static char *__bt_gl_bluetooth_label_get(void *data, Evas_Object *obj, const cha BT_STR_SWITCH_FOR_TTS, BT_STR_OFF_FOR_TTS); DBG("new_access_info : %s", new_access_info); elm_access_info_set(access_obj, ELM_ACCESS_INFO, new_access_info); + g_free(new_access_info); } return g_strdup(BT_STR_BLUETOOTH); } else if (!strcmp(part, "elm.text.1")) { @@ -961,6 +961,7 @@ static char *__bt_gl_bluetooth_label_get(void *data, Evas_Object *obj, const cha BT_STR_ON_FOR_TTS); DBG("new_access_info : %s", new_access_info); elm_access_info_set(access_obj, ELM_ACCESS_INFO, new_access_info); + g_free(new_access_info); return g_strdup(BT_STR_VISIBLE); } return NULL; diff --git a/src/bt-popup.c b/src/bt-popup.c index 19bb6a6..f869f15 100644 --- a/src/bt-popup.c +++ b/src/bt-popup.c @@ -21,7 +21,6 @@ #include "bt-main-view.h" #include "bt-string.h" #include "bt-handler.h" -#include "bt-dbus-method.h" #include "bt-popup.h" #include "bt-util.h" #include "bt-resource.h" diff --git a/src/bt-profile-view.c b/src/bt-profile-view.c index 8fde599..5a31ade 100644 --- a/src/bt-profile-view.c +++ b/src/bt-profile-view.c @@ -22,7 +22,6 @@ #include "bt-main.h" #include "bt-main-view.h" #include "bt-popup.h" -#include "bt-dbus-method.h" #include "bt-type-define.h" #include "bt-string.h" #include "bt-profile-view.h" |