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-broadband-modem.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-broadband-modem.c')
-rw-r--r-- | src/mm-broadband-modem.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 28a17401..cf7bc83e 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -10497,15 +10497,18 @@ profile_manager_cgdel_set_ready (MMBaseModem *self, } static void -modem_3gpp_profile_manager_delete_profile (MMIfaceModem3gppProfileManager *self, - MM3gppProfile *profile, - GAsyncReadyCallback callback, - gpointer user_data) +modem_3gpp_profile_manager_delete_profile (MMIfaceModem3gppProfileManager *self, + MM3gppProfile *profile, + const gchar *index_field, + GAsyncReadyCallback callback, + gpointer user_data) { g_autofree gchar *cmd = NULL; GTask *task; gint profile_id; + g_assert (g_strcmp0 (index_field, "profile-id") == 0); + task = g_task_new (self, NULL, callback, user_data); profile_id = mm_3gpp_profile_get_profile_id (profile); @@ -10669,15 +10672,21 @@ modem_3gpp_profile_manager_deactivate_profile (MMIfaceModem3gppProfileManager *s /*****************************************************************************/ /* Store profile (3GPP profile management interface) */ -static gint +static gboolean modem_3gpp_profile_manager_store_profile_finish (MMIfaceModem3gppProfileManager *self, GAsyncResult *res, + gint *out_profile_id, + MMBearerApnType *out_apn_type, GError **error) { if (!g_task_propagate_boolean (G_TASK (res), error)) - return MM_3GPP_PROFILE_ID_UNKNOWN; + return FALSE; - return GPOINTER_TO_INT (g_task_get_task_data (G_TASK (res))); + if (out_profile_id) + *out_profile_id = GPOINTER_TO_INT (g_task_get_task_data (G_TASK (res))); + if (out_apn_type) + *out_apn_type = MM_BEARER_APN_TYPE_NONE; + return TRUE; } static void @@ -10697,6 +10706,7 @@ store_profile_cgdcont_set_ready (MMBaseModem *self, static void modem_3gpp_profile_manager_store_profile (MMIfaceModem3gppProfileManager *self, MM3gppProfile *profile, + const gchar *index_field, GAsyncReadyCallback callback, gpointer user_data) { @@ -10709,6 +10719,8 @@ modem_3gpp_profile_manager_store_profile (MMIfaceModem3gppProfileManager *self, g_autofree gchar *quoted_apn = NULL; g_autofree gchar *cmd = NULL; + g_assert (g_strcmp0 (index_field, "profile-id") == 0); + task = g_task_new (self, NULL, callback, user_data); profile_id = mm_3gpp_profile_get_profile_id (profile); |