diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2021-05-17 21:33:32 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-05-23 01:22:07 +0200 |
commit | de6b1324cb80413e552806f75c70be72cc41e933 (patch) | |
tree | 8f20a6bfc9a1ae4f4288e11a77aa54d1d178d8ce /cli/mmcli-bearer.c | |
parent | ff45d292ee75b0e49c3de3677211218445659884 (diff) |
api,bearer: new 'ConnectionError' property
This new property will provide detailed information about the failed
connection attempt, or about the network initiated disconnection. The
property will be cleared only if a new connection attempt is
triggered, and so it can be used to investigate why a given attempt
failed without needing to be the one who triggered the attempt (e.g.
so that failures in NetworkManager-triggered connection attempts can
be investigated looking at the DBus API).
The property is built as a (ss) tuple, but the libmm-glib interface
provides methods to read this property as a GError.
Diffstat (limited to 'cli/mmcli-bearer.c')
-rw-r--r-- | cli/mmcli-bearer.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/cli/mmcli-bearer.c b/cli/mmcli-bearer.c index 54d2d4c7..54da4ff9 100644 --- a/cli/mmcli-bearer.c +++ b/cli/mmcli-bearer.c @@ -133,30 +133,34 @@ mmcli_bearer_shutdown (void) static void print_bearer_info (MMBearer *bearer) { - MMBearerIpConfig *ipv4_config; - MMBearerIpConfig *ipv6_config; - MMBearerProperties *properties; - MMBearerStats *stats; - gint profile_id; - gchar *profile_id_str; - - ipv4_config = mm_bearer_get_ipv4_config (bearer); - ipv6_config = mm_bearer_get_ipv6_config (bearer); - properties = mm_bearer_get_properties (bearer); - stats = mm_bearer_get_stats (bearer); - profile_id = mm_bearer_get_profile_id (bearer); + g_autoptr(MMBearerIpConfig) ipv4_config = NULL; + g_autoptr(MMBearerIpConfig) ipv6_config = NULL; + g_autoptr(MMBearerProperties) properties = NULL; + g_autoptr(MMBearerStats) stats = NULL; + g_autoptr(GError) connection_error = NULL; + gint profile_id; + gchar *profile_id_str; + + ipv4_config = mm_bearer_get_ipv4_config (bearer); + ipv6_config = mm_bearer_get_ipv6_config (bearer); + properties = mm_bearer_get_properties (bearer); + stats = mm_bearer_get_stats (bearer); + profile_id = mm_bearer_get_profile_id (bearer); + connection_error = mm_bearer_get_connection_error (bearer); profile_id_str = (profile_id != MM_3GPP_PROFILE_ID_UNKNOWN) ? g_strdup_printf ("%d", profile_id) : NULL; mmcli_output_string (MMC_F_BEARER_GENERAL_DBUS_PATH, mm_bearer_get_path (bearer)); mmcli_output_string (MMC_F_BEARER_GENERAL_TYPE, mm_bearer_type_get_string (mm_bearer_get_bearer_type (bearer))); - mmcli_output_string (MMC_F_BEARER_STATUS_CONNECTED, mm_bearer_get_connected (bearer) ? "yes" : "no"); - mmcli_output_string (MMC_F_BEARER_STATUS_SUSPENDED, mm_bearer_get_suspended (bearer) ? "yes" : "no"); - mmcli_output_string (MMC_F_BEARER_STATUS_MULTIPLEXED, mm_bearer_get_multiplexed (bearer) ? "yes" : "no"); - mmcli_output_string (MMC_F_BEARER_STATUS_INTERFACE, mm_bearer_get_interface (bearer)); - mmcli_output_string_take (MMC_F_BEARER_STATUS_IP_TIMEOUT, g_strdup_printf ("%u", mm_bearer_get_ip_timeout (bearer))); - mmcli_output_string_take (MMC_F_BEARER_STATUS_PROFILE_ID, profile_id_str); + mmcli_output_string (MMC_F_BEARER_STATUS_CONNECTED, mm_bearer_get_connected (bearer) ? "yes" : "no"); + mmcli_output_string_take (MMC_F_BEARER_STATUS_CONNECTION_ERROR_NAME, connection_error ? g_dbus_error_encode_gerror (connection_error) : NULL); + mmcli_output_string (MMC_F_BEARER_STATUS_CONNECTION_ERROR_MESSAGE, connection_error ? connection_error->message : NULL); + mmcli_output_string (MMC_F_BEARER_STATUS_SUSPENDED, mm_bearer_get_suspended (bearer) ? "yes" : "no"); + mmcli_output_string (MMC_F_BEARER_STATUS_MULTIPLEXED, mm_bearer_get_multiplexed (bearer) ? "yes" : "no"); + mmcli_output_string (MMC_F_BEARER_STATUS_INTERFACE, mm_bearer_get_interface (bearer)); + mmcli_output_string_take (MMC_F_BEARER_STATUS_IP_TIMEOUT, g_strdup_printf ("%u", mm_bearer_get_ip_timeout (bearer))); + mmcli_output_string_take (MMC_F_BEARER_STATUS_PROFILE_ID, profile_id_str); /* Properties */ { @@ -315,11 +319,6 @@ print_bearer_info (MMBearer *bearer) } mmcli_output_dump (); - - g_clear_object (&stats); - g_clear_object (&properties); - g_clear_object (&ipv4_config); - g_clear_object (&ipv6_config); } static void |