diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-12-13 14:08:43 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-12-26 10:12:11 +0100 |
commit | 853aa29be80ee397f64d18c4d9cce64be35aec14 (patch) | |
tree | cca7f1a813e979b42e8ecacd156102e8e751ef20 /src/mm-modem-helpers.c | |
parent | 0d0ad722d9da2039ad71ece9c8ae4b1786c7f757 (diff) |
iface-modem-3gpp-profile-manager: support 'apn-type' as index field
The modem may report the 'apn-type' field is the one to be used as
index; if that's the case, allow setting and deleting profiles based
on the given 'apn-type' field.
This change also makes the internal profile management operations use
one index field or another, based on what the protocol implements.
Diffstat (limited to 'src/mm-modem-helpers.c')
-rw-r--r-- | src/mm-modem-helpers.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 6f645dbb..3e22262c 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -1549,6 +1549,27 @@ mm_3gpp_profile_list_find_by_profile_id (GList *profile_list, return NULL; } +MM3gppProfile * +mm_3gpp_profile_list_find_by_apn_type (GList *profile_list, + MMBearerApnType apn_type, + GError **error) +{ + g_autofree gchar *apn_type_str = NULL; + GList *l; + + for (l = profile_list; l; l = g_list_next (l)) { + MM3gppProfile *iter_profile = l->data; + + if (mm_3gpp_profile_get_apn_type (iter_profile) == apn_type) + return g_object_ref (iter_profile); + } + + apn_type_str = mm_bearer_apn_type_build_string_from_mask (apn_type); + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND, + "Profile '%s' not found", apn_type_str); + return NULL; +} + gint mm_3gpp_profile_list_find_empty (GList *profile_list, gint min_profile_id, |