diff options
Diffstat (limited to 'src/mm-iface-modem-3gpp.c')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 70 |
1 files changed, 8 insertions, 62 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 673d88e2..e6c98505 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -320,9 +320,8 @@ handle_scan (MmGdbusModem3gpp *skeleton, /* Create new 3GPP bearer */ MMBearer * mm_iface_modem_3gpp_create_bearer (MMIfaceModem3gpp *self, - const gchar *apn, - const gchar *ip_type, - gboolean allow_roaming) + MMCommonBearerProperties *properties, + GError **error) { MMModem3gppRegistrationState current_state; MMBearer *bearer; @@ -331,11 +330,12 @@ mm_iface_modem_3gpp_create_bearer (MMIfaceModem3gpp *self, /* Create new 3GPP bearer using the method set in the interface, so that * plugins can subclass it and implement their own. */ - bearer = MM_BEARER (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)-> - create_3gpp_bearer (MM_BASE_MODEM (self), - apn, - ip_type, - allow_roaming)); + bearer = MM_BEARER (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->create_3gpp_bearer ( + MM_BASE_MODEM (self), + properties, + error)); + if (!bearer) + return NULL; g_object_get (self, MM_IFACE_MODEM_3GPP_REGISTRATION_STATE, ¤t_state, @@ -360,60 +360,6 @@ mm_iface_modem_3gpp_create_bearer (MMIfaceModem3gpp *self, return bearer; } -MMBearer * -mm_iface_modem_3gpp_create_bearer_from_properties (MMIfaceModem3gpp *self, - GVariant *properties, - GError **error) -{ - GVariantIter iter; - const gchar *key; - GVariant *value; - gchar *apn = NULL; - gchar *ip_type = NULL; - gboolean allow_roaming = FALSE; - gboolean allow_roaming_found = FALSE; - - mm_dbg ("Creating 3GPP bearer with properties..."); - g_variant_iter_init (&iter, properties); - while (g_variant_iter_loop (&iter, "{sv}", &key, &value)) { - if (g_str_equal (key, "apn")) { - if (apn) - mm_warn ("Duplicate 'apn' property found, ignoring value '%s'", - g_variant_get_string (value, NULL)); - else - apn = g_variant_dup_string (value, NULL); - } else if (g_str_equal (key, "ip-type")) { - if (ip_type) - mm_warn ("Duplicate 'ip-type' property found, ignoring value '%s'", - g_variant_get_string (value, NULL)); - else - ip_type = g_variant_dup_string (value, NULL); - } else if (g_str_equal (key, "allow-roaming")) { - if (allow_roaming_found) - mm_warn ("Duplicate 'allow-roaming' property found, ignoring value '%s'", - g_variant_get_string (value, NULL)); - else { - allow_roaming_found = TRUE; - allow_roaming = g_variant_get_boolean (value); - } - } - else - mm_dbg ("Ignoring property '%s' in 3GPP bearer", key); - } - - /* Check mandatory properties */ - if (!apn) { - g_set_error (error, - MM_CORE_ERROR, - MM_CORE_ERROR_INVALID_ARGS, - "Invalid input properties: 3GPP bearer requires 'apn'"); - g_free (ip_type); - return NULL; - } - - return mm_iface_modem_3gpp_create_bearer (self, apn, ip_type, allow_roaming); -} - /*****************************************************************************/ typedef struct { |