OSDN Git Service

control: Simplify UUID handling during probe
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Fri, 26 Apr 2013 06:16:58 +0000 (08:16 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 26 Apr 2013 07:11:42 +0000 (10:11 +0300)
There is actually one single UUID which can be received during probe, so
simplify the code accordingly.

profiles/audio/control.c
profiles/audio/control.h
profiles/audio/manager.c

index 6086bde..fd5ff92 100644 (file)
@@ -253,13 +253,13 @@ void control_unregister(struct audio_device *dev)
                                                AUDIO_CONTROL_INTERFACE);
 }
 
-void control_update(struct control *control, GSList *uuids)
+void control_update(struct control *control, const char *uuid)
 {
-       if (g_slist_find_custom(uuids, AVRCP_TARGET_UUID, bt_uuid_strcmp))
+       if (bt_uuid_strcmp(uuid, AVRCP_TARGET_UUID) == 0)
                control->target = TRUE;
 }
 
-struct control *control_init(struct audio_device *dev, GSList *uuids)
+struct control *control_init(struct audio_device *dev, const char *uuid)
 {
        struct control *control;
 
@@ -276,7 +276,7 @@ struct control *control_init(struct audio_device *dev, GSList *uuids)
 
        control = g_new0(struct control, 1);
 
-       control_update(control, uuids);
+       control_update(control, uuid);
 
        control->avctp_id = avctp_add_state_cb(dev, state_changed);
 
index de0259e..82ad0d2 100644 (file)
@@ -24,8 +24,8 @@
 
 #define AUDIO_CONTROL_INTERFACE "org.bluez.MediaControl1"
 
-struct control *control_init(struct audio_device *dev, GSList *uuids);
-void control_update(struct control *control, GSList *uuids);
+struct control *control_init(struct audio_device *dev, const char *uuid);
+void control_update(struct control *control, const char *uuid);
 void control_unregister(struct audio_device *dev);
 gboolean control_is_active(struct audio_device *dev);
 
index 4517815..8131a3e 100644 (file)
@@ -145,9 +145,9 @@ static int avrcp_probe(struct btd_profile *p, struct btd_device *device,
        }
 
        if (audio_dev->control)
-               control_update(audio_dev->control, uuids);
+               control_update(audio_dev->control, p->remote_uuid);
        else
-               audio_dev->control = control_init(audio_dev, uuids);
+               audio_dev->control = control_init(audio_dev, p->remote_uuid);
 
        if (audio_dev->sink && sink_is_active(audio_dev))
                avrcp_connect(audio_dev);