From 600539ed2a812223e50994e33eba3d7bc6b57941 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Mon, 15 Apr 2013 10:54:53 -0300 Subject: handsfree-audio: Toggle wideband support when the agent registers Each time an agent registers itself, we check if we support deferred setup and if the agent has mSBC as a codec, if both checks are true, we enable wideband speech support. --- src/handsfree-audio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c index fc3d15b4..c24e7876 100644 --- a/src/handsfree-audio.c +++ b/src/handsfree-audio.c @@ -646,7 +646,7 @@ static DBusMessage *am_agent_register(DBusConnection *conn, unsigned char *codecs; DBusMessageIter iter, array; int length, i; - gboolean has_cvsd = FALSE; + gboolean has_cvsd = FALSE, has_msbc = FALSE; if (agent) return __ofono_error_in_use(msg); @@ -668,10 +668,17 @@ static DBusMessage *am_agent_register(DBusConnection *conn, for (i = 0; i < length; i++) { if (codecs[i] == HFP_CODEC_CVSD) has_cvsd = TRUE; - else if (codecs[i] != HFP_CODEC_MSBC) + else if (codecs[i] == HFP_CODEC_MSBC) + has_msbc = TRUE; + else return __ofono_error_invalid_args(msg); } + if (has_msbc && defer_setup == 1) + has_wideband = TRUE; + else + has_wideband = FALSE; + if (has_cvsd == FALSE) { ofono_error("CVSD codec is mandatory"); return __ofono_error_invalid_args(msg); -- cgit v1.2.3