diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-22 09:35:15 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-08-22 09:38:21 +0200 |
commit | 1ac18a06bb37d8745480a9af4fd6bc2f762bf265 (patch) | |
tree | 2074fb1f3cb16e483779dcd4f19db3d6c1c936c1 /src/mm-broadband-bearer.c | |
parent | c15525a1b3c2006e614f75a372f374176f576c23 (diff) |
api,dbus: 'ip-type' property now given as a MMBearerIpFamily (u)
Instead of using a predefined set of string values for 'ip-type' in
Modem.CreateBearer() and Simple.Connect(), we'll use an enumeration. The
implementation will then need to convert the requested IP family type to e.g.
the correct PDP type in 3GPP modems.
This change also consolidates the use of enums in dictionary properties when
possible to do so, as with the Rm Protocol.
Diffstat (limited to 'src/mm-broadband-bearer.c')
-rw-r--r-- | src/mm-broadband-bearer.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c index 995d8417..6918d89a 100644 --- a/src/mm-broadband-bearer.c +++ b/src/mm-broadband-bearer.c @@ -752,6 +752,7 @@ find_cid_ready (MMBaseModem *modem, GVariant *result; gchar *command; GError *error = NULL; + const gchar *pdp_type; result = mm_base_modem_at_sequence_full_finish (modem, res, NULL, &error); if (!result) { @@ -768,10 +769,20 @@ find_cid_ready (MMBaseModem *modem, return; /* Initialize PDP context with our APN */ + pdp_type = mm_3gpp_get_pdp_type_from_ip_family (mm_bearer_properties_get_ip_type (mm_bearer_peek_config (MM_BEARER (ctx->self)))); + if (!pdp_type) { + g_simple_async_result_set_error (ctx->result, + MM_CORE_ERROR, + MM_CORE_ERROR_INVALID_ARGS, + "Invalid PDP type requested"); + detailed_connect_context_complete_and_free (ctx); + return; + } + ctx->cid = g_variant_get_uint32 (result); command = g_strdup_printf ("+CGDCONT=%u,\"%s\",\"%s\"", ctx->cid, - mm_bearer_properties_get_ip_type (mm_bearer_peek_config (MM_BEARER (ctx->self))), + pdp_type, mm_bearer_properties_get_apn (mm_bearer_peek_config (MM_BEARER (ctx->self)))); mm_base_modem_at_command_full (ctx->modem, ctx->primary, @@ -830,7 +841,8 @@ parse_cid_range (MMBaseModem *modem, pdp_type = g_match_info_fetch (match_info, 3); - if (g_str_equal (pdp_type, mm_bearer_properties_get_ip_type (mm_bearer_peek_config (MM_BEARER (ctx->self))))) { + if (mm_3gpp_get_ip_family_from_pdp_type (pdp_type) == + mm_bearer_properties_get_ip_type (mm_bearer_peek_config (MM_BEARER (ctx->self)))) { gchar *max_cid_range_str; guint max_cid_range; @@ -914,9 +926,9 @@ parse_pdp_list (MMBaseModem *modem, mm_dbg (" PDP context [cid=%u] [type='%s'] [apn='%s']", pdp->cid, - pdp->pdp_type ? pdp->pdp_type : "", + mm_bearer_ip_family_get_string (pdp->pdp_type), pdp->apn ? pdp->apn : ""); - if (g_str_equal (pdp->pdp_type, mm_bearer_properties_get_ip_type (mm_bearer_peek_config (MM_BEARER (ctx->self))))) { + if (pdp->pdp_type == mm_bearer_properties_get_ip_type (mm_bearer_peek_config (MM_BEARER (ctx->self)))) { /* PDP with no APN set? we may use that one if not exact match found */ if (!pdp->apn || !pdp->apn[0]) { mm_dbg ("Found PDP context with CID %u and no APN", @@ -930,7 +942,7 @@ parse_pdp_list (MMBaseModem *modem, g_str_equal (pdp->apn, apn)) { /* Found a PDP context with the same CID and PDP type, we'll use it. */ mm_dbg ("Found PDP context with CID %u and PDP type %s for APN '%s'", - pdp->cid, pdp->pdp_type, pdp->apn); + pdp->cid, mm_bearer_ip_family_get_string (pdp->pdp_type), pdp->apn); cid = pdp->cid; /* In this case, stop searching */ break; |