summaryrefslogtreecommitdiffstats
path: root/src/voicecall.c
diff options
context:
space:
mode:
authorFrédéric Dalleau <frederic.dalleau@linux.intel.com>2011-04-22 15:00:10 +0200
committerDenis Kenzior <denkenz@gmail.com>2011-04-26 14:22:11 -0500
commit719fae95876e8d08e073d19e9576a09572f42046 (patch)
tree487609f123d0b0b01ca36009141094e83219e6be /src/voicecall.c
parent7ff32ab8e8b038da5f7a1c6299df57f3f473fef8 (diff)
downloadofono-719fae95876e8d08e073d19e9576a09572f42046.tar.bz2
voicecall: add +CLCC support for HFP emulator
Diffstat (limited to 'src/voicecall.c')
-rw-r--r--src/voicecall.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/voicecall.c b/src/voicecall.c
index 7aa0b7ed..51b85114 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2411,6 +2411,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)
OFONO_ATOM_TYPE_EMULATOR_HFP,
emulator_remove_handler,
"+CHUP");
+ __ofono_modem_foreach_registered_atom(modem,
+ OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_remove_handler,
+ "+CLCC");
__ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
}
@@ -2678,6 +2682,59 @@ fail:
};
}
+static void emulator_clcc_cb(struct ofono_emulator *em,
+ struct ofono_emulator_request *req, void *userdata)
+{
+ struct ofono_voicecall *vc = userdata;
+ struct ofono_error result;
+ GSList *l;
+ struct voicecall *v;
+ gboolean mpty;
+ /*
+ * '+CLCC: 123,1,1,0,1,"+",' + phone number + phone type on 3 digits
+ * + terminating null
+ */
+ char buf[OFONO_MAX_PHONE_NUMBER_LENGTH + 26 + 1];
+
+ result.error = 0;
+
+ switch (ofono_emulator_request_get_type(req)) {
+ case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY:
+ for (l = vc->call_list; l; l = l->next) {
+ v = l->data;
+
+ if (g_slist_find_custom(vc->multiparty_list,
+ GINT_TO_POINTER(v->call->id),
+ call_compare_by_id))
+ mpty = TRUE;
+ else
+ mpty = FALSE;
+
+ if (v->call->clip_validity == CLIP_VALIDITY_VALID)
+ sprintf(buf, "+CLCC: %d,%d,%d,0,%d,\"%s\",%d",
+ v->call->id, v->call->direction,
+ v->call->status, mpty,
+ v->call->phone_number.number,
+ v->call->phone_number.type);
+ else
+ sprintf(buf, "+CLCC: %d,%d,%d,0,%d,\"\",128",
+ v->call->id, v->call->direction,
+ v->call->status, mpty);
+
+ ofono_emulator_send_info(em, buf, l->next == NULL ?
+ TRUE : FALSE);
+ }
+
+ result.type = OFONO_ERROR_TYPE_NO_ERROR;
+ break;
+
+ default:
+ result.type = OFONO_ERROR_TYPE_FAILURE;
+ }
+
+ ofono_emulator_send_final(em, &result);
+}
+
static void emulator_hfp_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond,
void *data)
@@ -2691,6 +2748,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,
ofono_emulator_add_handler(em, "A", emulator_ata_cb, data, NULL);
ofono_emulator_add_handler(em, "+CHUP", emulator_chup_cb, data, NULL);
+ ofono_emulator_add_handler(em, "+CLCC", emulator_clcc_cb, data, NULL);
}
void ofono_voicecall_register(struct ofono_voicecall *vc)