Signed-off-by: Andras Domokos <[email protected]>
---
src/modem.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/src/modem.c b/src/modem.c
index 9aeb49c..9e96cce 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -70,6 +70,8 @@ struct ofono_modem {
struct ofono_sim *sim;
unsigned int sim_watch;
unsigned int sim_ready_watch;
+ unsigned int voicecall_watch;
+ unsigned int emergency_watch;
const struct ofono_modem_driver *driver;
void *driver_data;
char *driver_type;
@@ -544,6 +546,34 @@ ofono_bool_t ofono_modem_get_online(struct ofono_modem
*modem)
return modem->online;
}
+static void emergency_state_watch(ofono_bool_t state, void *data);
+static void voicecall_watch(struct ofono_atom *atom,
+ enum ofono_atom_watch_condition cond, void *data)
+{
+ struct ofono_modem *modem = data;
+ struct ofono_voicecall *vc;
+
+ if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) {
+ modem->emergency_watch = 0;
+ return;
+ }
+
+ vc = __ofono_atom_get_data(atom);
+ modem->emergency_watch = __ofono_voicecall_add_emergency_watch(vc,
+ emergency_state_watch,
+ modem, NULL);
+}
+
+static void emergency_state_watch(ofono_bool_t state, void *data)
+{
+ struct ofono_modem *modem = data;
+
+ DBG("Emergency mode is %s", state ? "On" : "Off");
+
+ if (state)
+ modem_change_state(modem, MODEM_STATE_ONLINE);
+}
+
void __ofono_modem_append_properties(struct ofono_modem *modem,
DBusMessageIter *dict)
{
@@ -1502,6 +1532,10 @@ int ofono_modem_register(struct ofono_modem *modem)
OFONO_ATOM_TYPE_SIM,
sim_watch, modem, NULL);
+ modem->voicecall_watch = __ofono_modem_add_atom_watch(modem,
+ OFONO_ATOM_TYPE_VOICECALL,
+ voicecall_watch, modem, NULL);
+
return 0;
}
@@ -1531,6 +1565,9 @@ static void modem_unregister(struct ofono_modem *modem)
modem->sim_watch = 0;
modem->sim_ready_watch = 0;
+ modem->voicecall_watch = 0;
+ modem->emergency_watch = 0;
+
g_slist_foreach(modem->interface_list, (GFunc) g_free, NULL);
g_slist_free(modem->interface_list);
modem->interface_list = NULL;
--
1.7.0.4
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono