* [RFC PATCH 1/3] call-barring: removed +CSSI type SS notifications
2011-02-09 10:33 [PATCH 0/3] Voice call SS notifications Andras Domokos
@ 2011-02-09 10:33 ` Andras Domokos
2011-02-10 3:04 ` Denis Kenzior
2011-02-09 10:34 ` [RFC PATCH 2/3] ssn: add code and call id to notifications Andras Domokos
2011-02-09 10:34 ` [RFC PATCH 3/3] voicecall: handle voice call SS notifications Andras Domokos
2 siblings, 1 reply; 14+ messages in thread
From: Andras Domokos @ 2011-02-09 10:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4285 bytes --]
---
src/call-barring.c | 74 ----------------------------------------------------
1 files changed, 0 insertions(+), 74 deletions(-)
diff --git a/src/call-barring.c b/src/call-barring.c
index 649826e..84ed277 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -58,9 +58,6 @@ struct ofono_call_barring {
int ss_req_lock;
struct ofono_ssn *ssn;
struct ofono_ussd *ussd;
- unsigned int incoming_bar_watch;
- unsigned int outgoing_bar_watch;
- unsigned int ssn_watch;
unsigned int ussd_watch;
const struct ofono_call_barring_driver *driver;
void *driver_data;
@@ -987,41 +984,10 @@ static GDBusMethodTable cb_methods[] = {
};
static GDBusSignalTable cb_signals[] = {
- { "IncomingBarringInEffect", "" },
- { "OutgoingBarringInEffect", "" },
{ "PropertyChanged", "sv" },
{ }
};
-static void call_barring_incoming_enabled_notify(int idx, void *userdata)
-{
- struct ofono_call_barring *cb = userdata;
- DBusConnection *conn = ofono_dbus_get_connection();
- const char *path = __ofono_atom_get_path(cb->atom);
-
- g_dbus_emit_signal(conn, path, OFONO_CALL_BARRING_INTERFACE,
- "IncomingBarringInEffect", DBUS_TYPE_INVALID);
-}
-
-static void call_barring_outgoing_enabled_notify(int idx, void *userdata)
-{
- struct ofono_call_barring *cb = userdata;
- DBusConnection *conn = ofono_dbus_get_connection();
- const char *path = __ofono_atom_get_path(cb->atom);
- DBusMessage *signal;
-
- signal = dbus_message_new_signal(path, OFONO_CALL_BARRING_INTERFACE,
- "OutgoingBarringInEffect");
-
- if (signal == NULL) {
- ofono_error("Unable to allocate new %s.OutgoingBarringInEffect"
- " signal", OFONO_CALL_BARRING_INTERFACE);
- return;
- }
-
- g_dbus_send_message(conn, signal);
-}
-
int ofono_call_barring_driver_register(const struct ofono_call_barring_driver *d)
{
DBG("driver: %p, name: %s", d, d->name);
@@ -1054,14 +1020,6 @@ static void call_barring_unregister(struct ofono_atom *atom)
if (cb->ussd)
cb_unregister_ss_controls(cb);
- if (cb->incoming_bar_watch)
- __ofono_ssn_mo_watch_remove(cb->ssn, cb->incoming_bar_watch);
- if (cb->outgoing_bar_watch)
- __ofono_ssn_mt_watch_remove(cb->ssn, cb->outgoing_bar_watch);
-
- if (cb->ssn_watch)
- __ofono_modem_remove_atom_watch(modem, cb->ssn_watch);
-
if (cb->ussd_watch)
__ofono_modem_remove_atom_watch(modem, cb->ussd_watch);
}
@@ -1116,29 +1074,6 @@ struct ofono_call_barring *ofono_call_barring_create(struct ofono_modem *modem,
return cb;
}
-static void ssn_watch(struct ofono_atom *atom,
- enum ofono_atom_watch_condition cond, void *data)
-{
- struct ofono_call_barring *cb = data;
-
- if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
- cb->ssn = NULL;
- cb->incoming_bar_watch = 0;
- cb->outgoing_bar_watch = 0;
- return;
- }
-
- cb->ssn = __ofono_atom_get_data(atom);
-
- cb->incoming_bar_watch =
- __ofono_ssn_mo_watch_add(cb->ssn, SS_MO_INCOMING_BARRING,
- call_barring_incoming_enabled_notify, cb, NULL);
-
- cb->outgoing_bar_watch =
- __ofono_ssn_mo_watch_add(cb->ssn, SS_MO_OUTGOING_BARRING,
- call_barring_outgoing_enabled_notify, cb, NULL);
-}
-
static void ussd_watch(struct ofono_atom *atom,
enum ofono_atom_watch_condition cond, void *data)
{
@@ -1158,7 +1093,6 @@ void ofono_call_barring_register(struct ofono_call_barring *cb)
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(cb->atom);
struct ofono_modem *modem = __ofono_atom_get_modem(cb->atom);
- struct ofono_atom *ssn_atom;
struct ofono_atom *ussd_atom;
if (!g_dbus_register_interface(conn, path,
@@ -1173,14 +1107,6 @@ void ofono_call_barring_register(struct ofono_call_barring *cb)
ofono_modem_add_interface(modem, OFONO_CALL_BARRING_INTERFACE);
- cb->ssn_watch = __ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_SSN,
- ssn_watch, cb, NULL);
-
- ssn_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SSN);
-
- if (ssn_atom && __ofono_atom_get_registered(ssn_atom))
- ssn_watch(ssn_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, cb);
-
cb->ussd_watch = __ofono_modem_add_atom_watch(modem,
OFONO_ATOM_TYPE_USSD,
ussd_watch, cb, NULL);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [RFC PATCH 2/3] ssn: add code and call id to notifications
2011-02-09 10:33 [PATCH 0/3] Voice call SS notifications Andras Domokos
2011-02-09 10:33 ` [RFC PATCH 1/3] call-barring: removed +CSSI type " Andras Domokos
@ 2011-02-09 10:34 ` Andras Domokos
2011-02-10 3:08 ` Denis Kenzior
2011-02-09 10:34 ` [RFC PATCH 3/3] voicecall: handle voice call SS notifications Andras Domokos
2 siblings, 1 reply; 14+ messages in thread
From: Andras Domokos @ 2011-02-09 10:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3673 bytes --]
---
drivers/atmodem/ssn.c | 4 ++--
include/ssn.h | 7 ++++---
src/ofono.h | 6 ++++--
src/ssn.c | 11 ++++++-----
4 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/atmodem/ssn.c b/drivers/atmodem/ssn.c
index b7a9df4..b00871d 100644
--- a/drivers/atmodem/ssn.c
+++ b/drivers/atmodem/ssn.c
@@ -56,7 +56,7 @@ static void cssi_notify(GAtResult *result, gpointer user_data)
if (!g_at_result_iter_next_number(&iter, &index))
index = 0;
- ofono_ssn_cssi_notify(ssn, code1, index);
+ ofono_ssn_cssi_notify(ssn, 0, code1, index);
}
static void cssu_notify(GAtResult *result, gpointer user_data)
@@ -93,7 +93,7 @@ static void cssu_notify(GAtResult *result, gpointer user_data)
return;
out:
- ofono_ssn_cssu_notify(ssn, code2, index, &ph);
+ ofono_ssn_cssu_notify(ssn, 0, code2, index, &ph);
}
static void at_ssn_initialized(gboolean ok, GAtResult *result,
diff --git a/include/ssn.h b/include/ssn.h
index d640cad..ba3701b 100644
--- a/include/ssn.h
+++ b/include/ssn.h
@@ -37,9 +37,10 @@ struct ofono_ssn_driver {
};
/* SSN notifications (CSSI and CSSU). */
-void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code, int index);
-void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code, int index,
- const struct ofono_phone_number *number);
+void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, unsigned int id,
+ int code1, int index);
+void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, unsigned int id, int code2,
+ int index, const struct ofono_phone_number *number);
int ofono_ssn_driver_register(const struct ofono_ssn_driver *d);
void ofono_ssn_driver_unregister(const struct ofono_ssn_driver *d);
diff --git a/src/ofono.h b/src/ofono.h
index 6ba0187..eafab21 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -314,8 +314,10 @@ int __ofono_sms_sim_download(struct ofono_stk *stk, const struct sms *msg,
#include <ofono/ssn.h>
-typedef void (*ofono_ssn_mo_notify_cb)(int index, void *user);
-typedef void (*ofono_ssn_mt_notify_cb)(int index,
+typedef void (*ofono_ssn_mo_notify_cb)(unsigned int id, int code1, int index,
+ void *user);
+
+typedef void (*ofono_ssn_mt_notify_cb)(unsigned int id, int code2, int index,
const struct ofono_phone_number *ph,
void *user);
diff --git a/src/ssn.c b/src/ssn.c
index 64c94b7..065e4fd 100644
--- a/src/ssn.c
+++ b/src/ssn.c
@@ -112,7 +112,8 @@ gboolean __ofono_ssn_mt_watch_remove(struct ofono_ssn *ssn, unsigned int id)
return __ofono_watchlist_remove_item(ssn->mt_handler_list, id);
}
-void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code1, int index)
+void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, unsigned int id,
+ int code1, int index)
{
struct ssn_handler *h;
GSList *l;
@@ -123,12 +124,12 @@ void ofono_ssn_cssi_notify(struct ofono_ssn *ssn, int code1, int index)
notify = h->item.notify;
if (h->code == code1)
- notify(index, h->item.notify_data);
+ notify(id, code1, index, h->item.notify_data);
}
}
-void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code2, int index,
- const struct ofono_phone_number *ph)
+void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, unsigned int id, int code2,
+ int index, const struct ofono_phone_number *ph)
{
struct ssn_handler *h;
GSList *l;
@@ -139,7 +140,7 @@ void ofono_ssn_cssu_notify(struct ofono_ssn *ssn, int code2, int index,
notify = h->item.notify;
if (h->code == code2)
- notify(index, ph, h->item.notify_data);
+ notify(id, code2, index, ph, h->item.notify_data);
}
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [RFC PATCH 3/3] voicecall: handle voice call SS notifications
2011-02-09 10:33 [PATCH 0/3] Voice call SS notifications Andras Domokos
2011-02-09 10:33 ` [RFC PATCH 1/3] call-barring: removed +CSSI type " Andras Domokos
2011-02-09 10:34 ` [RFC PATCH 2/3] ssn: add code and call id to notifications Andras Domokos
@ 2011-02-09 10:34 ` Andras Domokos
2 siblings, 0 replies; 14+ messages in thread
From: Andras Domokos @ 2011-02-09 10:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 9464 bytes --]
---
include/types.h | 2 +
src/voicecall.c | 242 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 241 insertions(+), 3 deletions(-)
diff --git a/include/types.h b/include/types.h
index d25f409..b639c8a 100644
--- a/include/types.h
+++ b/include/types.h
@@ -96,6 +96,8 @@ struct ofono_call {
char name[OFONO_MAX_CALLER_NAME_LENGTH + 1];
int clip_validity;
int cnap_validity;
+ ofono_bool_t remote_held;
+ ofono_bool_t remote_multiparty;
};
struct ofono_network_time {
diff --git a/src/voicecall.c b/src/voicecall.c
index 4606668..7178714 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -53,6 +53,15 @@ struct ofono_voicecall {
struct ofono_sim_context *sim_context;
unsigned int sim_watch;
unsigned int sim_state_watch;
+ struct ofono_ssn *ssn;
+ unsigned int ssn_watch;
+ unsigned int ssn_mt_fwd_watch;
+ unsigned int ssn_mt_hold_watch;
+ unsigned int ssn_mt_unhold_watch;
+ unsigned int ssn_mt_mpty_watch;
+ unsigned int ssn_mo_fwd_watch;
+ unsigned int ssn_mo_local_bar_watch;
+ unsigned int ssn_mo_remote_bar_watch;
const struct ofono_voicecall_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -400,6 +409,12 @@ static void append_voicecall_properties(struct voicecall *v,
ofono_dbus_dict_append(dict, "Multiparty", DBUS_TYPE_BOOLEAN, &mpty);
+ ofono_dbus_dict_append(dict, "RemoteHeld", DBUS_TYPE_BOOLEAN,
+ &v->call->remote_held);
+
+ ofono_dbus_dict_append(dict, "RemoteMultiparty", DBUS_TYPE_BOOLEAN,
+ &v->call->remote_multiparty);
+
if (v->message)
ofono_dbus_dict_append(dict, "Information",
DBUS_TYPE_STRING, &v->message);
@@ -1869,9 +1884,11 @@ static GDBusMethodTable manager_methods[] = {
};
static GDBusSignalTable manager_signals[] = {
- { "PropertyChanged", "sv" },
- { "CallAdded", "oa{sv}" },
- { "CallRemoved", "o" },
+ { "Forwarded", "s" },
+ { "BarringActive", "s" },
+ { "PropertyChanged", "sv" },
+ { "CallAdded", "oa{sv}" },
+ { "CallRemoved", "o" },
{ }
};
@@ -2182,6 +2199,11 @@ static void voicecall_unregister(struct ofono_atom *atom)
vc->sim_watch = 0;
}
+ if (vc->ssn_watch) {
+ __ofono_modem_remove_atom_watch(modem, vc->ssn_watch);
+ vc->ssn_watch = 0;
+ }
+
if (vc->dial_req)
dial_request_finish(vc);
@@ -2225,6 +2247,29 @@ static void voicecall_remove(struct ofono_atom *atom)
vc->sim = NULL;
}
+ if (vc->ssn_mt_fwd_watch)
+ __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_fwd_watch);
+
+ if (vc->ssn_mt_hold_watch)
+ __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_hold_watch);
+
+ if (vc->ssn_mt_unhold_watch)
+ __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_unhold_watch);
+
+ if (vc->ssn_mt_mpty_watch)
+ __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mt_mpty_watch);
+
+ if (vc->ssn_mo_fwd_watch)
+ __ofono_ssn_mt_watch_remove(vc->ssn, vc->ssn_mo_fwd_watch);
+
+ if (vc->ssn_mo_local_bar_watch)
+ __ofono_ssn_mt_watch_remove(vc->ssn,
+ vc->ssn_mo_local_bar_watch);
+
+ if (vc->ssn_mo_remote_bar_watch)
+ __ofono_ssn_mo_watch_remove(vc->ssn,
+ vc->ssn_mo_remote_bar_watch);
+
if (vc->tone_source) {
g_source_remove(vc->tone_source);
vc->tone_source = 0;
@@ -2341,12 +2386,194 @@ static void sim_watch(struct ofono_atom *atom,
sim_state_watch(ofono_sim_get_state(sim), vc);
}
+static void ssn_mt_forwarded_notify(unsigned int id, int code1, int idx,
+ const struct ofono_phone_number *ph,
+ void *data)
+{
+ struct ofono_voicecall *vc = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(vc->atom);
+ char *info = "incoming";
+
+ g_dbus_emit_signal(conn, path, OFONO_VOICECALL_MANAGER_INTERFACE,
+ "Forwarded",
+ DBUS_TYPE_STRING, &info,
+ DBUS_TYPE_INVALID);
+}
+
+static struct voicecall *voicecall_select(struct ofono_voicecall *vc,
+ unsigned int id, int code)
+{
+ struct voicecall *v = NULL;
+ GSList *l;
+
+ for (l = vc->call_list; l; l = l->next) {
+ struct voicecall *v1 = l->data;
+
+ if (id == 0 && g_slist_length(vc->call_list) == 1) {
+ if (code == SS_MT_VOICECALL_RETRIEVED &&
+ v1->call->remote_held == TRUE) {
+ v = v1;
+ break;
+ } else if (code == SS_MT_VOICECALL_ON_HOLD &&
+ v1->call->remote_held == FALSE) {
+ v = v1;
+ break;
+ } else if (code == SS_MT_MULTIPARTY_VOICECALL &&
+ v1->call->remote_multiparty == FALSE) {
+ v = v1;
+ break;
+ }
+ } else if (v1->call->id == id) {
+ v = v1;
+ break;
+ }
+ }
+
+ return v;
+}
+
+static void ssn_mt_remote_held_notify(unsigned int id, int code1, int idx,
+ const struct ofono_phone_number *ph,
+ void *data)
+{
+ struct ofono_voicecall *vc = data;
+ struct voicecall *v = voicecall_select(vc, id, code1);
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path;
+
+ if (v == NULL)
+ return;
+
+ if (code1 == SS_MT_VOICECALL_ON_HOLD)
+ v->call->remote_held = TRUE;
+ else
+ v->call->remote_held = FALSE;
+
+ path = voicecall_build_path(vc, v->call);
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_VOICECALL_INTERFACE,
+ "RemoteHeld", DBUS_TYPE_BOOLEAN,
+ &v->call->remote_held);
+}
+
+static void ssn_mt_remote_multiparty_notify(unsigned int id, int code1, int idx,
+ const struct ofono_phone_number *ph,
+ void *data)
+{
+ struct ofono_voicecall *vc = data;
+ struct voicecall *v = voicecall_select(vc, id, code1);
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path;
+
+ if (v == NULL)
+ return;
+
+ v->call->remote_multiparty = TRUE;
+
+ path = voicecall_build_path(vc, v->call);
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_VOICECALL_INTERFACE,
+ "RemoteMultiparty", DBUS_TYPE_BOOLEAN,
+ &v->call->remote_multiparty);
+}
+
+static void ssn_mo_call_barred_notify(unsigned int id, int code2,
+ int idx, void *data)
+{
+ struct ofono_voicecall *vc = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(vc->atom);
+ const char *info;
+
+ if (code2 == SS_MO_INCOMING_BARRING)
+ info = "remote";
+ else
+ info = "local";
+
+ g_dbus_emit_signal(conn, path, OFONO_VOICECALL_MANAGER_INTERFACE,
+ "BarringActive",
+ DBUS_TYPE_STRING, &info,
+ DBUS_TYPE_INVALID);
+}
+
+static void ssn_mo_forwarded_notify(unsigned int id, int code2,
+ int idx, void *data)
+{
+ struct ofono_voicecall *vc = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = __ofono_atom_get_path(vc->atom);
+ char *info = "outgoing";
+
+ g_dbus_emit_signal(conn, path, OFONO_VOICECALL_MANAGER_INTERFACE,
+ "Forwarded",
+ DBUS_TYPE_STRING, &info,
+ DBUS_TYPE_INVALID);
+}
+
+static void ssn_watch_notify(struct ofono_atom *atom,
+ enum ofono_atom_watch_condition cond, void *data)
+{
+ struct ofono_voicecall *vc = data;
+
+ if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+ vc->ssn_mt_fwd_watch = 0;
+ vc->ssn_mt_hold_watch = 0;
+ vc->ssn_mt_unhold_watch = 0;
+ vc->ssn_mt_mpty_watch = 0;
+ vc->ssn_mo_local_bar_watch = 0;
+ vc->ssn_mo_remote_bar_watch = 0;
+ vc->ssn = NULL;
+ return;
+ }
+
+ vc->ssn = __ofono_atom_get_data(atom);
+
+ vc->ssn_mt_fwd_watch = __ofono_ssn_mt_watch_add(vc->ssn,
+ SS_MT_CALL_FORWARDED,
+ ssn_mt_forwarded_notify,
+ vc, NULL);
+
+ vc->ssn_mt_hold_watch = __ofono_ssn_mt_watch_add(vc->ssn,
+ SS_MT_VOICECALL_ON_HOLD,
+ ssn_mt_remote_held_notify,
+ vc, NULL);
+
+ vc->ssn_mt_unhold_watch = __ofono_ssn_mt_watch_add(vc->ssn,
+ SS_MT_VOICECALL_RETRIEVED,
+ ssn_mt_remote_held_notify,
+ vc, NULL);
+
+ vc->ssn_mt_mpty_watch = __ofono_ssn_mt_watch_add(vc->ssn,
+ SS_MT_MULTIPARTY_VOICECALL,
+ ssn_mt_remote_multiparty_notify,
+ vc, NULL);
+
+ vc->ssn_mo_fwd_watch = __ofono_ssn_mo_watch_add(vc->ssn,
+ SS_MO_CALL_FORWARDED,
+ ssn_mo_forwarded_notify,
+ vc, NULL);
+
+ vc->ssn_mo_local_bar_watch = __ofono_ssn_mo_watch_add(vc->ssn,
+ SS_MO_OUTGOING_BARRING,
+ ssn_mo_call_barred_notify,
+ vc, NULL);
+
+ vc->ssn_mo_remote_bar_watch = __ofono_ssn_mo_watch_add(vc->ssn,
+ SS_MO_INCOMING_BARRING,
+ ssn_mo_call_barred_notify,
+ vc, NULL);
+}
+
void ofono_voicecall_register(struct ofono_voicecall *vc)
{
DBusConnection *conn = ofono_dbus_get_connection();
struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
const char *path = __ofono_atom_get_path(vc->atom);
struct ofono_atom *sim_atom;
+ struct ofono_atom *ssn_atom;
if (!g_dbus_register_interface(conn, path,
OFONO_VOICECALL_MANAGER_INTERFACE,
@@ -2376,6 +2603,15 @@ void ofono_voicecall_register(struct ofono_voicecall *vc)
if (sim_atom && __ofono_atom_get_registered(sim_atom))
sim_watch(sim_atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, vc);
+ vc->ssn_watch = __ofono_modem_add_atom_watch(modem, OFONO_ATOM_TYPE_SSN,
+ ssn_watch_notify, vc, NULL);
+
+ ssn_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SSN);
+
+ if (ssn_atom && __ofono_atom_get_registered(ssn_atom))
+ ssn_watch_notify(ssn_atom,
+ OFONO_ATOM_WATCH_CONDITION_REGISTERED, vc);
+
__ofono_atom_register(vc->atom, voicecall_unregister);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread