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.
This commit is contained in:
Vinicius Costa Gomes 2013-04-15 10:54:53 -03:00 committed by Denis Kenzior
parent 12df4fca94
commit 600539ed2a
1 changed files with 9 additions and 2 deletions

View File

@ -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);