Change the name of dbus property of EIR manufacturer data
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-device.c
index 206af08..4f19add 100644 (file)
@@ -455,7 +455,7 @@ bt_remote_dev_info_t *_bt_get_remote_device_info_by_object_path(
                        g_variant_unref(tmp_value);
                }
 
-               tmp_value = g_variant_lookup_value(value, "ManufacturerDataLen", G_VARIANT_TYPE_UINT16);
+               tmp_value = g_variant_lookup_value(value, "LegacyManufacturerDataLen", G_VARIANT_TYPE_UINT16);
                if (tmp_value) {
                        dev_info->manufacturer_data_len = g_variant_get_uint16(tmp_value);
                        if (dev_info->manufacturer_data_len > BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX) {
@@ -466,7 +466,7 @@ bt_remote_dev_info_t *_bt_get_remote_device_info_by_object_path(
                } else
                        dev_info->manufacturer_data_len = 0;
 
-               tmp_value = g_variant_lookup_value(value, "ManufacturerData", G_VARIANT_TYPE_ARRAY);
+               tmp_value = g_variant_lookup_value(value, "LegacyManufacturerData", G_VARIANT_TYPE_ARRAY);
                if (tmp_value) {
                        if ((dev_info->manufacturer_data_len == 0) ||
                                        dev_info->manufacturer_data_len != g_variant_get_size(tmp_value)) {
@@ -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);