summaryrefslogtreecommitdiffstats
path: root/src/modem.c
diff options
context:
space:
mode:
authorForest Bond <forest.bond@rapidrollout.com>2013-03-28 17:00:32 -0400
committerDenis Kenzior <denkenz@gmail.com>2013-04-01 21:41:58 -0500
commit0e0eb227f231e6189f768de3dcbb6fa63e6fca3b (patch)
tree62ea4b5e209c844fabc60ebc79e3cc6c570b7444 /src/modem.c
parent8ce35499cfe4d955dcbe1837d864e36230e8634d (diff)
downloadofono-0e0eb227f231e6189f768de3dcbb6fa63e6fca3b.tar.bz2
modem: Support modem property "AlwaysOnline"
This can be set by the modem driver to indicate that the device is always in the online state when it is enabled. This is useful for modem drivers that handle both CDMA and GSM devices.
Diffstat (limited to 'src/modem.c')
-rw-r--r--src/modem.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/modem.c b/src/modem.c
index 95e60939..01b0e356 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -595,6 +595,17 @@ static gboolean modem_has_sim(struct ofono_modem *modem)
return FALSE;
}
+static gboolean modem_is_always_online(struct ofono_modem *modem)
+{
+ if (modem->driver->set_online == NULL)
+ return TRUE;
+
+ if (ofono_modem_get_boolean(modem, "AlwaysOnline") == TRUE)
+ return TRUE;
+
+ return FALSE;
+}
+
static void common_online_cb(const struct ofono_error *error, void *data)
{
struct ofono_modem *modem = data;
@@ -702,11 +713,8 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
case OFONO_SIM_STATE_READY:
modem_change_state(modem, MODEM_STATE_OFFLINE);
- /*
- * If we don't have the set_online method, also proceed
- * straight to the online state
- */
- if (modem->driver->set_online == NULL)
+ /* Modem is always online, proceed to online state. */
+ if (modem_is_always_online(modem) == TRUE)
set_online(modem, TRUE);
if (modem->online == TRUE)
@@ -745,7 +753,7 @@ static DBusMessage *set_property_online(struct ofono_modem *modem,
if (ofono_modem_get_emergency_mode(modem) == TRUE)
return __ofono_error_emergency_active(msg);
- if (driver->set_online == NULL)
+ if (modem_is_always_online(modem) == TRUE)
return __ofono_error_not_implemented(msg);
modem->pending = dbus_message_ref(msg);