summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-09-05 12:58:24 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2008-09-05 12:58:24 +0300
commit1d1219ab4437f0b1c1cc826d11dc4c995579cb1c (patch)
treea68fd29f10e7616aab059ad13325be8b27ded735
parent624760ab4e7eb0480aea751ceb1876e7a846f67a (diff)
Implement answer call functionality (ATA)
-rw-r--r--audio/headset.c40
-rw-r--r--audio/telephony-dummy.c8
-rw-r--r--audio/telephony.h2
3 files changed, 34 insertions, 16 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 098cf75e..83267ca6 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -581,10 +581,9 @@ static int call_hold(struct audio_device *dev, const char *buf)
return 0;
}
-static int answer_call(struct audio_device *device, const char *buf)
+static int button_press(struct audio_device *device, const char *buf)
{
struct headset *hs = device->headset;
- int err;
g_dbus_emit_signal(device->conn, device->path,
AUDIO_HEADSET_INTERFACE, "AnswerRequested",
@@ -595,25 +594,34 @@ static int answer_call(struct audio_device *device, const char *buf)
hs->ring_timer = 0;
}
- if (!hs->hfp_active)
- return headset_send(hs, "\r\nOK\r\n");
+ return headset_send(hs, "\r\nOK\r\n");
+}
+
+static int answer_call(struct audio_device *device, const char *buf)
+{
+ struct headset *hs = device->headset;
+
+ ag.ev_buf_active = TRUE;
+
+ if (telephony_answer_call() < 0) {
+ headset_send(hs, "\r\nERROR\r\n");
+ return 0;
+ }
+
+ flush_events();
+ ag.ev_buf_active = FALSE;
+
+ if (hs->ring_timer) {
+ g_source_remove(hs->ring_timer);
+ hs->ring_timer = 0;
+ }
if (hs->ph_number) {
g_free(hs->ph_number);
hs->ph_number = NULL;
}
- err = headset_send(hs, "\r\nOK\r\n");
- if (err < 0)
- return err;
-
- /*+CIEV: (call = 1)*/
- err = headset_send(hs, "\r\n+CIEV:2,1\r\n");
- if (err < 0)
- return err;
-
- /*+CIEV: (callsetup = 0)*/
- return headset_send(hs, "\r\n+CIEV:3,0\r\n");
+ return headset_send(hs, "\r\nOK\r\n");
}
static int terminate_call(struct audio_device *device, const char *buf)
@@ -747,7 +755,7 @@ static struct event event_callbacks[] = {
{ "AT+CMER", event_reporting },
{ "AT+CHLD", call_hold },
{ "AT+CHUP", terminate_call },
- { "AT+CKPD", answer_call },
+ { "AT+CKPD", button_press },
{ "AT+CLIP", cli_notification },
{ "AT+BTRH", response_and_hold },
{ "AT+BLDN", last_dialed_number },
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index f71f65f6..8acb3586 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -89,6 +89,14 @@ int telephony_terminate_call(void)
return 0;
}
+int telephony_answer_call(void)
+{
+ telephony_update_indicator(dummy_indicators, "call", 1);
+ telephony_update_indicator(dummy_indicators, "callsetup", 0);
+
+ return 0;
+}
+
int telephony_init(void)
{
uint32_t features = 0;
diff --git a/audio/telephony.h b/audio/telephony.h
index 60b1d423..55e64e98 100644
--- a/audio/telephony.h
+++ b/audio/telephony.h
@@ -54,6 +54,8 @@ int telephony_last_dialed_number(void);
int telephony_terminate_call(void);
+int telephony_answer_call(void);
+
int telephony_ready(uint32_t features, struct indicator *indicators, int rh);
/* Helper function for quick indicator updates */