* [RFC PATCH 1/4] modem: add modem online-offline watch
2010-11-13 16:33 [PATCH 0/4] Emergency Calls (3rd round) Andras Domokos
@ 2010-11-13 16:33 ` Andras Domokos
2010-11-13 16:33 ` [RFC PATCH 2/4] modem: add EmergencyMode property Andras Domokos
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Andras Domokos @ 2010-11-13 16:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3718 bytes --]
From: Andras Domokos <andras.domokos@nokia.com>
---
src/modem.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 8 ++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 3776461..f73cc1d 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -72,6 +72,7 @@ struct ofono_modem {
ofono_bool_t powered_pending;
guint timeout;
ofono_bool_t online;
+ struct ofono_watchlist *online_watches;
GHashTable *properties;
struct ofono_sim *sim;
unsigned int sim_watch;
@@ -362,6 +363,22 @@ static void flush_atoms(struct ofono_modem *modem, enum modem_state new_state)
}
}
+static void notify_online_watches(struct ofono_modem *modem)
+{
+ struct ofono_watchlist_item *item;
+ GSList *l;
+ ofono_modem_online_notify_func notify;
+
+ if (modem->online_watches == NULL)
+ return;
+
+ for (l = modem->online_watches->items; l; l = l->next) {
+ item = l->data;
+ notify = item->notify;
+ notify(modem->online, item->notify_data);
+ }
+}
+
static void modem_change_state(struct ofono_modem *modem,
enum modem_state new_state)
{
@@ -404,11 +421,13 @@ static void modem_change_state(struct ofono_modem *modem,
__ofono_history_probe_drivers(modem);
__ofono_nettime_probe_drivers(modem);
}
+ notify_online_watches(modem);
break;
case MODEM_STATE_ONLINE:
if (driver->post_online)
driver->post_online(modem);
+ notify_online_watches(modem);
break;
}
}
@@ -437,6 +456,29 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
}
}
+unsigned __ofono_modem_add_online_watch(struct ofono_modem *modem,
+ ofono_modem_online_notify_func notify,
+ void *data, ofono_destroy_func destroy)
+{
+ struct ofono_watchlist_item *item;
+
+ if (modem == NULL || notify == NULL)
+ return 0;
+
+ item = g_new0(struct ofono_watchlist_item, 1);
+
+ item->notify = notify;
+ item->destroy = destroy;
+ item->notify_data = data;
+
+ return __ofono_watchlist_add_item(modem->online_watches, item);
+}
+
+void __ofono_modem_remove_online_watch(struct ofono_modem *modem, unsigned id)
+{
+ __ofono_watchlist_remove_item(modem->online_watches, id);
+}
+
static void online_cb(const struct ofono_error *error, void *data)
{
struct ofono_modem *modem = data;
@@ -1472,6 +1514,7 @@ int ofono_modem_register(struct ofono_modem *modem)
modem->driver_type = NULL;
modem->atom_watches = __ofono_watchlist_new(g_free);
+ modem->online_watches = __ofono_watchlist_new(g_free);
emit_modem_added(modem);
call_modemwatches(modem, TRUE);
@@ -1503,6 +1546,9 @@ static void modem_unregister(struct ofono_modem *modem)
__ofono_watchlist_free(modem->atom_watches);
modem->atom_watches = NULL;
+ __ofono_watchlist_free(modem->online_watches);
+ modem->online_watches = NULL;
+
modem->sim_watch = 0;
modem->sim_ready_watch = 0;
diff --git a/src/ofono.h b/src/ofono.h
index ab6ecd2..01cd6c0 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -177,6 +177,14 @@ unsigned int __ofono_modemwatch_add(ofono_modemwatch_cb_t cb, void *user,
ofono_destroy_func destroy);
gboolean __ofono_modemwatch_remove(unsigned int id);
+typedef void (*ofono_modem_online_notify_func)(ofono_bool_t online,
+ void *data);
+unsigned int __ofono_modem_add_online_watch(struct ofono_modem *modem,
+ ofono_modem_online_notify_func notify,
+ void *data, ofono_destroy_func destroy);
+void __ofono_modem_remove_online_watch(struct ofono_modem *modem,
+ unsigned int id);
+
#include <ofono/call-barring.h>
gboolean __ofono_call_barring_is_busy(struct ofono_call_barring *cb);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RFC PATCH 2/4] modem: add EmergencyMode property
2010-11-13 16:33 [PATCH 0/4] Emergency Calls (3rd round) Andras Domokos
2010-11-13 16:33 ` [RFC PATCH 1/4] modem: add modem online-offline watch Andras Domokos
@ 2010-11-13 16:33 ` Andras Domokos
2010-11-13 16:33 ` [RFC PATCH 3/4] modem: move dial_request_cb function Andras Domokos
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Andras Domokos @ 2010-11-13 16:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5990 bytes --]
From: Andras Domokos <andras.domokos@nokia.com>
---
src/modem.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/ofono.h | 4 ++
2 files changed, 136 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index f73cc1d..5315e72 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -72,6 +72,8 @@ struct ofono_modem {
ofono_bool_t powered_pending;
guint timeout;
ofono_bool_t online;
+ ofono_bool_t emergency_online;
+ unsigned int emergency_mode;
struct ofono_watchlist *online_watches;
GHashTable *properties;
struct ofono_sim *sim;
@@ -514,6 +516,125 @@ static void offline_cb(const struct ofono_error *error, void *data)
modem_change_state(modem, MODEM_STATE_OFFLINE);
}
+ofono_bool_t ofono_modem_get_emergency_mode(struct ofono_modem *modem)
+{
+ if (modem == NULL)
+ return FALSE;
+
+ return modem->emergency_mode != 0;
+}
+
+static void modem_change_online(struct ofono_modem *modem,
+ enum modem_state new_state)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ enum modem_state old_state = modem->modem_state;
+ ofono_bool_t new_online = new_state == MODEM_STATE_ONLINE;
+
+ DBG("old state: %d, new state: %d", old_state, new_state);
+
+ if (new_online == modem->online)
+ return;
+
+ modem->modem_state = new_state;
+ modem->emergency_online = modem->online;
+ modem->online = new_online;
+
+ ofono_dbus_signal_property_changed(conn, modem->path,
+ OFONO_MODEM_INTERFACE, "Online",
+ DBUS_TYPE_BOOLEAN, &modem->online);
+
+ notify_online_watches(modem);
+}
+
+static void emergency_online_cb(const struct ofono_error *error, void *data)
+{
+ struct ofono_modem *modem = data;
+
+ DBG("modem: %p", modem);
+
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
+ modem->modem_state == MODEM_STATE_OFFLINE)
+ modem_change_online(modem, MODEM_STATE_ONLINE);
+}
+
+static void emergency_offline_cb(const struct ofono_error *error, void *data)
+{
+ struct ofono_modem *modem = data;
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = ofono_modem_get_path(modem);
+ gboolean state = FALSE;
+
+ DBG("modem: %p", modem);
+
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
+ modem->modem_state == MODEM_STATE_ONLINE)
+ modem_change_online(modem, MODEM_STATE_OFFLINE);
+
+ modem->emergency_mode--;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_MODEM_INTERFACE,
+ "EmergencyMode",
+ DBUS_TYPE_BOOLEAN,
+ &state);
+}
+
+void ofono_modem_inc_emergency_mode(struct ofono_modem *modem)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = ofono_modem_get_path(modem);
+ gboolean state = TRUE;
+
+ DBG("modem: %p", modem);
+
+ modem->emergency_mode++;
+ if (modem->emergency_mode > 1)
+ return;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_MODEM_INTERFACE,
+ "EmergencyMode",
+ DBUS_TYPE_BOOLEAN,
+ &state);
+
+ if (modem->online)
+ return;
+
+ modem->driver->set_online(modem, TRUE, emergency_online_cb, modem);
+}
+
+void ofono_modem_dec_emergency_mode(struct ofono_modem *modem)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ const char *path = ofono_modem_get_path(modem);
+ gboolean state = FALSE;
+
+ DBG("modem: %p", modem);
+
+ if (modem->emergency_mode == 0)
+ return;
+
+ if (modem->emergency_mode > 1) {
+ modem->emergency_mode--;
+ return;
+ }
+
+ if (!modem->emergency_online) {
+ modem->driver->set_online(modem, FALSE,
+ emergency_offline_cb, modem);
+ return;
+ }
+
+ modem->emergency_mode--;
+
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_MODEM_INTERFACE,
+ "EmergencyMode",
+ DBUS_TYPE_BOOLEAN,
+ &state);
+}
+
static DBusMessage *set_property_online(struct ofono_modem *modem,
DBusMessage *msg,
DBusMessageIter *var)
@@ -535,6 +656,9 @@ static DBusMessage *set_property_online(struct ofono_modem *modem,
if (modem->modem_state < MODEM_STATE_OFFLINE)
return __ofono_error_not_available(msg);
+ if (modem->emergency_mode)
+ return __ofono_error_failed(msg);
+
if (modem->online == online)
return dbus_message_new_method_return(msg);
@@ -562,6 +686,7 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
int i;
GSList *l;
struct ofono_atom *devinfo_atom;
+ ofono_bool_t state;
ofono_dbus_dict_append(dict, "Online", DBUS_TYPE_BOOLEAN,
&modem->online);
@@ -569,6 +694,10 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
ofono_dbus_dict_append(dict, "Powered", DBUS_TYPE_BOOLEAN,
&modem->powered);
+ state = ofono_modem_get_emergency_mode(modem);
+ ofono_dbus_dict_append(dict, "EmergencyMode",
+ DBUS_TYPE_BOOLEAN, &state);
+
devinfo_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_DEVINFO);
/* We cheat a little here and don't check the registered status */
@@ -647,6 +776,9 @@ static int set_powered(struct ofono_modem *modem, ofono_bool_t powered)
if (modem->powered_pending == powered)
return -EALREADY;
+ if (modem->emergency_mode)
+ return -EINVAL;
+
/* Remove the atoms even if the driver is no longer available */
if (powered == FALSE)
modem_change_state(modem, MODEM_STATE_POWER_OFF);
diff --git a/src/ofono.h b/src/ofono.h
index 01cd6c0..ac56a85 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -185,6 +185,10 @@ unsigned int __ofono_modem_add_online_watch(struct ofono_modem *modem,
void __ofono_modem_remove_online_watch(struct ofono_modem *modem,
unsigned int id);
+ofono_bool_t ofono_modem_get_emergency_mode(struct ofono_modem *modem);
+void ofono_modem_inc_emergency_mode(struct ofono_modem *modem);
+void ofono_modem_dec_emergency_mode(struct ofono_modem *modem);
+
#include <ofono/call-barring.h>
gboolean __ofono_call_barring_is_busy(struct ofono_call_barring *cb);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RFC PATCH 3/4] modem: move dial_request_cb function
2010-11-13 16:33 [PATCH 0/4] Emergency Calls (3rd round) Andras Domokos
2010-11-13 16:33 ` [RFC PATCH 1/4] modem: add modem online-offline watch Andras Domokos
2010-11-13 16:33 ` [RFC PATCH 2/4] modem: add EmergencyMode property Andras Domokos
@ 2010-11-13 16:33 ` Andras Domokos
2010-11-13 16:34 ` [RFC PATCH 4/4] voicecall: add emergency call handling Andras Domokos
2010-11-15 10:45 ` [PATCH 0/4] Emergency Calls (3rd round) Predon, Frederic
4 siblings, 0 replies; 8+ messages in thread
From: Andras Domokos @ 2010-11-13 16:33 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2445 bytes --]
---
src/voicecall.c | 70 +++++++++++++++++++++++++++---------------------------
1 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index bd64432..3af614b 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2202,6 +2202,41 @@ static void sim_watch(struct ofono_atom *atom,
sim_state_watch(ofono_sim_get_state(sim), vc);
}
+static void dial_request_cb(const struct ofono_error *error, void *data)
+{
+ struct ofono_voicecall *vc = data;
+ gboolean need_to_emit;
+ struct voicecall *v;
+
+ v = dial_handle_result(vc, error,
+ phone_number_to_string(&vc->dial_req->ph),
+ &need_to_emit);
+
+ if (v == NULL) {
+ dial_request_finish(vc);
+ return;
+ }
+
+ v->message = vc->dial_req->message;
+ v->icon_id = vc->dial_req->icon_id;
+
+ vc->dial_req->message = NULL;
+ vc->dial_req->call = v;
+
+ /*
+ * TS 102 223 Section 6.4.13: The terminal shall not store
+ * in the UICC the call set-up details (called party number
+ * and associated parameters)
+ */
+ v->untracked = TRUE;
+
+ if (v->call->status == CALL_STATUS_ACTIVE)
+ dial_request_finish(vc);
+
+ if (need_to_emit)
+ voicecalls_emit_call_added(vc, v);
+}
+
void ofono_voicecall_register(struct ofono_voicecall *vc)
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -2294,41 +2329,6 @@ ofono_bool_t __ofono_voicecall_is_busy(struct ofono_voicecall *vc,
return TRUE;
}
-static void dial_request_cb(const struct ofono_error *error, void *data)
-{
- struct ofono_voicecall *vc = data;
- gboolean need_to_emit;
- struct voicecall *v;
-
- v = dial_handle_result(vc, error,
- phone_number_to_string(&vc->dial_req->ph),
- &need_to_emit);
-
- if (v == NULL) {
- dial_request_finish(vc);
- return;
- }
-
- v->message = vc->dial_req->message;
- v->icon_id = vc->dial_req->icon_id;
-
- vc->dial_req->message = NULL;
- vc->dial_req->call = v;
-
- /*
- * TS 102 223 Section 6.4.13: The terminal shall not store
- * in the UICC the call set-up details (called party number
- * and associated parameters)
- */
- v->untracked = TRUE;
-
- if (v->call->status == CALL_STATUS_ACTIVE)
- dial_request_finish(vc);
-
- if (need_to_emit)
- voicecalls_emit_call_added(vc, v);
-}
-
static void dial_request(struct ofono_voicecall *vc)
{
vc->driver->dial(vc, &vc->dial_req->ph, OFONO_CLIR_OPTION_DEFAULT,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RFC PATCH 4/4] voicecall: add emergency call handling
2010-11-13 16:33 [PATCH 0/4] Emergency Calls (3rd round) Andras Domokos
` (2 preceding siblings ...)
2010-11-13 16:33 ` [RFC PATCH 3/4] modem: move dial_request_cb function Andras Domokos
@ 2010-11-13 16:34 ` Andras Domokos
2010-11-15 10:45 ` [PATCH 0/4] Emergency Calls (3rd round) Predon, Frederic
4 siblings, 0 replies; 8+ messages in thread
From: Andras Domokos @ 2010-11-13 16:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7079 bytes --]
---
src/voicecall.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 110 insertions(+), 1 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 3af614b..066cdb9 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -52,6 +52,7 @@ struct ofono_voicecall {
struct ofono_sim *sim;
unsigned int sim_watch;
unsigned int sim_state_watch;
+ unsigned int modem_online_watch;
const struct ofono_voicecall_driver *driver;
void *driver_data;
struct ofono_atom *atom;
@@ -133,6 +134,22 @@ static void add_to_en_list(GSList **l, const char **list)
*l = g_slist_prepend(*l, g_strdup(list[i++]));
}
+static gint number_compare(gconstpointer a, gconstpointer b)
+{
+ const char *s1 = a, *s2 = b;
+ return strcmp(s1, s2);
+}
+
+static ofono_bool_t emergency_number(struct ofono_voicecall *vc,
+ const char *number)
+{
+ if (!number)
+ return FALSE;
+
+ return g_slist_find_custom(vc->en_list,
+ number, number_compare) ? TRUE : FALSE;
+}
+
static const char *disconnect_reason_to_string(enum ofono_disconnect_reason r)
{
switch (r) {
@@ -1125,6 +1142,7 @@ static struct voicecall *dial_handle_result(struct ofono_voicecall *vc,
static void manager_dial_callback(const struct ofono_error *error, void *data)
{
struct ofono_voicecall *vc = data;
+ struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
DBusMessage *reply;
const char *number;
gboolean need_to_emit;
@@ -1143,8 +1161,12 @@ static void manager_dial_callback(const struct ofono_error *error, void *data)
dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID);
- } else
+ } else {
+ if (emergency_number(vc, number))
+ ofono_modem_dec_emergency_mode(modem);
+
reply = __ofono_error_failed(vc->pending);
+ }
__ofono_dbus_pending_reply(&vc->pending, reply);
@@ -1156,6 +1178,7 @@ static DBusMessage *manager_dial(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct ofono_voicecall *vc = data;
+ struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
const char *number;
struct ofono_phone_number ph;
const char *clirstr;
@@ -1195,6 +1218,15 @@ static DBusMessage *manager_dial(DBusConnection *conn,
string_to_phone_number(number, &ph);
+ if (emergency_number(vc, number)) {
+ ofono_bool_t online = ofono_modem_get_online(modem);
+
+ ofono_modem_inc_emergency_mode(modem);
+
+ if (!online)
+ return NULL;
+ }
+
vc->driver->dial(vc, &ph, clir, OFONO_CUG_OPTION_DEFAULT,
manager_dial_callback, vc);
@@ -1748,6 +1780,7 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
const struct ofono_error *error)
{
struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+ const char *number;
GSList *l;
struct voicecall *call;
time_t ts;
@@ -1767,6 +1800,7 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
}
call = l->data;
+ number = phone_number_to_string(&call->call->phone_number);
ts = time(NULL);
prev_status = call->call->status;
@@ -1805,6 +1839,9 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
voicecalls_emit_call_removed(vc, call);
+ if (emergency_number(vc, number))
+ ofono_modem_dec_emergency_mode(modem);
+
voicecall_dbus_unregister(vc, call);
vc->call_list = g_slist_remove(vc->call_list, call);
@@ -2067,6 +2104,7 @@ static void voicecall_unregister(struct ofono_atom *atom)
static void voicecall_remove(struct ofono_atom *atom)
{
struct ofono_voicecall *vc = __ofono_atom_get_data(atom);
+ struct ofono_modem *modem = __ofono_atom_get_modem(atom);
DBG("atom: %p", atom);
@@ -2108,6 +2146,12 @@ static void voicecall_remove(struct ofono_atom *atom)
g_queue_free(vc->toneq);
}
+ if (vc->modem_online_watch) {
+ __ofono_modem_remove_online_watch(modem,
+ vc->modem_online_watch);
+ vc->modem_online_watch = 0;
+ }
+
g_free(vc);
}
@@ -2205,6 +2249,7 @@ static void sim_watch(struct ofono_atom *atom,
static void dial_request_cb(const struct ofono_error *error, void *data)
{
struct ofono_voicecall *vc = data;
+ struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
gboolean need_to_emit;
struct voicecall *v;
@@ -2214,6 +2259,9 @@ static void dial_request_cb(const struct ofono_error *error, void *data)
if (v == NULL) {
dial_request_finish(vc);
+ if (emergency_number(vc,
+ phone_number_to_string(&vc->dial_req->ph)))
+ ofono_modem_dec_emergency_mode(modem);
return;
}
@@ -2237,6 +2285,53 @@ static void dial_request_cb(const struct ofono_error *error, void *data)
voicecalls_emit_call_added(vc, v);
}
+static void modem_online_watch(ofono_bool_t online, void *data)
+{
+ struct ofono_voicecall *vc = data;
+ struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+ DBusMessage *reply;
+ const char *number;
+ struct ofono_phone_number ph;
+ const char *clirstr;
+ enum ofono_clir_option clir;
+
+ if (ofono_modem_get_emergency_mode(modem) != TRUE)
+ return;
+
+ if (vc->dial_req)
+ vc->driver->dial(vc, &vc->dial_req->ph,
+ OFONO_CLIR_OPTION_DEFAULT,
+ OFONO_CUG_OPTION_DEFAULT,
+ dial_request_cb, vc);
+
+ if (!vc->pending)
+ return;
+
+ if (strcmp(dbus_message_get_member(vc->pending), "Dial"))
+ return;
+
+ if (dbus_message_get_args(vc->pending, NULL, DBUS_TYPE_STRING, &number,
+ DBUS_TYPE_STRING, &clirstr,
+ DBUS_TYPE_INVALID) == FALSE)
+ return;
+
+ if (!emergency_number(vc, number))
+ return;
+
+ if (!online) {
+ reply = __ofono_error_failed(vc->pending);
+ __ofono_dbus_pending_reply(&vc->pending, reply);
+ ofono_modem_dec_emergency_mode(modem);
+ return;
+ }
+
+ clir_string_to_clir(clirstr, &clir);
+ string_to_phone_number(number, &ph);
+
+ vc->driver->dial(vc, &ph, clir, OFONO_CUG_OPTION_DEFAULT,
+ manager_dial_callback, vc);
+}
+
void ofono_voicecall_register(struct ofono_voicecall *vc)
{
DBusConnection *conn = ofono_dbus_get_connection();
@@ -2255,6 +2350,9 @@ void ofono_voicecall_register(struct ofono_voicecall *vc)
}
ofono_modem_add_interface(modem, OFONO_VOICECALL_MANAGER_INTERFACE);
+ vc->modem_online_watch = __ofono_modem_add_online_watch(modem,
+ modem_online_watch,
+ vc, NULL);
/*
* Start out with the 22.101 mandated numbers, if we have a SIM and
@@ -2331,6 +2429,17 @@ ofono_bool_t __ofono_voicecall_is_busy(struct ofono_voicecall *vc,
static void dial_request(struct ofono_voicecall *vc)
{
+ struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+
+ if (emergency_number(vc, phone_number_to_string(&vc->dial_req->ph))) {
+ ofono_bool_t online = ofono_modem_get_online(modem);
+
+ ofono_modem_inc_emergency_mode(modem);
+
+ if (!online)
+ return;
+ }
+
vc->driver->dial(vc, &vc->dial_req->ph, OFONO_CLIR_OPTION_DEFAULT,
OFONO_CUG_OPTION_DEFAULT, dial_request_cb, vc);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* RE: [PATCH 0/4] Emergency Calls (3rd round)
2010-11-13 16:33 [PATCH 0/4] Emergency Calls (3rd round) Andras Domokos
` (3 preceding siblings ...)
2010-11-13 16:34 ` [RFC PATCH 4/4] voicecall: add emergency call handling Andras Domokos
@ 2010-11-15 10:45 ` Predon, Frederic
2010-11-15 15:34 ` Andras Domokos
4 siblings, 1 reply; 8+ messages in thread
From: Predon, Frederic @ 2010-11-15 10:45 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1600 bytes --]
Hi Andras,
> Here is a new proposal for emergency calls handling.
>
> Steps in handling emergency calls:
> - subscribe to modem online notifications (add modem online watcher)
> - an emergency call detected (phone number is emergency number)
> - increment emergency mode
> - advertise "EmergencyMode" property change on D-Bus (first call)
> - set modem online if it's in offline mode (minimal setup)
> - adevertise "Online" property change on D-Bus
> - if modem is not online postpone making the call, otherwise make
> the emergency call
> - when modem online notification comes and there is postponed call
> request
> make the emergency call
> - when an emergency call ends decrement emergency mode
> - set modem offline if it was set online due to the emergency call
> (last call)
> - advertise "Online" property change on D-Bus
> - advertise "EmergencyMode" property change on D-Bus (last call)
Do you handle the case of making an emergency call when there is no SIM card?
Fred
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 0/4] Emergency Calls (3rd round)
2010-11-15 10:45 ` [PATCH 0/4] Emergency Calls (3rd round) Predon, Frederic
@ 2010-11-15 15:34 ` Andras Domokos
2010-11-15 16:17 ` Marcel Holtmann
0 siblings, 1 reply; 8+ messages in thread
From: Andras Domokos @ 2010-11-15 15:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2193 bytes --]
Hi Frederic,
I found a small issue in these patches, resulting into improper handling
of the emergency calls for the non-SIM cases, but now that has been
fixed and I am going to create a new set of patches.
The answer to your question is yes, emergency calls will be also
possible without a SIM card.
Andras
On 11/15/2010 12:45 PM, ext Predon, Frederic wrote:
> Hi Andras,
>
>
>> Here is a new proposal for emergency calls handling.
>>
>> Steps in handling emergency calls:
>> - subscribe to modem online notifications (add modem online watcher)
>> - an emergency call detected (phone number is emergency number)
>> - increment emergency mode
>> - advertise "EmergencyMode" property change on D-Bus (first call)
>> - set modem online if it's in offline mode (minimal setup)
>> - adevertise "Online" property change on D-Bus
>> - if modem is not online postpone making the call, otherwise make
>> the emergency call
>> - when modem online notification comes and there is postponed call
>> request
>> make the emergency call
>> - when an emergency call ends decrement emergency mode
>> - set modem offline if it was set online due to the emergency call
>> (last call)
>> - advertise "Online" property change on D-Bus
>> - advertise "EmergencyMode" property change on D-Bus (last call)
>>
> Do you handle the case of making an emergency call when there is no SIM card?
>
> Fred
> ---------------------------------------------------------------------
> Intel Corporation SAS (French simplified joint stock company)
> Registered headquarters: "Les Montalets"- 2, rue de Paris,
> 92196 Meudon Cedex, France
> Registration Number: 302 456 199 R.C.S. NANTERRE
> Capital: 4,572,000 Euros
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
> _______________________________________________
> ofono mailing list
> ofono(a)ofono.org
> http://lists.ofono.org/listinfo/ofono
>
^ permalink raw reply [flat|nested] 8+ messages in thread