diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-07-03 20:29:12 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-07-03 22:27:57 +0300 |
commit | b8808da58b27638f587169d39eaf8e467aed5c30 (patch) | |
tree | 26c86d0ae694c19d9194b8153885378a66ceff19 /audio | |
parent | 89f26be4bdefcf1266fe77de13221cc727090ac7 (diff) | |
download | bluez-b8808da58b27638f587169d39eaf8e467aed5c30.tar.gz |
Add support for Call.CreateRequested signal
The HFP specification requires the AG to enable the "callheld" indicator
with the value 1, i.e. "Call is placed on hold or active/held calls
swapped" when there is an active call and a second outgoing call is
attempted which causes the active call to go on hold. However, with the
current csd and its underlying modem the existing call is set to hold
before any new call creation attempt is indicated upwards in the stack.
This means that we don't know about the second call just with the help of
the CallStatus signal (which maps directly to the modem state) but a new
signal, CreateRequested, is needed.
Since the create request could fail before any call object leaves the IDLE
state or the modem could get reset (in which case a CreateFailed signal
doesn't help) a five second timer is used to clear the call creation
information if the active call doesn't transition to the HOLD state before
that.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/telephony-maemo.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/audio/telephony-maemo.c b/audio/telephony-maemo.c index 781881b0c..3ce58c9b6 100644 --- a/audio/telephony-maemo.c +++ b/audio/telephony-maemo.c @@ -199,6 +199,9 @@ static int response_and_hold = -1; static char *last_dialed_number = NULL; +/* Timer for tracking call creation requests */ +static guint create_request_timer = 0; + static struct indicator maemo_indicators[] = { { "battchg", "0-5", 5 }, @@ -929,8 +932,32 @@ static void handle_outgoing_call(DBusMessage *msg) g_free(last_dialed_number); last_dialed_number = g_strdup(number); + if (create_request_timer) { + g_source_remove(create_request_timer); + create_request_timer = 0; + } + telephony_update_indicator(maemo_indicators, "callsetup", - EV_CALLSETUP_OUTGOING); + EV_CALLSETUP_OUTGOING); +} + +static gboolean create_timeout(gpointer user_data) +{ + create_request_timer = 0; + return FALSE; +} + +static void handle_create_requested(DBusMessage *msg) +{ + debug("Call.CreateRequested()"); + + if (g_slist_length(active_calls) == 0) + return; + + if (create_request_timer) + g_source_remove(create_request_timer); + + create_request_timer = g_timeout_add_seconds(5, create_timeout, NULL); } static void handle_call_status(DBusMessage *msg, const char *call_path) @@ -1044,11 +1071,15 @@ static void handle_call_status(DBusMessage *msg, const char *call_path) break; case CSD_CALL_STATUS_HOLD: call->on_hold = TRUE; - if (find_non_held_call()) + if (find_non_held_call() || create_request_timer) { + if (create_request_timer) { + g_source_remove(create_request_timer); + create_request_timer = 0; + } telephony_update_indicator(maemo_indicators, "callheld", EV_CALLHELD_MULTIPLE); - else + } else telephony_update_indicator(maemo_indicators, "callheld", EV_CALLHELD_ON_HOLD); @@ -1431,6 +1462,9 @@ static DBusHandlerResult signal_filter(DBusConnection *conn, handle_incoming_call(msg); else if (dbus_message_is_signal(msg, CSD_CALL_INTERFACE, "Created")) handle_outgoing_call(msg); + else if (dbus_message_is_signal(msg, CSD_CALL_INTERFACE, + "CreateRequested")) + handle_create_requested(msg); else if (dbus_message_is_signal(msg, CSD_CALL_INSTANCE, "CallStatus")) handle_call_status(msg, path); else if (dbus_message_is_signal(msg, CSD_CALL_CONFERENCE, "Joined")) |