X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-service%2Fbt-service-device.c;h=d148791261635129faf7b4ae566adc5204164658;hb=7bb8200be3c3e4a57ae68e3e439793684132fa79;hp=206af0887f5c49b0d687eb88e6d6a0e5ef0e5e78;hpb=36fcc28373b2289d4dd0e972880c10e65027f73c;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-service/bt-service-device.c b/bt-service/bt-service-device.c index 206af08..d148791 100644 --- a/bt-service/bt-service-device.c +++ b/bt-service/bt-service-device.c @@ -1644,6 +1644,7 @@ int _bt_is_device_connected(bluetooth_device_address_t *device_address, { char *object_path = NULL; char address[BT_ADDRESS_STRING_SIZE] = { 0 }; + char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 }; GDBusProxy *device_proxy = NULL; GDBusProxy *adapter_proxy = NULL; GDBusConnection *conn; @@ -1656,8 +1657,12 @@ int _bt_is_device_connected(bluetooth_device_address_t *device_address, retv_if(device_address == NULL, BLUETOOTH_ERROR_INVALID_PARAM); retv_if(is_connected == NULL, BLUETOOTH_ERROR_INVALID_PARAM); + _bt_convert_addr_type_to_string(address, device_address->addr); + _bt_convert_addr_string_to_secure_string(secure_address, address); + *is_connected = FALSE; - BT_DBG("connection_type: %d", connection_type); + BT_DBG("%s connection_type: 0x%02x", secure_address, connection_type); + if (connection_type == BLUETOOTH_RFCOMM_SERVICE) return _bt_rfcomm_is_device_connected(device_address, is_connected); @@ -1721,11 +1726,10 @@ int _bt_is_device_connected(bluetooth_device_address_t *device_address, } else { uuid = _bt_get_profile_uuid128(connection_type); if (uuid == NULL) { - BT_ERR("uuid is NULL"); + BT_ERR("connection_type: %d, uuid is NULL", connection_type); return BLUETOOTH_ERROR_INTERNAL; } - - BT_DBG("uuid: %s", uuid); + BT_DBG("uuid %s [%s]", uuid, _bt_convert_uuid_to_string(uuid)); object_path = _bt_get_device_object_path(address); retv_if(object_path == NULL, BLUETOOTH_ERROR_NOT_PAIRED); @@ -1895,6 +1899,7 @@ static int __bt_connect_le_device_internal(int req_id, const bluetooth_device_ad gboolean auto_connect) { char device_address[BT_ADDRESS_STRING_SIZE] = { 0 }; + char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 }; gchar *device_path = NULL; GDBusProxy *device_proxy = NULL; GDBusConnection *conn; @@ -1935,6 +1940,9 @@ static int __bt_connect_le_device_internal(int req_id, const bluetooth_device_ad goto fail; } + _bt_convert_addr_string_to_secure_string(secure_address, device_address); + BT_INFO("Connect LE [%s]", secure_address); + func_data->req_id = req_id; g_dbus_proxy_call(device_proxy, "ConnectLE", @@ -2011,6 +2019,7 @@ int _bt_disconnect_le_device(int req_id, const bluetooth_device_address_t *bd_addr) { char device_address[BT_ADDRESS_STRING_SIZE] = { 0 }; + char secure_address[BT_ADDRESS_STRING_SIZE] = { 0 }; gchar *device_path; GDBusProxy *device_proxy; GDBusConnection *conn; @@ -2053,6 +2062,9 @@ int _bt_disconnect_le_device(int req_id, goto fail; } + _bt_convert_addr_string_to_secure_string(secure_address, device_address); + BT_INFO("Disconnect LE [%s]", secure_address); + func_data->req_id = req_id; g_dbus_proxy_call(device_proxy, "DisconnectLE", @@ -2236,47 +2248,6 @@ int _bt_connect_profile(char *address, char *uuid, return BLUETOOTH_ERROR_NONE; } -int _bt_disconnect_all(char *address) -{ - int ret = BLUETOOTH_ERROR_NONE; - char *object_path; - GDBusProxy *proxy; - GDBusConnection *conn; - GVariant *result = NULL; - GError *err = NULL; - - BT_DBG(""); - conn = _bt_gdbus_get_system_gconn(); - retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL); - - object_path = _bt_get_device_object_path(address); - retv_if(object_path == NULL, BLUETOOTH_ERROR_INTERNAL); - - proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, - NULL, BT_BLUEZ_NAME, - object_path, BT_DEVICE_INTERFACE, NULL, NULL); - g_free(object_path); - retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL); - - result = g_dbus_proxy_call_sync(proxy, "Disconnect", - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, NULL, - &err); - - if (err != NULL) { - BT_ERR("Dbus Call Error:[%s]", err->message); - g_error_free(err); - ret = BLUETOOTH_ERROR_INTERNAL; - } - - g_object_unref(proxy); - if (result) - g_variant_unref(result); - - return ret; -} - int _bt_disconnect_profile(char *address, char *uuid, void *cb, gpointer func_data) { @@ -3226,7 +3197,7 @@ int _bt_get_device_ida(bluetooth_device_address_t *device_address, if (result == NULL) { BT_ERR("Failed to get device ID address"); if (error != NULL) { - BT_ERR("Error occured in Proxy call [%s]\n", error->message); + BT_ERR("Error occured in Proxy call [%s]", error->message); g_error_free(error); } g_object_unref(device_proxy);