From b5875caa0d77c181352ba7b6d65bc6e9091d01f2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 2 Oct 2008 14:13:55 +0300 Subject: Add support for current call list query Support for the AT+CLCC command and the +CLCC:... unsolicited result code. --- audio/headset.c | 33 +++++++++++++++++++++++++++++++++ audio/telephony-dummy.c | 6 ++++++ audio/telephony.h | 5 +++++ 3 files changed, 44 insertions(+) diff --git a/audio/headset.c b/audio/headset.c index 40cd23f5..2fce7b8c 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -848,6 +848,18 @@ static int subscriber_number(struct audio_device *device, const char *buf) return 0; } +int telephony_list_current_calls_rsp(void *telephony_device, cme_error_t err) +{ + return telephony_generic_rsp(telephony_device, err); +} + +static int list_current_calls(struct audio_device *device, const char *buf) +{ + telephony_list_current_calls_req(device); + + return 0; +} + static struct event event_callbacks[] = { { "ATA", answer_call }, { "ATD", dial_number }, @@ -863,6 +875,7 @@ static struct event event_callbacks[] = { { "AT+BLDN", last_dialed_number }, { "AT+VTS", dtmf_tone }, { "AT+CNUM", subscriber_number }, + { "AT+CLCC", list_current_calls }, { 0 } }; @@ -2175,3 +2188,23 @@ int telephony_ready_ind(uint32_t features, return 0; } + +int telephony_list_current_call_ind(int idx, int dir, int status, int mode, + int mprty, const char *number, + int type) +{ + if (!active_devices) + return -ENODEV; + + if (number) + send_foreach_headset(active_devices, + "\r\n+CLCC:%d,%d,%d,%d,%d,%s,%d\r\n", + idx, dir, status, mode, mprty, + number, type); + else + send_foreach_headset(active_devices, + "\r\n+CLCC:%d,%d,%d,%d,%d\r\n", + idx, dir, status, mode, mprty); + + return 0; +} diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c index 7fd75cc4..5c3d4db8 100644 --- a/audio/telephony-dummy.c +++ b/audio/telephony-dummy.c @@ -138,6 +138,12 @@ void telephony_subscriber_number_req(void *telephony_device) telephony_subscriber_number_rsp(telephony_device, CME_ERROR_NONE); } +int telephony_list_current_calls_req(void *telephony_device) +{ + debug("telephony-dummy: list current calls request"); + telephony_list_current_calls_rsp(telephony_device, CME_ERROR_NONE); +} + /* D-Bus method handlers */ static DBusMessage *outgoing_call(DBusConnection *conn, DBusMessage *msg, void *data) diff --git a/audio/telephony.h b/audio/telephony.h index 72608dc5..2581b00f 100644 --- a/audio/telephony.h +++ b/audio/telephony.h @@ -114,6 +114,7 @@ void telephony_answer_call_req(void *telephony_device); void telephony_dial_number_req(void *telephony_device, const char *number); void telephony_transmit_dtmf_req(void *telephony_device, char tone); void telephony_subscriber_number_req(void *telephony_device); +int telephony_list_current_calls_req(void *telephony_device); /* AG responses to HF requests. These are implemented by headset.c */ int telephony_event_reporting_rsp(void *telephony_device, cme_error_t err); @@ -124,6 +125,7 @@ int telephony_answer_call_rsp(void *telephony_device, cme_error_t err); int telephony_dial_number_rsp(void *telephony_device, cme_error_t err); int telephony_transmit_dtmf_rsp(void *telephony_device, cme_error_t err); int telephony_subscriber_number_rsp(void *telephony_device, cme_error_t err); +int telephony_list_current_calls_rsp(void *telephony_device, cme_error_t err); /* Event indications by AG. These are implemented by headset.c */ int telephony_event_ind(int index); @@ -132,6 +134,9 @@ int telephony_incoming_call_ind(const char *number, int type); int telephony_calling_stopped_ind(void); int telephony_ready_ind(uint32_t features, const struct indicator *indicators, int rh); +int telephony_list_current_call_ind(int idx, int dir, int status, int mode, + int mprty, const char *number, + int type); /* Helper function for quick indicator updates */ static inline int telephony_update_indicator(struct indicator *indicators, -- cgit