iface-modem-3gpp-profile-manager: initialize the 'IndexField' property

This commit is contained in:
Aleksander Morgado
2021-12-11 23:01:04 +01:00
parent f97957046b
commit 0d0ad722d9
4 changed files with 34 additions and 13 deletions

View File

@@ -5946,27 +5946,38 @@ modem_signal_setup_thresholds (MMIfaceModemSignal *self,
/* Check support (3GPP profile management interface) */
static gboolean
modem_3gpp_profile_manager_check_support_finish (MMIfaceModem3gppProfileManager *self,
modem_3gpp_profile_manager_check_support_finish (MMIfaceModem3gppProfileManager *_self,
GAsyncResult *res,
gchar **index_field,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
MMBroadbandModemMbim *self = MM_BROADBAND_MODEM_MBIM (_self);
g_assert (g_task_propagate_boolean (G_TASK (res), NULL));
if (mm_iface_modem_is_3gpp (MM_IFACE_MODEM (self))) {
if (self->priv->is_profile_management_ext_supported) {
*index_field = g_strdup ("apn-type");
return TRUE;
}
if (self->priv->is_profile_management_supported) {
*index_field = g_strdup ("profile-id");
return TRUE;
}
}
return FALSE;
}
static void
modem_3gpp_profile_manager_check_support (MMIfaceModem3gppProfileManager *_self,
modem_3gpp_profile_manager_check_support (MMIfaceModem3gppProfileManager *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMBroadbandModemMbim *self = MM_BROADBAND_MODEM_MBIM (_self);
GTask *task;
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
if (mm_iface_modem_is_3gpp (MM_IFACE_MODEM (self)) && self->priv->is_profile_management_supported)
g_task_return_boolean (task, TRUE);
else
g_task_return_boolean (task, FALSE);
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}

View File

@@ -10184,9 +10184,15 @@ modem_signal_load_values (MMIfaceModemSignal *self,
static gboolean
modem_3gpp_profile_manager_check_support_finish (MMIfaceModem3gppProfileManager *self,
GAsyncResult *res,
gchar **index_field,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
if (g_task_propagate_boolean (G_TASK (res), error)) {
*index_field = g_strdup ("profile-id");;
return TRUE;
}
return FALSE;
}
static void

View File

@@ -1465,19 +1465,22 @@ check_support_ready (MMIfaceModem3gppProfileManager *self,
{
InitializationContext *ctx;
g_autoptr(GError) error = NULL;
g_autofree gchar *index_field = NULL;
if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_support_finish (self, res, &error)) {
ctx = g_task_get_task_data (task);
if (!MM_IFACE_MODEM_3GPP_PROFILE_MANAGER_GET_INTERFACE (self)->check_support_finish (self, res, &index_field, &error)) {
if (error) {
/* This error shouldn't be treated as critical */
mm_obj_dbg (self, "profile management support check failed: %s", error->message);
}
} else {
/* profile management is supported! */
mm_gdbus_modem3gpp_profile_manager_set_index_field (ctx->skeleton, index_field);
g_object_set_qdata (G_OBJECT (self), supported_quark, GUINT_TO_POINTER (TRUE));
}
/* Go on to next step */
ctx = g_task_get_task_data (task);
ctx->step++;
interface_initialization_step (task);
}

View File

@@ -41,6 +41,7 @@ struct _MMIfaceModem3gppProfileManager {
gpointer user_data);
gboolean (* check_support_finish) (MMIfaceModem3gppProfileManager *self,
GAsyncResult *res,
gchar **index_field,
GError **error);
/* Asynchronous setup of unsolicited events */