emulator: Improve SLC establishment logic

This commit is contained in:
Denis Kenzior 2014-01-17 14:37:41 -06:00
parent d292e0e0ed
commit 0727da1d5b
3 changed files with 43 additions and 1 deletions

View File

@ -636,7 +636,8 @@ done:
g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
em->slc = TRUE;
__ofono_emulator_slc_condition(em,
OFONO_EMULATOR_SLC_CONDITION_CMER);
break;
}
@ -1266,3 +1267,31 @@ void __ofono_emulator_set_indicator_forced(struct ofono_emulator *em,
ind->deferred = TRUE;
}
}
void __ofono_emulator_slc_condition(struct ofono_emulator *em,
enum ofono_emulator_slc_condition cond)
{
if (em->slc == TRUE)
return;
switch (cond) {
case OFONO_EMULATOR_SLC_CONDITION_CMER:
if ((em->r_features & HFP_HF_FEATURE_3WAY) &&
(em->l_features & HFP_AG_FEATURE_3WAY))
return;
/* Fall Through */
case OFONO_EMULATOR_SLC_CONDITION_CHLD:
if ((em->r_features & HFP_HF_FEATURE_HF_INDICATORS) &&
(em->l_features & HFP_HF_FEATURE_HF_INDICATORS))
return;
/* Fall Through */
case OFONO_EMULATOR_SLC_CONDITION_BIND:
ofono_info("SLC reached");
em->slc = TRUE;
default:
break;
}
}

View File

@ -505,8 +505,17 @@ void __ofono_gprs_provision_free_settings(
int count);
#include <ofono/emulator.h>
enum ofono_emulator_slc_condition {
OFONO_EMULATOR_SLC_CONDITION_CMER,
OFONO_EMULATOR_SLC_CONDITION_CHLD,
OFONO_EMULATOR_SLC_CONDITION_BIND,
};
void __ofono_emulator_set_indicator_forced(struct ofono_emulator *em,
const char *name, int value);
void __ofono_emulator_slc_condition(struct ofono_emulator *em,
enum ofono_emulator_slc_condition cond);
#include <ofono/gnss.h>
#include <ofono/cdma-sms.h>

View File

@ -3304,6 +3304,10 @@ static void emulator_chld_cb(struct ofono_emulator *em,
ofono_emulator_send_info(em, buf, TRUE);
result.type = OFONO_ERROR_TYPE_NO_ERROR;
__ofono_emulator_slc_condition(em,
OFONO_EMULATOR_SLC_CONDITION_CHLD);
break;
case OFONO_EMULATOR_REQUEST_TYPE_QUERY: