icera: query profile id from icera bearer during connecting phase

As the profile id is not really set in the base bearer object until
after connected.
This commit is contained in:
Aleksander Morgado
2021-07-14 00:23:49 +02:00
parent fc512c711f
commit f72fe9577c
3 changed files with 32 additions and 2 deletions
+19
View File
@@ -395,6 +395,15 @@ dial_3gpp_context_free (Dial3gppContext *ctx)
g_slice_free (Dial3gppContext, ctx);
}
static guint
dial_3gpp_get_connecting_cid (GTask *task)
{
Dial3gppContext *ctx;
ctx = g_task_get_task_data (task);
return ctx->cid;
}
static MMPort *
dial_3gpp_finish (MMBroadbandBearer *self,
GAsyncResult *res,
@@ -698,6 +707,16 @@ dial_3gpp (MMBroadbandBearer *_self,
/*****************************************************************************/
gint
mm_broadband_bearer_icera_get_connecting_profile_id (MMBroadbandBearerIcera *self)
{
return (self->priv->connect_pending ?
(gint)dial_3gpp_get_connecting_cid (self->priv->connect_pending) :
MM_3GPP_PROFILE_ID_UNKNOWN);
}
/*****************************************************************************/
static void
report_connection_status (MMBaseBearer *_self,
MMBearerConnectionStatus status,
@@ -61,4 +61,6 @@ void mm_broadband_bearer_icera_new (MMBroadbandModem *modem,
MMBaseBearer *mm_broadband_bearer_icera_new_finish (GAsyncResult *res,
GError **error);
gint mm_broadband_bearer_icera_get_connecting_profile_id (MMBroadbandBearerIcera *self);
#endif /* MM_BROADBAND_BEARER_ICERA_H */
+11 -2
View File
@@ -404,12 +404,21 @@ static void
bearer_list_report_status_foreach (MMBaseBearer *bearer,
BearerListReportStatusForeachContext *ctx)
{
if (mm_base_bearer_get_profile_id (bearer) != (gint)ctx->cid)
return;
gint profile_id;
gint connecting_profile_id;
if (!MM_IS_BROADBAND_BEARER_ICERA (bearer))
return;
/* The profile ID in the base bearer is set only once the modem is connected */
profile_id = mm_base_bearer_get_profile_id (bearer);
/* The profile ID in the icera bearer is available during the connecting phase */
connecting_profile_id = mm_broadband_bearer_icera_get_connecting_profile_id (MM_BROADBAND_BEARER_ICERA (bearer));
if ((profile_id != (gint)ctx->cid) && (connecting_profile_id != (gint)ctx->cid))
return;
mm_base_bearer_report_connection_status (bearer, ctx->status);
}