From: Daniel Wagner <[email protected]>

---

Hi, 

I was about to add the RoamingAllowed part to the ofono plugin, but
then I realized that we didn't do this in the old plugin.

So my question how do we want to proceed on this one. Do we want
to set it from ConnMan at all?

cheers,
daniel

 plugins/ofono.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 3759662..27da6ef 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -124,6 +124,7 @@ struct modem_data {
        /* ConnectionManager Interface */
        connman_bool_t attached;
        connman_bool_t cm_powered;
+       connman_bool_t roaming_allowed;
 
        connman_bool_t set_cm_powered;
 
@@ -534,6 +535,36 @@ static int modem_set_online(struct modem_data *modem)
                                modem_set_online_reply);
 }
 
+static int cm_set_roaming_disallowed(struct modem_data *modem)
+{
+       dbus_bool_t roaming_allowed;
+
+       DBG("%s", modem->path);
+
+       roaming_allowed = FALSE;
+
+       return set_property(modem, modem->path,
+                               OFONO_CM_INTERFACE,
+                               "RoamingAllowed", DBUS_TYPE_BOOLEAN,
+                               &roaming_allowed,
+                               NULL);
+}
+
+static int cm_set_roaming_allowed(struct modem_data *modem)
+{
+       dbus_bool_t roaming_allowed;
+
+       DBG("%s", modem->path);
+
+       roaming_allowed = TRUE;
+
+       return set_property(modem, modem->path,
+                               OFONO_CM_INTERFACE,
+                               "RoamingAllowed", DBUS_TYPE_BOOLEAN,
+                               &roaming_allowed,
+                               NULL);
+}
+
 static void cm_set_powered_reply(struct modem_data *modem,
                                        connman_bool_t success)
 {
@@ -1386,6 +1417,15 @@ static gboolean cm_changed(DBusConnection *connection, 
DBusMessage *message,
 
                if (modem->cm_powered == FALSE)
                        cm_set_powered(modem);
+       } else if (g_str_equal(key, "RoamingAllowed") == TRUE) {
+               dbus_message_iter_get_basic(&value, &modem->roaming_allowed);
+
+               DBG("%s ConnnectionManager RoamingAllowed %d", modem->path,
+                       modem->roaming_allowed);
+
+               if (modem->network != NULL)
+                       connman_network_set_roaming(modem->network,
+                                                       modem->roaming_allowed);
        }
 
        return TRUE;
@@ -1425,6 +1465,15 @@ static void cm_properties_reply(struct modem_data 
*modem, DBusMessageIter *dict)
 
                        if (modem->cm_powered == FALSE)
                                cm_set_powered(modem);
+               } else if (g_str_equal(key, "RoamingAllowed") == TRUE) {
+                       dbus_message_iter_get_basic(&value, 
&modem->roaming_allowed);
+
+                       DBG("%s ConnnectionManager RoamingAllowed %d", 
modem->path,
+                               modem->roaming_allowed);
+
+                       if (modem->network != NULL)
+                               connman_network_set_roaming(modem->network,
+                                                       modem->roaming_allowed);
                }
 
                dbus_message_iter_next(dict);
-- 
1.7.8.110.g4cb5d1

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to