summaryrefslogtreecommitdiffstats
path: root/drivers/hfpmodem
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2013-01-21 16:30:23 +0100
committerDenis Kenzior <denkenz@gmail.com>2013-01-21 09:41:54 -0600
commitcbb784e734e1d4e42e21eb887d6bb1eaeeefa71d (patch)
tree6e5c6324919c7c78dff83e4263e43b375c99203b /drivers/hfpmodem
parent9726e50d82e292e2be68d65d63d1e955055480a1 (diff)
downloadofono-cbb784e734e1d4e42e21eb887d6bb1eaeeefa71d.tar.bz2
hfpmodem: Avoid transitional voicecall states
While processing the result of AT+CLCC, process the differences in a way that disconnections are reported first, then call state changes and finally new calls. The goal is to avoid unnecessary transitional states such as two active calls existing at the same time.
Diffstat (limited to 'drivers/hfpmodem')
-rw-r--r--drivers/hfpmodem/voicecall.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 97700596..e0da3fc1 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -205,6 +205,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
struct ofono_call *nc, *oc;
unsigned int num_active = 0;
unsigned int num_held = 0;
+ GSList *notify_calls = NULL;
if (!ok)
return;
@@ -242,7 +243,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
} else if (nc && (oc == NULL || (nc->id < oc->id))) {
/* new call, signal it */
if (nc->type == 0)
- ofono_voicecall_notify(vc, nc);
+ notify_calls = g_slist_append(notify_calls, nc);
n = n->next;
} else {
@@ -257,13 +258,22 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (memcmp(nc, oc, sizeof(struct ofono_call)) &&
!nc->type)
- ofono_voicecall_notify(vc, nc);
+ notify_calls = g_slist_prepend(notify_calls,
+ nc);
n = n->next;
o = o->next;
}
}
+ /*
+ * Disconnections were already reported, so process the rest of the
+ * notifications. Note that the new calls are placed at the end of the
+ * list, after other state changes
+ */
+ g_slist_foreach(notify_calls, voicecall_notify, vc);
+ g_slist_free(notify_calls);
+
g_slist_foreach(vd->calls, (GFunc) g_free, NULL);
g_slist_free(vd->calls);