emulator: Refine +BIND support

This commit is contained in:
Denis Kenzior 2014-02-10 11:01:28 -06:00
parent 934ea9a9fe
commit 6c4ac05fbc
1 changed files with 11 additions and 1 deletions

View File

@ -54,6 +54,7 @@ struct ofono_emulator {
unsigned int cmee_mode : 2; unsigned int cmee_mode : 2;
bool clip : 1; bool clip : 1;
bool ccwa : 1; bool ccwa : 1;
bool ddr_active : 1;
}; };
struct indicator { struct indicator {
@ -895,6 +896,8 @@ fail:
static void biev_cb(GAtServer *server, GAtServerRequestType type, static void biev_cb(GAtServer *server, GAtServerRequestType type,
GAtResult *result, gpointer user_data) GAtResult *result, gpointer user_data)
{ {
struct ofono_emulator *em = user_data;
switch (type) { switch (type) {
case G_AT_SERVER_REQUEST_TYPE_SET: case G_AT_SERVER_REQUEST_TYPE_SET:
{ {
@ -908,7 +911,10 @@ static void biev_cb(GAtServer *server, GAtServerRequestType type,
if (g_at_result_iter_next_number(&iter, &hf_indicator) == FALSE) if (g_at_result_iter_next_number(&iter, &hf_indicator) == FALSE)
goto fail; goto fail;
if (hf_indicator != 1) if (hf_indicator != HFP_HF_INDICATOR_ENHANCED_SAFETY)
goto fail;
if (em->ddr_active == FALSE)
goto fail; goto fail;
if (g_at_result_iter_next_number(&iter, &val) == FALSE) if (g_at_result_iter_next_number(&iter, &val) == FALSE)
@ -1010,6 +1016,8 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
em); em);
if (em->type == OFONO_EMULATOR_TYPE_HFP) { if (em->type == OFONO_EMULATOR_TYPE_HFP) {
em->ddr_active = true;
emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0, emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0,
FALSE); FALSE);
emulator_add_indicator(em, OFONO_EMULATOR_IND_CALL, 0, 1, 0, emulator_add_indicator(em, OFONO_EMULATOR_IND_CALL, 0, 1, 0,
@ -1447,6 +1455,8 @@ void ofono_emulator_set_hf_indicator_active(struct ofono_emulator *em,
if (indicator != HFP_HF_INDICATOR_ENHANCED_SAFETY) if (indicator != HFP_HF_INDICATOR_ENHANCED_SAFETY)
return; return;
em->ddr_active = active;
sprintf(buf, "+BIND: %d,%d", HFP_HF_INDICATOR_ENHANCED_SAFETY, active); sprintf(buf, "+BIND: %d,%d", HFP_HF_INDICATOR_ENHANCED_SAFETY, active);
g_at_server_send_unsolicited(em->server, buf); g_at_server_send_unsolicited(em->server, buf);
} }