From 853aa29be80ee397f64d18c4d9cce64be35aec14 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 13 Dec 2021 14:08:43 +0100 Subject: 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. --- src/mm-modem-helpers.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/mm-modem-helpers.c') 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, -- cgit v1.2.3-70-g09d2