hso: query profile id from hso 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 cadce18865
commit 5db3e330b9
3 changed files with 34 additions and 1 deletions
+19
View File
@@ -234,6 +234,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,
@@ -697,6 +706,16 @@ disconnect_3gpp (MMBroadbandBearer *self,
/*****************************************************************************/
gint
mm_broadband_bearer_hso_get_connecting_profile_id (MMBroadbandBearerHso *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,
+2
View File
@@ -56,4 +56,6 @@ void mm_broadband_bearer_hso_new (MMBroadbandModemHso *modem,
MMBaseBearer *mm_broadband_bearer_hso_new_finish (GAsyncResult *res,
GError **error);
gint mm_broadband_bearer_hso_get_connecting_profile_id (MMBroadbandBearerHso *self);
#endif /* MM_BROADBAND_BEARER_HSO_H */
+13 -1
View File
@@ -198,7 +198,19 @@ static void
bearer_list_report_status_foreach (MMBaseBearer *bearer,
BearerListReportStatusForeachContext *ctx)
{
if (mm_base_bearer_get_profile_id (bearer) != (gint)ctx->cid)
gint profile_id;
gint connecting_profile_id;
if (!MM_IS_BROADBAND_BEARER_HSO (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 hso bearer is available during the connecting phase */
connecting_profile_id = mm_broadband_bearer_hso_get_connecting_profile_id (MM_BROADBAND_BEARER_HSO (bearer));
if ((profile_id != (gint)ctx->cid) && (connecting_profile_id != (gint)ctx->cid))
return;
mm_base_bearer_report_connection_status (MM_BASE_BEARER (bearer), ctx->status);