Code optimize
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-avrcp-controller.c
index 39085ed..9c87873 100644 (file)
@@ -54,7 +54,6 @@ static bt_player_settinngs_t shuffle_settings[] = {
 };
 
 static char *avrcp_control_path = NULL;
-static char *avrcp_transport_path = NULL;
 
 void _bt_set_control_device_path(const char *path)
 {
@@ -105,33 +104,6 @@ static char *__bt_get_control_device_path(void)
        return control_path;
 }
 
-static char *__bt_get_transport_device_path(void)
-{
-       char *adapter_path;
-       char *transport_path;
-       char connected_address[BT_ADDRESS_STRING_SIZE + 1];
-
-       BT_DBG("+");
-
-       if (avrcp_transport_path != NULL)
-               return avrcp_transport_path;
-
-       retv_if(!_bt_is_headset_type_connected(BT_AVRCP,
-                       connected_address), NULL);
-
-       BT_DBG("device address = %s", connected_address);
-
-       adapter_path = _bt_get_device_object_path(connected_address);
-       retv_if(adapter_path == NULL, NULL);
-
-       transport_path = g_strdup_printf(BT_MEDIA_TRANSPORT_PATH, adapter_path);
-       g_free(adapter_path);
-
-       avrcp_transport_path = transport_path;
-       BT_DBG("transport_path = %s", transport_path);
-       return transport_path;
-}
-
 static int __bt_media_send_control_msg(const char *name)
 {
        GVariant *reply = NULL;
@@ -254,36 +226,6 @@ GDBusProxy *__bt_get_control_properties_proxy(void)
        return proxy;
 }
 
-GDBusProxy *__bt_get_transport_properties_proxy(void)
-{
-       GDBusProxy *proxy = NULL;
-       GError *error = NULL;
-       char *transport_path = NULL;
-       GDBusConnection *conn = NULL;
-
-       transport_path = __bt_get_transport_device_path();
-       retv_if(transport_path == NULL, NULL);
-       BT_DBG("transport_path = %s", transport_path);
-
-       conn = _bt_gdbus_get_system_gconn();
-       retv_if(conn == NULL, NULL);
-
-       proxy = g_dbus_proxy_new_sync(conn,
-                       G_DBUS_PROXY_FLAGS_NONE, NULL,
-                       BT_BLUEZ_NAME, transport_path,
-                       BT_PROPERTIES_INTERFACE, NULL, &error);
-       if (proxy == NULL) {
-               BT_ERR("Unable to allocate new proxy");
-               if (error) {
-                       BT_ERR("%s", error->message);
-                       g_clear_error(&error);
-               }
-               return NULL;
-       }
-
-       return proxy;
-}
-
 static int __bt_media_attr_to_event(const char *str)
 {
        if (!strcasecmp(str, "Equalizer"))
@@ -345,17 +287,6 @@ static const char *__bt_media_type_to_str(int type)
        return NULL;
 }
 
-static const char *__bt_transport_type_to_str(int type)
-{
-       switch (type) {
-       case DELAY:
-               return "Delay";
-       case VOLUME:
-               return "Volume";
-       }
-       return NULL;
-}
-
 static int __bt_media_attrval_to_val(int type, const char *value)
 {
        int ret = 0;
@@ -535,56 +466,6 @@ int _bt_avrcp_control_set_property(int type, unsigned int value)
        return BLUETOOTH_ERROR_NONE;
 }
 
-int _bt_avrcp_transport_set_property(int type, unsigned int value)
-{
-       GValue *attr_value = NULL;
-       GDBusProxy *proxy = NULL;
-       GError *error = NULL;
-       GVariant *reply, *param;
-       uint16_t property_level = (uint16_t)value;
-
-       g_value_init(attr_value, G_TYPE_STRING);
-
-       switch (type) {
-       case DELAY:
-               param = g_variant_new("q", property_level);
-               BT_INFO("delay level %d", property_level);
-               break;
-       case VOLUME:
-               param = g_variant_new("q", property_level);
-               BT_INFO("volume level %d", property_level);
-               break;
-       default:
-               BT_ERR("Invalid property type: %d", type);
-               g_value_unset(attr_value);
-               return BLUETOOTH_ERROR_INTERNAL;
-       }
-
-       proxy = __bt_get_transport_properties_proxy();
-       retv_if(proxy == NULL, BLUETOOTH_ERROR_NOT_CONNECTED);
-
-       reply = g_dbus_proxy_call_sync(proxy,
-                                       "Set", g_variant_new("(ssv)", BT_MEDIATRANSPORT_INTERFACE, __bt_transport_type_to_str(type), param),
-                                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-
-       g_object_unref(proxy);
-       g_variant_unref(param);
-
-       if (!reply) {
-               BT_ERR("Can't get managed objects");
-               if (error) {
-                       BT_ERR("SetProperty Fail: %s", error->message);
-                       g_clear_error(&error);
-                       return BLUETOOTH_ERROR_INTERNAL;
-               }
-       }
-
-       g_variant_unref(reply);
-       g_value_unset(attr_value);
-
-       return BLUETOOTH_ERROR_NONE;
-}
-
 static int __bt_avrcp_control_parse_properties(
                                media_metadata_attributes_t *metadata,
                                GVariant *item)