From: Claudio Takahasi <[email protected]>

This patch registers the codec watcher when the Handsfree Audio Card
driver probe callback gets called.
---
 plugins/hfp_hf_bluez5.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index c63b1a2..63af484 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -68,6 +68,7 @@ struct hfp {
        struct hfp_slc_info info;
        DBusMessage *msg;
        struct ofono_handsfree_card *card;
+       guint codec_watch;
 };
 
 static GDBusClient *bluez = NULL;
@@ -79,6 +80,13 @@ static void hfp_debug(const char *str, void *user_data)
        ofono_info("%s%s", prefix, str);
 }
 
+static void codec_watcher_cb(unsigned char codec, gpointer user_data)
+{
+       struct hfp *hfp = user_data;;
+
+       DBG("Card: %p selected codec: %d", hfp->card, codec);
+}
+
 static void slc_established(gpointer userdata)
 {
        struct ofono_modem *modem = userdata;
@@ -317,6 +325,12 @@ static struct ofono_modem_driver hfp_driver = {
 static int hfp16_card_probe(struct ofono_handsfree_card *card,
                                        unsigned int vendor, void *data)
 {
+       struct hfp *hfp = data;
+       struct hfp_slc_info *info = &hfp->info;
+
+       hfp->codec_watch = hfp_slc_codec_watch_register(info, codec_watcher_cb,
+                                                                       hfp);
+
        return 0;
 }
 
-- 
1.8.2

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to