Use AT+CLCC to get current call list. --- drivers/hfpmodem/voicecall.c | 59 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 58 insertions(+), 1 deletions(-)
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c index 2cd14b5..ee89ee0 100644 --- a/drivers/hfpmodem/voicecall.c +++ b/drivers/hfpmodem/voicecall.c @@ -400,6 +400,63 @@ static void hfp_hangup(struct ofono_voicecall *vc, hfp_template("AT+CHUP", vc, generic_cb, 0x3f, cb, data); } +static void list_calls_callback(gboolean ok, GAtResult *result, + gpointer user_data) +{ + struct cb_data *cbd = user_data; + struct ofono_voicecall *vc = cbd->user; + struct voicecall_data *vd = ofono_voicecall_get_data(vc); + ofono_call_list_cb_t cb = cbd->cb; + GSList *l; + struct ofono_call *list; + struct ofono_error error; + int num; + + dump_response("clcc_poll_cb", ok, result); + decode_at_error(&error, g_at_result_final_response(result)); + + if (!ok) + return; + + clcc_poll_cb(ok, result, vc); + + list = g_try_new0(struct ofono_call, g_slist_length(vd->calls)); + + if (!list) { + CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data); + return; + } + + for (num = 0, l = vd->calls; l; l = l->next, num++) + memcpy(&list[num], l->data, sizeof(struct ofono_call)); + + cb(&error, num, list, cbd->data); + + g_free(list); +} + +static void hfp_list_calls(struct ofono_voicecall *vc, ofono_call_list_cb_t cb, + void *data) +{ + struct voicecall_data *vd = ofono_voicecall_get_data(vc); + struct cb_data *cbd = cb_data_new(cb, data); + + if (!cbd) + goto error; + + cbd->user = vc; + + if (g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix, + list_calls_callback, cbd, g_free) > 0) + return; + +error: + if (cbd) + g_free(cbd); + + CALLBACK_WITH_FAILURE(cb, 0, NULL, data); +} + static void hfp_hold_all_active(struct ofono_voicecall *vc, ofono_voicecall_cb_t cb, void *data) { @@ -952,7 +1009,7 @@ static struct ofono_voicecall_driver driver = { .dial = hfp_dial, .answer = hfp_answer, .hangup = hfp_hangup, - .list_calls = NULL, + .list_calls = hfp_list_calls, .hold_all_active = hfp_hold_all_active, .release_all_held = hfp_release_all_held, .set_udub = hfp_set_udub, -- 1.6.5.2 _______________________________________________ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono