summaryrefslogtreecommitdiffstats
path: root/audio/headset.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-09-05 15:41:57 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2008-09-05 15:41:57 +0300
commit96cdd87ef17d72053261da7a979ec8627e0a5cd8 (patch)
tree12b2c0a470404bca343e3793068eb6c25ba69138 /audio/headset.c
parent6a2ff7dbf3f3b15b0cac10c64ddc82ecf23be68d (diff)
Implement call notification
Diffstat (limited to 'audio/headset.c')
-rw-r--r--audio/headset.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 210d6851..89511f71 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2126,6 +2126,58 @@ int telephony_response_and_hold_ind(int rh)
return headset_send(hs, "\r\n+BTRH:%d\r\n", ag.rh);
}
+int telephony_notify_call(const char *number)
+{
+ struct headset *hs;
+
+ if (!active_telephony_device)
+ return -ENODEV;
+
+ hs = active_telephony_device->headset;
+
+ if (hs->ring_timer) {
+ debug("telephony_notify_call: already calling");
+ return -EBUSY;
+ }
+
+ if (hs->ph_number) {
+ g_free(hs->ph_number);
+ hs->ph_number = NULL;
+ }
+
+ if (number)
+ hs->ph_number = g_strdup(number);
+
+ headset_send(hs, "\r\nRING\r\n");
+
+ if (hs->cli_active && hs->ph_number)
+ headset_send(hs, "\r\n+CLIP:\"%s\",%d\r\n",
+ hs->ph_number, hs->type);
+
+ hs->ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb,
+ active_telephony_device);
+
+ return 0;
+}
+
+int telephony_stop_calling(void)
+{
+ struct headset *hs;
+
+ if (!active_telephony_device)
+ return -ENODEV;
+
+ hs = active_telephony_device->headset;
+
+ if (!hs->ring_timer)
+ return -EINVAL;
+
+ g_source_remove(hs->ring_timer);
+ hs->ring_timer = 0;
+
+ return 0;
+}
+
int telephony_ready(uint32_t features, const struct indicator *indicators,
int rh)
{