From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH v2 2/2] emulator: fix indicator notification
Date: Thu, 04 Aug 2011 16:29:50 +0200 [thread overview]
Message-ID: <1312468190-27253-2-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1312468190-27253-1-git-send-email-frederic.danis@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 3508 bytes --]
---
src/emulator.c | 33 +++++++++++++++++++++++++++++++--
src/voicecall.c | 11 -----------
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index deb4780..06ec06c 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -59,6 +59,7 @@ struct indicator {
int value;
int min;
int max;
+ gboolean deferred;
};
static void emulator_debug(const char *str, void *data)
@@ -345,6 +346,29 @@ static struct ofono_call *find_call_with_status(struct ofono_emulator *em,
return __ofono_voicecall_find_call_with_status(vc, status);
}
+static void notify_deferred_indicators(GAtServer *server, void *user_data)
+{
+ struct ofono_emulator *em = user_data;
+ int i;
+ char buf[20];
+ GSList *l;
+ struct indicator *ind;
+
+ for (i = 1, l = em->indicators; l; l = l->next, i++) {
+ ind = l->data;
+
+ if (!ind->deferred)
+ continue;
+
+ if (em->events_mode == 3 && em->events_ind && em->slc) {
+ sprintf(buf, "+CIEV: %d,%d", i, ind->value);
+ g_at_server_send_unsolicited(em->server, buf);
+ }
+
+ ind->deferred = FALSE;
+ }
+}
+
static gboolean notify_ccwa(void *user_data)
{
struct ofono_emulator *em = user_data;
@@ -832,6 +856,8 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
g_at_server_set_debug(em->server, emulator_debug, "Server");
g_at_server_set_disconnect_function(em->server,
emulator_disconnect, em);
+ g_at_server_set_finish_callback(em->server, notify_deferred_indicators,
+ em);
if (em->type == OFONO_EMULATOR_TYPE_HFP) {
emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0);
@@ -1124,8 +1150,11 @@ void ofono_emulator_set_indicator(struct ofono_emulator *em,
notify_ccwa(em);
if (em->events_mode == 3 && em->events_ind && em->slc) {
- sprintf(buf, "+CIEV: %d,%d", i, ind->value);
- g_at_server_send_unsolicited(em->server, buf);
+ if (!g_at_server_command_pending(em->server)) {
+ sprintf(buf, "+CIEV: %d,%d", i, ind->value);
+ g_at_server_send_unsolicited(em->server, buf);
+ } else
+ ind->deferred = TRUE;
}
/*
diff --git a/src/voicecall.c b/src/voicecall.c
index 23976af..168ce96 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -700,9 +700,6 @@ static void emulator_call_status_cb(struct ofono_atom *atom, void *data)
struct ofono_emulator *em = __ofono_atom_get_data(atom);
struct emulator_status *s = data;
- if (em == s->vc->pending_em)
- return;
-
ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_CALL, s->status);
}
@@ -711,9 +708,6 @@ static void emulator_callsetup_status_cb(struct ofono_atom *atom, void *data)
struct ofono_emulator *em = __ofono_atom_get_data(atom);
struct emulator_status *s = data;
- if (em == s->vc->pending_em)
- return;
-
ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_CALLSETUP,
s->status);
}
@@ -723,9 +717,6 @@ static void emulator_callheld_status_cb(struct ofono_atom *atom, void *data)
struct ofono_emulator *em = __ofono_atom_get_data(atom);
struct emulator_status *s = data;
- if (em == s->vc->pending_em)
- return;
-
ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_CALLHELD,
s->status);
}
@@ -3210,8 +3201,6 @@ static void emulator_dial_callback(const struct ofono_error *error, void *data)
vc->pending_em = NULL;
- notify_emulator_call_status(vc);
-
if (need_to_emit)
voicecalls_emit_call_added(vc, v);
}
--
1.7.1
next prev parent reply other threads:[~2011-08-04 14:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-04 14:29 [PATCH v2 1/2] gatserver: add command finished functions =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-08-04 14:29 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis [this message]
2011-08-15 5:24 ` [PATCH v2 2/2] emulator: fix indicator notification Denis Kenzior
2011-08-12 7:00 ` [PATCH v2 1/2] gatserver: add command finished functions Denis Kenzior
2011-08-15 5:32 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1312468190-27253-2-git-send-email-frederic.danis@linux.intel.com \
--to=frederic.danis@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox