mirror of git://git.sysmocom.de/ofono
handsfree-audio: Check CVSD when registering agent
This patch makes CVSD codec mandatory when registering a Handsfree Audio Agent.
This commit is contained in:
parent
80212a3db2
commit
4fcd084859
|
@ -307,6 +307,7 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
|
|||
unsigned char *codecs;
|
||||
DBusMessageIter iter, array;
|
||||
int length, i;
|
||||
gboolean has_cvsd = FALSE;
|
||||
|
||||
if (agent)
|
||||
return __ofono_error_in_use(msg);
|
||||
|
@ -326,11 +327,17 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
|
|||
return __ofono_error_invalid_args(msg);
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
if (codecs[i] != HFP_CODEC_CVSD &&
|
||||
codecs[i] != HFP_CODEC_MSBC)
|
||||
if (codecs[i] == HFP_CODEC_CVSD)
|
||||
has_cvsd = TRUE;
|
||||
else if (codecs[i] != HFP_CODEC_MSBC)
|
||||
return __ofono_error_invalid_args(msg);
|
||||
}
|
||||
|
||||
if (has_cvsd == FALSE) {
|
||||
ofono_error("CVSD codec is mandatory");
|
||||
return __ofono_error_invalid_args(msg);
|
||||
}
|
||||
|
||||
agent = g_new0(struct agent, 1);
|
||||
agent->owner = g_strdup(sender);
|
||||
agent->path = g_strdup(path);
|
||||
|
|
Loading…
Reference in New Issue