This patch adds a new handsfree-audio public function to read the
available codecs registered by the agent.
---
 include/handsfree-audio.h |  1 +
 src/handsfree-audio.c     | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/handsfree-audio.h b/include/handsfree-audio.h
index c7a37dc..839f0f8 100644
--- a/include/handsfree-audio.h
+++ b/include/handsfree-audio.h
@@ -49,6 +49,7 @@ struct ofono_handsfree_card 
*ofono_handsfree_card_create(const char *remote,
                                        void *data);
 int ofono_handsfree_card_register(struct ofono_handsfree_card *card);
 void ofono_handsfree_card_remove(struct ofono_handsfree_card *card);
+int ofono_handsfree_get_codecs(unsigned char *buffer, int buffer_len);
 
 void ofono_handsfree_audio_ref(void);
 void ofono_handsfree_audio_unref(void);
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 3a7dcee..2cbdb57 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -462,6 +462,19 @@ void ofono_handsfree_card_remove(struct 
ofono_handsfree_card *card)
        g_free(card);
 }
 
+int ofono_handsfree_get_codecs(unsigned char *buffer, int buffer_len)
+{
+       int len;
+
+       if (agent == NULL)
+               return -EIO;
+
+       len = MIN(buffer_len, agent->codecs_len);
+       memcpy(buffer, agent->codecs, len);
+
+       return len;
+}
+
 static void agent_free(struct agent *agent)
 {
        if (agent->watch > 0)
-- 
1.7.11.7

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

Reply via email to