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

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 6c55657..f20aff7 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -64,6 +64,7 @@ struct hfp {
        struct hfp_slc_info info;
        DBusMessage *msg;
        struct ofono_handsfree_card *card;
+       guint codec_watch;
 };
 
 static GDBusClient *bluez = NULL;
@@ -75,6 +76,14 @@ 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 ofono_modem *modem = user_data;
+       struct hfp *hfp = ofono_modem_get_data(modem);
+
+       DBG("Card: %p selected codec: %d", hfp->card, codec);
+}
+
 static void slc_established(gpointer userdata)
 {
        struct ofono_modem *modem = userdata;
@@ -312,6 +321,13 @@ static struct ofono_modem_driver hfp_driver = {
 
 static int card_probe(struct ofono_handsfree_card *card, void *data)
 {
+       struct ofono_modem *modem = data;
+       struct hfp *hfp = ofono_modem_get_data(modem);
+       struct hfp_slc_info *info = &hfp->info;
+
+       hfp->codec_watch = hfp_slc_codec_watch_register(info, codec_watcher_cb,
+                                                                       modem);
+
        return 0;
 }
 
-- 
1.7.11.7

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

Reply via email to