* [PATCH v2 0/2] HFP: add call related indicators
@ 2011-03-18 16:10 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-18 16:10 ` [PATCH 1/2] emulator: add defines for call, callsetup and callheld indicators =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-18 16:10 ` [PATCH 2/2] emulator: add " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
0 siblings, 2 replies; 4+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-03-18 16:10 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
Add call, callsetup and callheld indicators for +CIEV
Frédéric Danis (2):
emulator: add defines for call, callsetup and callheld indicators
emulator: add call, callsetup and callheld indicators
include/emulator.h | 12 +++++++
src/emulator.c | 5 +++
src/voicecall.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 109 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] emulator: add defines for call, callsetup and callheld indicators
2011-03-18 16:10 [PATCH v2 0/2] HFP: add call related indicators =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-03-18 16:10 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-18 16:10 ` [PATCH 2/2] emulator: add " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
1 sibling, 0 replies; 4+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-03-18 16:10 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 843 bytes --]
---
include/emulator.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/emulator.h b/include/emulator.h
index 71b7c24..5cd894b 100644
--- a/include/emulator.h
+++ b/include/emulator.h
@@ -36,6 +36,18 @@ extern "C" {
#define OFONO_EMULATOR_IND_SERVICE "service"
#define OFONO_EMULATOR_IND_SIGNAL "signal"
+#define OFONO_EMULATOR_CALL_INACTIVE 0
+#define OFONO_EMULATOR_CALL_ACTIVE 1
+
+#define OFONO_EMULATOR_CALLSETUP_INACTIVE 0
+#define OFONO_EMULATOR_CALLSETUP_INCOMING 1
+#define OFONO_EMULATOR_CALLSETUP_OUTGOING 2
+#define OFONO_EMULATOR_CALLSETUP_ALERTING 3
+
+#define OFONO_EMULATOR_CALLHELD_NONE 0
+#define OFONO_EMULATOR_CALLHELD_MULTIPLE 1
+#define OFONO_EMULATOR_CALLHELD_ON_HOLD 2
+
struct ofono_emulator;
struct ofono_emulator_request;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] emulator: add call, callsetup and callheld indicators
2011-03-18 16:10 [PATCH v2 0/2] HFP: add call related indicators =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-18 16:10 ` [PATCH 1/2] emulator: add defines for call, callsetup and callheld indicators =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-03-18 16:10 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-21 19:31 ` Denis Kenzior
1 sibling, 1 reply; 4+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-03-18 16:10 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 6270 bytes --]
---
src/emulator.c | 5 +++
src/voicecall.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index c84f0a9..2707592 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -455,6 +455,11 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
if (em->type == OFONO_EMULATOR_TYPE_HFP) {
emulator_add_indicator(em, OFONO_EMULATOR_IND_SERVICE, 0, 1, 0);
+ emulator_add_indicator(em, OFONO_EMULATOR_IND_CALL, 0, 1, 0);
+ emulator_add_indicator(em, OFONO_EMULATOR_IND_CALLSETUP, 0, 3,
+ 0);
+ emulator_add_indicator(em, OFONO_EMULATOR_IND_CALLHELD, 0, 2,
+ 0);
emulator_add_indicator(em, OFONO_EMULATOR_IND_SIGNAL, 0, 5, 0);
emulator_add_indicator(em, OFONO_EMULATOR_IND_ROAMING, 0, 1, 0);
emulator_add_indicator(em, OFONO_EMULATOR_IND_BATTERY, 0, 5, 5);
diff --git a/src/voicecall.c b/src/voicecall.c
index cb5258d..f86d478 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -59,6 +59,7 @@ struct ofono_voicecall {
struct dial_request *dial_req;
GQueue *toneq;
guint tone_source;
+ unsigned int hfp_watch;
};
struct voicecall {
@@ -101,6 +102,7 @@ static const char *default_en_list_no_sim[] = { "119", "118", "999", "110",
static void generic_callback(const struct ofono_error *error, void *data);
static void multirelease_callback(const struct ofono_error *err, void *data);
static gboolean tone_request_run(gpointer user_data);
+static gboolean voicecalls_have_with_status(struct ofono_voicecall *vc, int status);
static gint call_compare_by_id(gconstpointer a, gconstpointer b)
{
@@ -692,6 +694,69 @@ static void voicecall_emit_multiparty(struct voicecall *call, gboolean mpty)
&val);
}
+static void emulator_call_status_cb(struct ofono_atom *atom, void *data)
+{
+ struct ofono_emulator *em = __ofono_atom_get_data(atom);
+
+ ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_CALL,
+ GPOINTER_TO_INT(data));
+}
+
+static void emulator_callsetup_status_cb(struct ofono_atom *atom, void *data)
+{
+ struct ofono_emulator *em = __ofono_atom_get_data(atom);
+
+ ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_CALLSETUP,
+ GPOINTER_TO_INT(data));
+}
+
+static void emulator_callheld_status_cb(struct ofono_atom *atom, void *data)
+{
+ struct ofono_emulator *em = __ofono_atom_get_data(atom);
+
+ ofono_emulator_set_indicator(em, OFONO_EMULATOR_IND_CALLHELD,
+ GPOINTER_TO_INT(data));
+}
+
+static void notify_emulator_call_status(struct ofono_voicecall *vc)
+{
+ struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+ int status;
+
+ status = voicecalls_have_with_status(vc, CALL_STATUS_ACTIVE) ?
+ OFONO_EMULATOR_CALL_ACTIVE :
+ OFONO_EMULATOR_CALL_INACTIVE;
+ __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_call_status_cb,
+ GINT_TO_POINTER(status));
+
+ if (voicecalls_have_with_status(vc, CALL_STATUS_HELD)) {
+ if (status)
+ status = OFONO_EMULATOR_CALLHELD_MULTIPLE;
+ else
+ status = OFONO_EMULATOR_CALLHELD_ON_HOLD;
+ } else
+ status = OFONO_EMULATOR_CALLHELD_NONE;
+
+ __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_callheld_status_cb,
+ GINT_TO_POINTER(status));
+
+ if (voicecalls_have_with_status(vc, CALL_STATUS_DIALING))
+ status = OFONO_EMULATOR_CALLSETUP_OUTGOING;
+ else if (voicecalls_have_with_status(vc, CALL_STATUS_ALERTING))
+ status = OFONO_EMULATOR_CALLSETUP_ALERTING;
+ else if (voicecalls_have_with_status(vc, CALL_STATUS_INCOMING)
+ || voicecalls_have_with_status(vc, CALL_STATUS_WAITING))
+ status = OFONO_EMULATOR_CALLSETUP_INCOMING;
+ else
+ status = OFONO_EMULATOR_CALLSETUP_INACTIVE;
+
+ __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_callsetup_status_cb,
+ GINT_TO_POINTER(status));
+}
+
static void voicecall_set_call_status(struct voicecall *call, int status)
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -714,6 +779,8 @@ static void voicecall_set_call_status(struct voicecall *call, int status)
"State", DBUS_TYPE_STRING,
&status_str);
+ notify_emulator_call_status(call->vc);
+
if (status == CALL_STATUS_ACTIVE &&
(old_status == CALL_STATUS_INCOMING ||
old_status == CALL_STATUS_DIALING ||
@@ -1043,6 +1110,8 @@ static void voicecalls_emit_call_added(struct ofono_voicecall *vc,
DBusMessageIter dict;
const char *path;
+ notify_emulator_call_status(vc);
+
path = __ofono_atom_get_path(vc->atom);
signal = dbus_message_new_signal(path,
@@ -2188,6 +2257,15 @@ static void voicecall_unregister(struct ofono_atom *atom)
const char *path = __ofono_atom_get_path(atom);
GSList *l;
+ __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_call_status_cb, 0);
+ __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_callsetup_status_cb, 0);
+ __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_callheld_status_cb, 0);
+
+ __ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
+
if (vc->sim_watch) {
__ofono_modem_remove_atom_watch(modem, vc->sim_watch);
vc->sim_watch = 0;
@@ -2362,6 +2440,16 @@ static void sim_watch(struct ofono_atom *atom,
sim_state_watch(ofono_sim_get_state(sim), vc);
}
+static void emulator_hfp_watch(struct ofono_atom *atom,
+ enum ofono_atom_watch_condition cond,
+ void *data)
+{
+ struct ofono_voicecall *vc = data;
+
+ if (cond == OFONO_ATOM_WATCH_CONDITION_REGISTERED)
+ notify_emulator_call_status(vc);
+}
+
void ofono_voicecall_register(struct ofono_voicecall *vc)
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -2398,6 +2486,10 @@ void ofono_voicecall_register(struct ofono_voicecall *vc)
sim_watch(sim_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, vc);
__ofono_atom_register(vc->atom, voicecall_unregister);
+
+ vc->hfp_watch = __ofono_modem_add_atom_watch(modem,
+ OFONO_ATOM_TYPE_EMULATOR_HFP,
+ emulator_hfp_watch, vc, NULL);
}
void ofono_voicecall_remove(struct ofono_voicecall *vc)
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] emulator: add call, callsetup and callheld indicators
2011-03-18 16:10 ` [PATCH 2/2] emulator: add " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-03-21 19:31 ` Denis Kenzior
0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-03-21 19:31 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4507 bytes --]
Hi Frédéric,
> +static void notify_emulator_call_status(struct ofono_voicecall *vc)
> +{
> + struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
> + int status;
> +
> + status = voicecalls_have_with_status(vc, CALL_STATUS_ACTIVE) ?
> + OFONO_EMULATOR_CALL_ACTIVE :
> + OFONO_EMULATOR_CALL_INACTIVE;
> + __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
> + emulator_call_status_cb,
> + GINT_TO_POINTER(status));
> +
This looks wrong, the call indicator is not only about active calls.
See Sequence in figure 4.26 in HFP 1.5 for more details.
You really need to sit down and figure out the possible scenarios and
the sequences in which the indicators must be set. I suggest you also
run PTS tester at a minimum to make sure the sequences sent by oFono is
what the spec expects.
Also, please google MCPC-TR-002 Version 1.5. That document contains
many more scenarios than are present in the BT HFP 1.5 specification.
> + if (voicecalls_have_with_status(vc, CALL_STATUS_HELD)) {
> + if (status)
> + status = OFONO_EMULATOR_CALLHELD_MULTIPLE;
> + else
> + status = OFONO_EMULATOR_CALLHELD_ON_HOLD;
> + } else
> + status = OFONO_EMULATOR_CALLHELD_NONE;
> +
> + __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
> + emulator_callheld_status_cb,
> + GINT_TO_POINTER(status));
> +
> + if (voicecalls_have_with_status(vc, CALL_STATUS_DIALING))
> + status = OFONO_EMULATOR_CALLSETUP_OUTGOING;
> + else if (voicecalls_have_with_status(vc, CALL_STATUS_ALERTING))
> + status = OFONO_EMULATOR_CALLSETUP_ALERTING;
> + else if (voicecalls_have_with_status(vc, CALL_STATUS_INCOMING)
> + || voicecalls_have_with_status(vc, CALL_STATUS_WAITING))
Please re-read doc/coding-style.txt section M4
> + status = OFONO_EMULATOR_CALLSETUP_INCOMING;
> + else
> + status = OFONO_EMULATOR_CALLSETUP_INACTIVE;
> +
> + __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
> + emulator_callsetup_status_cb,
> + GINT_TO_POINTER(status));
> +}
> +
> static void voicecall_set_call_status(struct voicecall *call, int status)
> {
> DBusConnection *conn = ofono_dbus_get_connection();
> @@ -714,6 +779,8 @@ static void voicecall_set_call_status(struct voicecall *call, int status)
> "State", DBUS_TYPE_STRING,
> &status_str);
>
> + notify_emulator_call_status(call->vc);
> +
> if (status == CALL_STATUS_ACTIVE &&
> (old_status == CALL_STATUS_INCOMING ||
> old_status == CALL_STATUS_DIALING ||
> @@ -1043,6 +1110,8 @@ static void voicecalls_emit_call_added(struct ofono_voicecall *vc,
> DBusMessageIter dict;
> const char *path;
>
> + notify_emulator_call_status(vc);
> +
> path = __ofono_atom_get_path(vc->atom);
>
> signal = dbus_message_new_signal(path,
> @@ -2188,6 +2257,15 @@ static void voicecall_unregister(struct ofono_atom *atom)
> const char *path = __ofono_atom_get_path(atom);
> GSList *l;
>
> + __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
> + emulator_call_status_cb, 0);
> + __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
> + emulator_callsetup_status_cb, 0);
> + __ofono_modem_foreach_atom(modem, OFONO_ATOM_TYPE_EMULATOR_HFP,
> + emulator_callheld_status_cb, 0);
> +
> + __ofono_modem_remove_atom_watch(modem, vc->hfp_watch);
> +
> if (vc->sim_watch) {
> __ofono_modem_remove_atom_watch(modem, vc->sim_watch);
> vc->sim_watch = 0;
> @@ -2362,6 +2440,16 @@ static void sim_watch(struct ofono_atom *atom,
> sim_state_watch(ofono_sim_get_state(sim), vc);
> }
>
> +static void emulator_hfp_watch(struct ofono_atom *atom,
> + enum ofono_atom_watch_condition cond,
> + void *data)
> +{
> + struct ofono_voicecall *vc = data;
> +
> + if (cond == OFONO_ATOM_WATCH_CONDITION_REGISTERED)
> + notify_emulator_call_status(vc);
> +}
> +
> void ofono_voicecall_register(struct ofono_voicecall *vc)
> {
> DBusConnection *conn = ofono_dbus_get_connection();
> @@ -2398,6 +2486,10 @@ void ofono_voicecall_register(struct ofono_voicecall *vc)
> sim_watch(sim_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, vc);
>
> __ofono_atom_register(vc->atom, voicecall_unregister);
> +
> + vc->hfp_watch = __ofono_modem_add_atom_watch(modem,
> + OFONO_ATOM_TYPE_EMULATOR_HFP,
> + emulator_hfp_watch, vc, NULL);
> }
>
> void ofono_voicecall_remove(struct ofono_voicecall *vc)
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-21 19:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-18 16:10 [PATCH v2 0/2] HFP: add call related indicators =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-18 16:10 ` [PATCH 1/2] emulator: add defines for call, callsetup and callheld indicators =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-18 16:10 ` [PATCH 2/2] emulator: add " =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-03-21 19:31 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.