diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/mmcli-bearer.c | 21 | ||||
-rw-r--r-- | cli/mmcli-output.c | 17 | ||||
-rw-r--r-- | cli/mmcli-output.h | 2 |
3 files changed, 32 insertions, 8 deletions
diff --git a/cli/mmcli-bearer.c b/cli/mmcli-bearer.c index 54da4ff9..e9718e40 100644 --- a/cli/mmcli-bearer.c +++ b/cli/mmcli-bearer.c @@ -270,18 +270,21 @@ print_bearer_info (MMBearer *bearer) /* Stats */ { - gchar *duration = NULL; - gchar *bytes_rx = NULL; - gchar *bytes_tx = NULL; - gchar *attempts = NULL; - gchar *failed_attempts = NULL; - gchar *total_duration = NULL; - gchar *total_bytes_rx = NULL; - gchar *total_bytes_tx = NULL; + guint64 start_date = 0; + gchar *duration = NULL; + gchar *bytes_rx = NULL; + gchar *bytes_tx = NULL; + gchar *attempts = NULL; + gchar *failed_attempts = NULL; + gchar *total_duration = NULL; + gchar *total_bytes_rx = NULL; + gchar *total_bytes_tx = NULL; if (stats) { guint64 val; + start_date = mm_bearer_stats_get_start_date (stats); + val = mm_bearer_stats_get_duration (stats); if (val) duration = g_strdup_printf ("%" G_GUINT64_FORMAT, val); @@ -308,6 +311,8 @@ print_bearer_info (MMBearer *bearer) total_bytes_tx = g_strdup_printf ("%" G_GUINT64_FORMAT, val); } + if (start_date) + mmcli_output_start_date (start_date); mmcli_output_string_take (MMC_F_BEARER_STATS_DURATION, duration); mmcli_output_string_take (MMC_F_BEARER_STATS_BYTES_RX, bytes_rx); mmcli_output_string_take (MMC_F_BEARER_STATS_BYTES_TX, bytes_tx); diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c index c681d936..90bd753a 100644 --- a/cli/mmcli-output.c +++ b/cli/mmcli-output.c @@ -248,6 +248,7 @@ static FieldInfo field_infos[] = { [MMC_F_BEARER_IPV6_CONFIG_GATEWAY] = { "bearer.ipv6-config.gateway", "gateway", MMC_S_BEARER_IPV6_CONFIG, }, [MMC_F_BEARER_IPV6_CONFIG_DNS] = { "bearer.ipv6-config.dns", "dns", MMC_S_BEARER_IPV6_CONFIG, }, [MMC_F_BEARER_IPV6_CONFIG_MTU] = { "bearer.ipv6-config.mtu", "mtu", MMC_S_BEARER_IPV6_CONFIG, }, + [MMC_F_BEARER_STATS_START_DATE] = { "bearer.stats.start-date", "start date", MMC_S_BEARER_STATS, }, [MMC_F_BEARER_STATS_DURATION] = { "bearer.stats.duration", "duration", MMC_S_BEARER_STATS, }, [MMC_F_BEARER_STATS_BYTES_RX] = { "bearer.stats.bytes-rx", "bytes rx", MMC_S_BEARER_STATS, }, [MMC_F_BEARER_STATS_BYTES_TX] = { "bearer.stats.bytes-tx", "bytes tx", MMC_S_BEARER_STATS, }, @@ -595,6 +596,22 @@ mmcli_output_signal_quality (guint value, } /******************************************************************************/ +/* (Custom) Bearer start date output */ + +void +mmcli_output_start_date (guint64 value) +{ + /* Merge value and recent flag in a single item in human output */ + if (selected_type == MMC_OUTPUT_TYPE_HUMAN) { + output_item_new_take_single (MMC_F_BEARER_STATS_START_DATE, mm_format_iso8601 (value)); + return; + } + + output_item_new_take_single (MMC_F_BEARER_STATS_START_DATE, + g_strdup_printf ("%" G_GUINT64_FORMAT, value)); +} + +/******************************************************************************/ /* (Custom) State output */ void diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h index 5416e825..6b56cafa 100644 --- a/cli/mmcli-output.h +++ b/cli/mmcli-output.h @@ -266,6 +266,7 @@ typedef enum { MMC_F_BEARER_IPV6_CONFIG_GATEWAY, MMC_F_BEARER_IPV6_CONFIG_DNS, MMC_F_BEARER_IPV6_CONFIG_MTU, + MMC_F_BEARER_STATS_START_DATE, MMC_F_BEARER_STATS_DURATION, MMC_F_BEARER_STATS_BYTES_RX, MMC_F_BEARER_STATS_BYTES_TX, @@ -367,6 +368,7 @@ void mmcli_output_listitem (MmcF field, void mmcli_output_signal_quality (guint value, gboolean recent); +void mmcli_output_start_date (guint64 value); void mmcli_output_state (MMModemState state, MMModemStateFailedReason reason); void mmcli_output_sim_slots (gchar **sim_slot_paths, |