From: Daniel Wagner Date: Tue, 22 Nov 2011 09:08:27 +0000 (+0100) Subject: ofono: Set modems online X-Git-Tag: 0.79~317 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b2e2c0331d3502b0d07da49137d9e63c285358c;p=platform%2Fupstream%2Fconnman.git ofono: Set modems online --- diff --git a/plugins/ofono.c b/plugins/ofono.c index 63ca7c6..75a62cb 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -79,6 +79,7 @@ struct modem_data { uint8_t interfaces; connman_bool_t set_powered; + connman_bool_t set_online; /* SimManager Interface */ char *imsi; @@ -285,6 +286,35 @@ static int get_properties(const char *path, const char *interface, return -EINPROGRESS; } +static void modem_set_online_reply(struct modem_data *modem, + connman_bool_t success) +{ + DBG("%s", modem->path); + + if (success == TRUE) { + /* + * Don't handle do anything on success here. oFono will send + * the change via PropertyChanged singal. + */ + return; + } + + modem->set_online = FALSE; +} + +static int modem_set_online(struct modem_data *modem) +{ + DBG("%s", modem->path); + + modem->set_online = TRUE; + + return set_property(modem, modem->path, + OFONO_MODEM_INTERFACE, + "Online", DBUS_TYPE_BOOLEAN, + &modem->set_online, + modem_set_online_reply); +} + static int modem_set_powered(struct modem_data *modem) { DBG("%s", modem->path); @@ -403,6 +433,9 @@ static gboolean sim_changed(DBusConnection *connection, DBusMessage *message, dbus_message_iter_get_basic(&value, &imsi); update_sim_imsi(modem, imsi); + + if (modem->online == FALSE) + modem_set_online(modem); } return TRUE; @@ -430,6 +463,11 @@ static void sim_properties_reply(struct modem_data *modem, update_sim_imsi(modem, imsi); + if (modem->online == FALSE) { + modem_set_online(modem); + break; + } + return; }