broadband-modem-mbim: report packet service state updates

Use the Packet Service messages to report the state of PS domain,
instead of guessing.
This commit is contained in:
Aleksander Morgado
2023-03-30 10:54:08 +00:00
parent 45406e78e2
commit 6b05e268e0
3 changed files with 47 additions and 10 deletions

View File

@@ -4628,7 +4628,7 @@ update_access_technologies (MMBroadbandModemMbim *self)
}
/*****************************************************************************/
/* Registration info updates */
/* Packet service updates */
static void update_registration_info (MMBroadbandModemMbim *self,
gboolean scheduled,
@@ -4637,6 +4637,31 @@ static void update_registration_info (MMBroadbandModemMbim *self,
gchar *operator_id_take,
gchar *operator_name_take);
static void
update_packet_service_info (MMBroadbandModemMbim *self,
MbimPacketServiceState packet_service_state)
{
MMModem3gppPacketServiceState state;
if (packet_service_state == self->priv->packet_service_state)
return;
self->priv->packet_service_state = packet_service_state;
state = mm_modem_3gpp_packet_service_state_from_mbim_packet_service_state (packet_service_state);
mm_iface_modem_3gpp_update_packet_service_state (MM_IFACE_MODEM_3GPP (self), state);
/* PS reg state depends on the packet service state */
update_registration_info (self,
FALSE,
self->priv->reg_state,
self->priv->available_data_classes,
g_strdup (self->priv->current_operator_id),
g_strdup (self->priv->current_operator_name));
}
/*****************************************************************************/
/* Registration info updates */
static void
enabling_state_changed (MMBroadbandModemMbim *self)
{
@@ -5127,15 +5152,7 @@ basic_connect_notification_packet_service (MMBroadbandModemMbim *self,
}
update_access_technologies (self);
if (self->priv->packet_service_state != packet_service_state) {
self->priv->packet_service_state = packet_service_state;
update_registration_info (self,
FALSE,
self->priv->reg_state,
self->priv->available_data_classes,
g_strdup (self->priv->current_operator_id),
g_strdup (self->priv->current_operator_name));
}
update_packet_service_info (self, packet_service_state);
self->priv->packet_service_uplink_speed = uplink_speed;
self->priv->packet_service_downlink_speed = downlink_speed;

View File

@@ -129,6 +129,24 @@ mm_modem_3gpp_registration_state_from_mbim_register_state (MbimRegisterState sta
/*****************************************************************************/
MMModem3gppPacketServiceState
mm_modem_3gpp_packet_service_state_from_mbim_packet_service_state (MbimPacketServiceState state)
{
switch (state) {
case MBIM_PACKET_SERVICE_STATE_ATTACHED:
return MM_MODEM_3GPP_PACKET_SERVICE_STATE_ATTACHED;
case MBIM_PACKET_SERVICE_STATE_ATTACHING:
case MBIM_PACKET_SERVICE_STATE_DETACHING:
case MBIM_PACKET_SERVICE_STATE_DETACHED:
return MM_MODEM_3GPP_PACKET_SERVICE_STATE_DETACHED;
case MBIM_PACKET_SERVICE_STATE_UNKNOWN:
default:
return MM_MODEM_3GPP_PACKET_SERVICE_STATE_UNKNOWN;
}
}
/*****************************************************************************/
MMModemMode
mm_modem_mode_from_mbim_data_class (MbimDataClass data_class,
const gchar *caps_custom_data_class)

View File

@@ -35,6 +35,8 @@ MMModemLock mm_modem_lock_from_mbim_pin_type (MbimPinType pin_type);
MMModem3gppRegistrationState mm_modem_3gpp_registration_state_from_mbim_register_state (MbimRegisterState state);
MMModem3gppPacketServiceState mm_modem_3gpp_packet_service_state_from_mbim_packet_service_state (MbimPacketServiceState state);
MbimDataClass mm_mbim_data_class_from_mbim_data_class_v3_and_subclass (MbimDataClassV3 data_class_v3,
MbimDataSubclass data_subclass);