Apply tizen 3.0 based product patchsets
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-event-receiver.c
index a90803b..bb453f0 100644 (file)
@@ -1829,7 +1829,7 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path
                address = g_malloc0(BT_ADDRESS_STRING_SIZE);
 
                _bt_convert_device_path_to_address(path, address);
-               dev_name = _bt_get_bonded_device_name(address);
+               dev_name = _bt_get_device_name(address);
 
                _bt_convert_addr_string_to_secure_string(secure_address, address);
                BT_INFO("Address : %s Type : %d", secure_address, addr_type);
@@ -1945,17 +1945,17 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path
                        gboolean connected;
 #endif
                        bt_headset_wait_t *wait_list;
-                       guint restricted = 0x0;
+                       guint trusted = TRUE;
 
                        __bt_set_device_values(TRUE,
                                VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED);
 
                        __bt_connection_manager_set_state(address, event);
 
-                       _bt_get_restrict_profile(&bd_addr, RESTRICTED_PROFILE_HFP_HS, &restricted);
+                       _bt_get_trust_profile(&bd_addr, TRUSTED_PROFILE_HFP_HF, &trusted);
 
                        if (_bt_headset_get_local_connection() == FALSE) {
-                               if (restricted == 0x0) /* not restricted*/
+                               if (trusted == TRUE) /* not restricted*/
                                        _bt_start_timer_for_connection(address, BT_AUDIO_HSP);
                        } else {
                                /* Connection Started from local device therefore no need to
@@ -2251,6 +2251,8 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path
                param = g_variant_new("(iss)", result, address, ifname);
                ipsp_param = g_variant_new("(ss)", ifname, address);
 
+               g_free(ifname);
+
                /* Set Ipv6 Addr */
                GDBusProxy *ipsp_proxy;
                if (connected) {
@@ -2259,6 +2261,8 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path
                        if (ipsp_proxy == NULL) {
                                BT_ERR("can not get ipsp proxy");
                                g_free(address);
+                               g_variant_unref(param);
+                               g_variant_unref(ipsp_param);
                                return;
                        }
 
@@ -2266,11 +2270,13 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path
                                        ipsp_param, G_DBUS_CALL_FLAGS_NONE,
                                        -1, NULL, NULL, NULL);
                } else {
+                       g_variant_unref(ipsp_param);
                        BT_DBG("IPSP disconnected");
                        ipsp_proxy = _bt_get_ipsp_proxy();
                        if (ipsp_proxy == NULL) {
                                BT_ERR("can not get ipsp proxy");
                                g_free(address);
+                               g_variant_unref(param);
                                return;
                        }
 
@@ -2280,9 +2286,7 @@ void _bt_handle_device_event(GVariant *msg, const char *member, const char *path
                }
 
                /* Send event to application */
-               _bt_send_event(BT_DEVICE_EVENT,
-                                               event,
-                                               param);
+               _bt_send_event(BT_DEVICE_EVENT, event, param);
                g_free(address);
        } else if (strcasecmp(member, "AttMtuChanged") == 0) {
                int result = BLUETOOTH_ERROR_NONE;
@@ -2334,7 +2338,7 @@ void __bt_set_audio_values(gboolean connected, char *address)
 
        /*  Set the headset name */
        if (connected == TRUE)
-               name = _bt_get_bonded_device_name(address);
+               name = _bt_get_device_name(address);
        else
                name = g_strdup("");
 
@@ -2386,7 +2390,7 @@ void _bt_handle_headset_event(GVariant *msg, const char *path)
                int event = BLUETOOTH_EVENT_NONE;
                bt_headset_wait_t *wait_list;
                char *address;
-               guint restricted = 0x0;
+               guint trusted = TRUE;
                g_variant_get(value, "b", &property_flag);
 
                address = g_malloc0(BT_ADDRESS_STRING_SIZE);
@@ -2396,10 +2400,10 @@ void _bt_handle_headset_event(GVariant *msg, const char *path)
 
                if (property_flag == TRUE) {
                        event = BLUETOOTH_EVENT_AG_CONNECTED;
-                       _bt_get_restrict_profile(&bd_addr, RESTRICTED_PROFILE_A2DP, &restricted);
+                       _bt_get_trust_profile(&bd_addr, TRUSTED_PROFILE_A2DP, &trusted);
 
                        if (_bt_headset_get_local_connection() == FALSE) {
-                               if (restricted == 0x0) /* not restricted*/
+                               if (trusted == TRUE) /* not restricted*/
                                        _bt_start_timer_for_connection(address, BT_AUDIO_A2DP);
                        } else
                                _bt_headset_set_local_connection(FALSE);