* [RFC PATCH 1/9] dbus: Add __ofono_error_emergency_active
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 2/9] include: add ofono_modem_get_emergency_mode api Jeevaka Badrappan
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
---
src/dbus.c | 7 +++++++
src/ofono.h | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/dbus.c b/src/dbus.c
index 01d43cf..73b3294 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -361,6 +361,13 @@ DBusMessage *__ofono_error_access_denied(DBusMessage *msg)
"Operation not permitted");
}
+DBusMessage *__ofono_error_emergency_active(DBusMessage *msg)
+{
+ return g_dbus_create_error(msg,
+ OFONO_ERROR_INTERFACE ".EmergencyActive",
+ "Emergency active");
+}
+
void __ofono_dbus_pending_reply(DBusMessage **msg, DBusMessage *reply)
{
DBusConnection *conn = ofono_dbus_get_connection();
diff --git a/src/ofono.h b/src/ofono.h
index b9ca314..511be8a 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -58,6 +58,7 @@ DBusMessage *__ofono_error_not_attached(DBusMessage *msg);
DBusMessage *__ofono_error_attach_in_progress(DBusMessage *msg);
DBusMessage *__ofono_error_canceled(DBusMessage *msg);
DBusMessage *__ofono_error_access_denied(DBusMessage *msg);
+DBusMessage *__ofono_error_emergency_active(DBusMessage *msg);
void __ofono_dbus_pending_reply(DBusMessage **msg, DBusMessage *reply);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* [RFC PATCH 2/9] include: add ofono_modem_get_emergency_mode api
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 1/9] dbus: Add __ofono_error_emergency_active Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 3/9] modem: " Jeevaka Badrappan
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 593 bytes --]
---
include/modem.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/modem.h b/include/modem.h
index a92eb88..5a34370 100644
--- a/include/modem.h
+++ b/include/modem.h
@@ -53,6 +53,8 @@ ofono_bool_t ofono_modem_get_powered(struct ofono_modem *modem);
ofono_bool_t ofono_modem_get_online(struct ofono_modem *modem);
+ofono_bool_t ofono_modem_get_emergency_mode(struct ofono_modem *modem);
+
void ofono_modem_set_name(struct ofono_modem *modem, const char *name);
int ofono_modem_set_string(struct ofono_modem *modem,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* [RFC PATCH 3/9] modem: add ofono_modem_get_emergency_mode api
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 1/9] dbus: Add __ofono_error_emergency_active Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 2/9] include: add ofono_modem_get_emergency_mode api Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 4/9] modem: add Emergency property Jeevaka Badrappan
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 621 bytes --]
---
src/modem.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 26468e8..2b49770 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -86,6 +86,7 @@ struct ofono_modem {
void *driver_data;
char *driver_type;
char *name;
+ guint emergency;
};
struct ofono_devinfo {
@@ -2040,3 +2041,8 @@ void __ofono_modem_foreach(ofono_modem_foreach_func func, void *userdata)
func(modem, userdata);
}
}
+
+ofono_bool_t ofono_modem_get_emergency_mode(struct ofono_modem *modem)
+{
+ return modem->emergency != 0;
+}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* [RFC PATCH 4/9] modem: add Emergency property
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (2 preceding siblings ...)
2011-03-31 16:18 ` [RFC PATCH 3/9] modem: " Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 5/9] modem: add increment/decrement emergency mode api Jeevaka Badrappan
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 917 bytes --]
---
src/modem.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 2b49770..0aef463 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -669,6 +669,7 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
int i;
GSList *l;
struct ofono_atom *devinfo_atom;
+ dbus_bool_t emergency = ofono_modem_get_emergency_mode(modem);
ofono_dbus_dict_append(dict, "Online", DBUS_TYPE_BOOLEAN,
&modem->online);
@@ -679,6 +680,9 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
ofono_dbus_dict_append(dict, "Lockdown", DBUS_TYPE_BOOLEAN,
&modem->lockdown);
+ ofono_dbus_dict_append(dict, "Emergency", DBUS_TYPE_BOOLEAN,
+ &emergency);
+
devinfo_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_DEVINFO);
/* We cheat a little here and don't check the registered status */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* [RFC PATCH 5/9] modem: add increment/decrement emergency mode api
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (3 preceding siblings ...)
2011-03-31 16:18 ` [RFC PATCH 4/9] modem: add Emergency property Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 6/9] modem: modem state decoupled from rf state Jeevaka Badrappan
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1788 bytes --]
---
src/modem.c | 36 ++++++++++++++++++++++++++++++++++++
src/ofono.h | 3 +++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 0aef463..72937a3 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -2050,3 +2050,39 @@ ofono_bool_t ofono_modem_get_emergency_mode(struct ofono_modem *modem)
{
return modem->emergency != 0;
}
+
+void __ofono_modem_inc_emergency_mode(struct ofono_modem *modem)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ dbus_bool_t emergency = TRUE;
+
+ if (++modem->emergency > 1)
+ return;
+
+ ofono_dbus_signal_property_changed(conn, modem->path,
+ OFONO_MODEM_INTERFACE,
+ "Emergency", DBUS_TYPE_BOOLEAN,
+ &emergency);
+}
+
+void __ofono_modem_dec_emergency_mode(struct ofono_modem *modem)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+ dbus_bool_t emergency = FALSE;
+
+ if (modem->emergency == 0) {
+ ofono_error("emergency mode is already deactivated!!!");
+ return;
+ }
+
+ if (modem->emergency > 1)
+ goto out;
+
+ ofono_dbus_signal_property_changed(conn, modem->path,
+ OFONO_MODEM_INTERFACE,
+ "Emergency", DBUS_TYPE_BOOLEAN,
+ &emergency);
+
+out:
+ modem->emergency--;
+}
diff --git a/src/ofono.h b/src/ofono.h
index 511be8a..a80af4f 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -212,6 +212,9 @@ void __ofono_modem_remove_powered_watch(struct ofono_modem *modem,
void __ofono_modem_sim_reset(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] 13+ messages in thread* [RFC PATCH 6/9] modem: modem state decoupled from rf state
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (4 preceding siblings ...)
2011-03-31 16:18 ` [RFC PATCH 5/9] modem: add increment/decrement emergency mode api Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 7/9] modem: restrict operations allowed in emergency Jeevaka Badrappan
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 5982 bytes --]
---
src/modem.c | 80 ++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 55 insertions(+), 25 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 72937a3..126c0e6 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -416,26 +416,34 @@ static void notify_powered_watches(struct ofono_modem *modem)
}
}
+static void set_online(struct ofono_modem *modem, ofono_bool_t new_online)
+{
+ DBusConnection *conn = ofono_dbus_get_connection();
+
+ if (new_online == modem->online)
+ return;
+
+ 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 modem_change_state(struct ofono_modem *modem,
enum modem_state new_state)
{
struct ofono_modem_driver const *driver = modem->driver;
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 (old_state == new_state)
return;
- if (new_online != modem->online) {
- DBusConnection *conn = ofono_dbus_get_connection();
- modem->online = new_online;
- ofono_dbus_signal_property_changed(conn, modem->path,
- OFONO_MODEM_INTERFACE, "Online",
- DBUS_TYPE_BOOLEAN, &modem->online);
- }
-
modem->modem_state = new_state;
if (old_state > new_state)
@@ -457,8 +465,7 @@ static void modem_change_state(struct ofono_modem *modem,
driver->post_sim(modem);
__ofono_history_probe_drivers(modem);
__ofono_nettime_probe_drivers(modem);
- } else
- notify_online_watches(modem);
+ }
break;
@@ -466,7 +473,6 @@ static void modem_change_state(struct ofono_modem *modem,
if (driver->post_online)
driver->post_online(modem);
- notify_online_watches(modem);
break;
}
}
@@ -541,14 +547,22 @@ static void common_online_cb(const struct ofono_error *error, void *data)
*/
switch (modem->modem_state) {
case MODEM_STATE_OFFLINE:
+ set_online(modem, TRUE);
+
+ /* Will this increase emergency call setup time??? */
modem_change_state(modem, MODEM_STATE_ONLINE);
break;
case MODEM_STATE_POWER_OFF:
/* The powered operation is pending */
break;
case MODEM_STATE_PRE_SIM:
- /* Go back offline if the sim was removed or reset */
- modem->driver->set_online(modem, 0, NULL, NULL);
+ /*
+ * Its valid to be in online even without a SIM/SIM being
+ * PIN locked. e.g.: Emergency mode
+ */
+ DBG("Online in PRE SIM state");
+
+ set_online(modem, TRUE);
break;
case MODEM_STATE_ONLINE:
ofono_error("Online called when the modem is already online!");
@@ -564,8 +578,7 @@ static void online_cb(const struct ofono_error *error, void *data)
if (!modem->pending)
goto out;
- if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
- modem->modem_state == MODEM_STATE_OFFLINE)
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
reply = dbus_message_new_method_return(modem->pending);
else
reply = __ofono_error_failed(modem->pending);
@@ -588,9 +601,19 @@ static void offline_cb(const struct ofono_error *error, void *data)
__ofono_dbus_pending_reply(&modem->pending, reply);
- if (error->type == OFONO_ERROR_TYPE_NO_ERROR &&
- modem->modem_state == MODEM_STATE_ONLINE)
- modem_change_state(modem, MODEM_STATE_OFFLINE);
+ if (error->type == OFONO_ERROR_TYPE_NO_ERROR) {
+ switch (modem->modem_state) {
+ case MODEM_STATE_PRE_SIM:
+ set_online(modem, FALSE);
+ break;
+ case MODEM_STATE_ONLINE:
+ set_online(modem, FALSE);
+ modem_change_state(modem, MODEM_STATE_OFFLINE);
+ break;
+ default:
+ break;
+ }
+ }
}
static void sim_state_watch(enum ofono_sim_state new_state, void *user)
@@ -609,7 +632,7 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
* If we don't have the set_online method, also proceed
* straight to the online state
*/
- if (modem->driver->set_online == NULL)
+ if (modem->driver->set_online == NULL || modem->online == TRUE)
modem_change_state(modem, MODEM_STATE_ONLINE);
else if (modem->get_online)
modem->driver->set_online(modem, 1, common_online_cb,
@@ -642,9 +665,6 @@ static DBusMessage *set_property_online(struct ofono_modem *modem,
if (driver->set_online == NULL)
return __ofono_error_not_implemented(msg);
- if (modem->modem_state < MODEM_STATE_OFFLINE)
- return __ofono_error_not_available(msg);
-
modem->pending = dbus_message_ref(msg);
driver->set_online(modem, online,
@@ -814,6 +834,8 @@ static gboolean set_powered_timeout(gpointer user)
DBusConnection *conn = ofono_dbus_get_connection();
dbus_bool_t powered = FALSE;
+ set_online(modem, FALSE);
+
modem->powered = FALSE;
notify_powered_watches(modem);
@@ -915,6 +937,8 @@ static DBusMessage *set_property_lockdown(struct ofono_modem *modem,
return NULL;
}
+ set_online(modem, FALSE);
+
powered = FALSE;
ofono_dbus_signal_property_changed(conn, modem->path,
OFONO_MODEM_INTERFACE,
@@ -1002,8 +1026,11 @@ static DBusMessage *modem_set_property(DBusConnection *conn,
if (__ofono_modem_find_atom(modem,
OFONO_ATOM_TYPE_SIM) == NULL)
sim_state_watch(OFONO_SIM_STATE_READY, modem);
- } else
+ } else {
+ set_online(modem, FALSE);
+
modem_change_state(modem, MODEM_STATE_POWER_OFF);
+ }
return NULL;
}
@@ -1081,8 +1108,11 @@ void ofono_modem_set_powered(struct ofono_modem *modem, ofono_bool_t powered)
if (__ofono_modem_find_atom(modem,
OFONO_ATOM_TYPE_SIM) == NULL)
sim_state_watch(OFONO_SIM_STATE_READY, modem);
- } else
+ } else {
+ set_online(modem, FALSE);
+
modem_change_state(modem, MODEM_STATE_POWER_OFF);
+ }
out:
if (powering_down && powered == FALSE) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* [RFC PATCH 7/9] modem: restrict operations allowed in emergency
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (5 preceding siblings ...)
2011-03-31 16:18 ` [RFC PATCH 6/9] modem: modem state decoupled from rf state Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 8/9] voicecall: generalise emergency call check Jeevaka Badrappan
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]
---
src/modem.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 126c0e6..49b3314 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -662,6 +662,9 @@ static DBusMessage *set_property_online(struct ofono_modem *modem,
if (modem->online == online)
return dbus_message_new_method_return(msg);
+ if (ofono_modem_get_emergency_mode(modem) == TRUE)
+ return __ofono_error_emergency_active(msg);
+
if (driver->set_online == NULL)
return __ofono_error_not_implemented(msg);
@@ -906,6 +909,9 @@ static DBusMessage *set_property_lockdown(struct ofono_modem *modem,
goto done;
}
+ if (ofono_modem_get_emergency_mode(modem) == TRUE)
+ return __ofono_error_emergency_active(msg);
+
modem->lock_owner = g_strdup(caller);
modem->lock_watch = g_dbus_add_disconnect_watch(conn,
@@ -998,6 +1004,9 @@ static DBusMessage *modem_set_property(DBusConnection *conn,
if (modem->powered == powered)
return dbus_message_new_method_return(msg);
+ if (ofono_modem_get_emergency_mode(modem) == TRUE)
+ return __ofono_error_emergency_active(msg);
+
if (modem->lockdown)
return __ofono_error_access_denied(msg);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* [RFC PATCH 8/9] voicecall: generalise emergency call check
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (6 preceding siblings ...)
2011-03-31 16:18 ` [RFC PATCH 7/9] modem: restrict operations allowed in emergency Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 16:18 ` [RFC PATCH 9/9] voicecall: add emergency mode handling Jeevaka Badrappan
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
---
src/voicecall.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 4932ffa..f25c770 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -337,14 +337,10 @@ static gint number_compare(gconstpointer a, gconstpointer b)
return strcmp(s1, s2);
}
-static gboolean voicecall_is_emergency(struct voicecall *v)
+static gboolean is_emergency_number(struct ofono_voicecall *vc,
+ const char *number)
{
- struct ofono_call *call = v->call;
- const char *lineid_str;
-
- lineid_str = phone_number_to_string(&call->phone_number);
-
- return g_slist_find_custom(v->vc->en_list, lineid_str,
+ return g_slist_find_custom(vc->en_list, number,
number_compare) ? TRUE : FALSE;
}
@@ -417,7 +413,7 @@ static void append_voicecall_properties(struct voicecall *v,
ofono_dbus_dict_append(dict, "Icon",
DBUS_TYPE_BYTE, &v->icon_id);
- if (voicecall_is_emergency(v) == TRUE)
+ if (is_emergency_number(v->vc, callerid) == TRUE)
emergency_call = TRUE;
else
emergency_call = FALSE;
@@ -788,7 +784,7 @@ static void voicecall_set_call_lineid(struct voicecall *v,
"LineIdentification",
DBUS_TYPE_STRING, &lineid_str);
- if (voicecall_is_emergency(v)) {
+ if (is_emergency_number(v->vc, lineid_str)) {
dbus_bool_t emergency_call = TRUE;
ofono_dbus_signal_property_changed(conn, path,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* [RFC PATCH 9/9] voicecall: add emergency mode handling
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (7 preceding siblings ...)
2011-03-31 16:18 ` [RFC PATCH 8/9] voicecall: generalise emergency call check Jeevaka Badrappan
@ 2011-03-31 16:18 ` Jeevaka Badrappan
2011-03-31 17:43 ` [RFC PATCH 0/9] Emergency Mode Marcel Holtmann
2011-04-05 5:00 ` Denis Kenzior
10 siblings, 0 replies; 13+ messages in thread
From: Jeevaka Badrappan @ 2011-03-31 16:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]
---
src/voicecall.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index f25c770..04be551 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -1281,8 +1281,14 @@ 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 {
+ struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
+
+ if (is_emergency_number(vc, number) == TRUE)
+ __ofono_modem_dec_emergency_mode(modem);
+
reply = __ofono_error_failed(vc->pending);
+ }
__ofono_dbus_pending_reply(&vc->pending, reply);
@@ -1294,6 +1300,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;
@@ -1316,6 +1323,9 @@ static DBusMessage *manager_dial(DBusConnection *conn,
if (clir_string_to_clir(clirstr, &clir) == FALSE)
return __ofono_error_invalid_format(msg);
+ if (ofono_modem_get_online(modem) == FALSE)
+ return __ofono_error_not_available(msg);
+
if (vc->driver->dial == NULL)
return __ofono_error_not_implemented(msg);
@@ -1329,6 +1339,9 @@ static DBusMessage *manager_dial(DBusConnection *conn,
if (voicecalls_have_active(vc) && voicecalls_have_held(vc))
return __ofono_error_failed(msg);
+ if (is_emergency_number(vc, number) == TRUE)
+ __ofono_modem_inc_emergency_mode(modem);
+
vc->pending = dbus_message_ref(msg);
string_to_phone_number(number, &ph);
@@ -1891,6 +1904,7 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
struct voicecall *call;
time_t ts;
enum call_status prev_status;
+ const char *number;
DBG("Got disconnection event for id: %d, reason: %d", id, reason);
@@ -1931,6 +1945,10 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
if (reason != OFONO_DISCONNECT_REASON_UNKNOWN)
voicecall_emit_disconnect_reason(call, reason);
+ number = phone_number_to_string(&call->call->phone_number);
+ if (is_emergency_number(vc, number) == TRUE)
+ __ofono_modem_dec_emergency_mode(modem);
+
voicecall_set_call_status(call, CALL_STATUS_DISCONNECTED);
if (!call->untracked) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [RFC PATCH 0/9] Emergency Mode
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (8 preceding siblings ...)
2011-03-31 16:18 ` [RFC PATCH 9/9] voicecall: add emergency mode handling Jeevaka Badrappan
@ 2011-03-31 17:43 ` Marcel Holtmann
2011-03-31 22:47 ` Jeevaka.Badrappan
2011-04-05 5:00 ` Denis Kenzior
10 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2011-03-31 17:43 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
Hi Jeevaka,
> Following patch is a proposal for emergency mode. Test has been done
> with the phonesim.
>
> Listed down few important cases to give an overview of the state
> changes that happen in each case.
and I think we should turn this into a doc/emergency-call-handling.txt
and extend a bit. Especially with what is expected from the user/UI to
be done and what oFono will do for the user/UI.
Regards
Marcel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [RFC PATCH 0/9] Emergency Mode
2011-03-31 16:18 [RFC PATCH 0/9] Emergency Mode Jeevaka Badrappan
` (9 preceding siblings ...)
2011-03-31 17:43 ` [RFC PATCH 0/9] Emergency Mode Marcel Holtmann
@ 2011-04-05 5:00 ` Denis Kenzior
10 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2011-04-05 5:00 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2880 bytes --]
Hi Jeevaka,
On 03/31/2011 11:18 AM, Jeevaka Badrappan wrote:
> Hi,
>
> Following patch is a proposal for emergency mode. Test has been done
> with the phonesim.
>
> Listed down few important cases to give an overview of the state
> changes that happen in each case.
>
> Case 1: SIM Present, No PIN required, modem in offline state
>
> - Modem set to online mode(UI triggered)
> Post online atoms created
> - Dial request received with emergency number
> - Emergency mode activated
> - Dial request sent to modem
> - Emergency call is active
> - Call ended
> Emergency mode deactivated.
> - Modem remains in online mode. Post online
> atoms are present.
>
> Case 2: SIM Present and PIN required
>
> - Modem set to online mode(UI triggered)
> Post SIM and Post online atoms not created
> - Dial request received with emergency number
> - Emergency mode activated
> - Dial request sent to modem
> - Emergency call is active
> - Call ended
> Emergency mode deactivated.
> - Modem remains in online mode. Post sim
> and post online atoms are not present/created.
>
> Case 3: SIM Present and PIN required(Dial request cancelled by user)
>
> - Modem set to online mode(UI triggered)
> Post SIM and Post online atoms not created
> - Dial request received with emergency number
> - Emergency mode activated
> - Dial request sent to modem
> - Dial request cancelled by user
> Emergency mode deactivated.
> - Modem remains in online mode.
> - User enters the right pin
> - Modem remains in online mode. Post sim
> and post online atoms are created.
>
> Case 4: SIM Not Present(PIN disabled SIM inserted)
>
> - Modem set to online mode(UI triggered)
> Post SIM and Post online atoms not created
> - Dial request received with emergency number
> - Emergency mode activated
> - Emergency call is active
> - SIM inserted and SIM ready received(NO PIN required).
> - Post sim and post online atoms are created.
> - Call ended
> Emergency mode deactivated.
> - Modem remains in online mode. Post sim and post
> online atoms are present.
>
> Case 5: SIM Not Present(PIN enabled SIM inserted)
>
> - Modem set to online mode(UI triggered)
> Post SIM and Post online atoms not created
> - Dial request received with emergency number
> - Emergency mode activated
> - Emergency call is active
> - SIM Inserted(PIN required).
> - Call ended
> Emergency mode deactivated.
> - Modem remains in online mode. Post sim
> and post online atoms are not created.
>
All 9 patches have been applied, in a slightly different order. Thanks
for that!
I made some slight refactorings and additions afterward, and went ahead
and marked this task as done. Can you take a look and see if you concur
with my changes?
Regards,
-Denis
^ permalink raw reply [flat|nested] 13+ messages in thread