hfpmodem: Add support for sending the supported codecs

Right now, only the mandatory CVSD codec is supported. The mSBC
mandatory codec is "temporarily" not supported.

The spec alows this, HFP 1.6 Spec Section 4.34.1 page 92: "If wide band
speech is supported then the mandatory codec (mSBC) shall be included
unless it is temporarily unavailable."
This commit is contained in:
Vinicius Costa Gomes 2013-01-17 12:13:06 -03:00 committed by Denis Kenzior
parent f09a57d799
commit a419432c0f
1 changed files with 29 additions and 0 deletions

View File

@ -67,6 +67,11 @@ void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version)
info->hf_features |= HFP_HF_FEATURE_ENHANCED_CALL_STATUS;
info->hf_features |= HFP_HF_FEATURE_ENHANCED_CALL_CONTROL;
if (version < HFP_VERSION_1_6)
goto done;
info->hf_features |= HFP_HF_FEATURE_CODEC_NEGOTIATION;
done:
memset(info->cind_val, 0, sizeof(info->cind_val));
memset(info->cind_pos, 0, sizeof(info->cind_pos));
@ -266,6 +271,21 @@ error:
slc_failed(sed);
}
static void bac_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct slc_establish_data *sed = user_data;
struct hfp_slc_info *info = sed->info;
if (!ok) {
slc_failed(sed);
return;
}
slc_establish_data_ref(sed);
g_at_chat_send(info->chat, "AT+CIND=?", cind_prefix,
cind_cb, sed, slc_establish_data_unref);
}
static void brsf_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct slc_establish_data *sed = user_data;
@ -282,6 +302,15 @@ static void brsf_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_next_number(&iter, (gint *)&info->ag_features);
if (info->ag_features & HFP_AG_FEATURE_CODEC_NEGOTIATION &&
info->hf_features & HFP_HF_FEATURE_CODEC_NEGOTIATION) {
slc_establish_data_ref(sed);
g_at_chat_send(info->chat, "AT+BAC=1", NULL, bac_cb, sed,
slc_establish_data_unref);
return;
}
slc_establish_data_ref(sed);
g_at_chat_send(info->chat, "AT+CIND=?", cind_prefix,
cind_cb, sed, slc_establish_data_unref);