diff options
author | Ujjwal Pande <ujjwalpande@google.com> | 2024-05-30 00:04:24 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2024-06-12 09:39:12 +0000 |
commit | 2904510e760fa1fdf491d1ef4574c29d05307b3b (patch) | |
tree | 999160f261639f947303ef96589e7d1a0bf497b0 /src | |
parent | df8287bf6c2febd068d06f0f45194bc622118bd4 (diff) |
api: new NetworkRejection property
When a modem is not able to register to the network, MBIM and QMI indications
related to registration reports network rejection cause codes if request is
rejected by the network. This information is currently logged in the ModemManager
but not exposed outside of ModemManager.
These are the changes to define interface to expose network reject cause codes
over d-bus to the above layers which could be used by above layers to present
this information in a user friendly way.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 58 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.h | 6 |
2 files changed, 64 insertions, 0 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 77599a8b..6560b475 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -2363,6 +2363,13 @@ update_registration_state (MMIfaceModem3gpp *self, if (mm_modem_3gpp_registration_state_is_registered (new_state)) { MMModemState modem_state; + /* When moving to registered state, clear network rejection */ + mm_iface_modem_3gpp_update_network_rejection (self, + MM_NETWORK_ERROR_NONE, + NULL, + NULL, + MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); + /* If already reloading registration info, skip it */ if (priv->reloading_registration_info) return; @@ -2597,6 +2604,57 @@ mm_iface_modem_3gpp_update_pco_list (MMIfaceModem3gpp *self, /*****************************************************************************/ void +mm_iface_modem_3gpp_update_network_rejection (MMIfaceModem3gpp *self, + MMNetworkError error, + const gchar *operator_id, + const gchar *operator_name, + MMModemAccessTechnology access_technology) +{ + MmGdbusModem3gpp *skeleton = NULL; + Private *priv; + g_autoptr(MMNetworkRejection) new_code = NULL; + g_autoptr(GVariant) dictionary = NULL; + g_autofree gchar *access_tech_str = NULL; + const gchar *nw_rejection_error = NULL; + + priv = get_private (self); + if (!priv->iface_enabled) + return; + + g_object_get (self, + MM_IFACE_MODEM_3GPP_DBUS_SKELETON, &skeleton, + NULL); + if (!skeleton) + return; + + if (!error) { + mm_gdbus_modem3gpp_set_network_rejection (skeleton, NULL); + return; + } + + access_tech_str = mm_modem_access_technology_build_string_from_mask (access_technology); + nw_rejection_error = mm_network_error_get_string (error); + + mm_obj_warn (self, "Network rejection received: reason '%s' (%u), " + "operator id '%s', operator name '%s', access technology '%s'", + nw_rejection_error ? nw_rejection_error : "unknown", error, + operator_id ? operator_id : "none", + operator_name ? operator_name : "none", + access_tech_str); + + new_code = mm_network_rejection_new (); + mm_network_rejection_set_error (new_code, error); + mm_network_rejection_set_operator_id (new_code, operator_id); + mm_network_rejection_set_operator_name (new_code, operator_name); + mm_network_rejection_set_access_technology (new_code, access_technology); + + dictionary = mm_network_rejection_get_dictionary (new_code); + mm_gdbus_modem3gpp_set_network_rejection (skeleton, dictionary); +} + +/*****************************************************************************/ + +void mm_iface_modem_3gpp_update_initial_eps_bearer (MMIfaceModem3gpp *self, MMBearerProperties *properties) { diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h index af726ef0..b0f74403 100644 --- a/src/mm-iface-modem-3gpp.h +++ b/src/mm-iface-modem-3gpp.h @@ -363,6 +363,12 @@ void mm_iface_modem_3gpp_update_initial_eps_bearer (MMIfaceModem3gpp *self, MMBearerProperties *properties); void mm_iface_modem_3gpp_reload_initial_eps_bearer (MMIfaceModem3gpp *self); +void mm_iface_modem_3gpp_update_network_rejection (MMIfaceModem3gpp *self, + MMNetworkError error, + const gchar *operator_code, + const gchar *operator_name, + MMModemAccessTechnology access_technology); + /* Run all registration checks */ void mm_iface_modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self, GAsyncReadyCallback callback, |